News for hackers. Stuff that matters.
Re:PM2: Production Process Manager with a Built-In Load Bala... by Kharacternyk on Sunday April 07, 2024 @06:10AM (#39959734)
I don't think systemd has a built-in load balancer. Also, running multiple copies of the same service isn't typical PID-1 stuff, so maybe doing that with systemd involves some friction.
Re:PM2: Production Process Manager with a Built-In Load Bala... by stephenr on Sunday April 07, 2024 @10:10AM (#39960891)
Running multiple "copies" of a service is very much in systemd's wheelhouse; it's called templated units.
Re:PM2: Production Process Manager with a Built-In Load Bala... by Kharacternyk on Sunday April 07, 2024 @12:33PM (#39961838)
I know about templates, but I don't believe they are designed for fungible copies. You can run a bunch of [email protected], but it's not the same UX as `pm2 start my-app -i number-of-copies`.
Re:PM2: Production Process Manager with a Built-In Load Bala... by stephenr on Sunday April 07, 2024 @09:21PM (#39965400)
They work very well for "worker" processes. The default ssh package on Debian uses systemd template units for the user process; I've used them extensively for job queue workers, in combination with max execution time and a separate timed job to monitor queue load (essentially automatic scale up/down of queue workers).

Realistically if your prod environment relies on you manually running `pm2... ` or whatever, you're doing something wrong. User Experience should have about 0% impact on how your service daemons run.