4 ms·
socket activation is nice, but i dont think its intention is for something like this. if your app automatically quits after 5 minutes, and it takes a few second
by funthree 14y ago
socket activation is nice, but i dont think its intention is for something like this. if your app automatically quits after 5 minutes, and it takes a few seconds to start because initialization in node is synchronous, then this is just kind of weird
monit is great because you can get emails if your app goes down, it monitors files and all kinds of other stuff. you could easily use socket activation with monit so that a crashing node process drops as few connections as possible by passing along the fd to another node process, but then if you are going to do this you might as well use cluster and fork your node process.
tldr; many ways to skin a cat, but turning off your node process because it is idle is kind of weird because it has implications for the first visitor, and it shouldnt just be reached for as a standard way of running node
- chad_oliver 14y agoI believe the last slide shows that the restart takes 48 milliseconds, and I get similar results with one of my own processes running on our server. This doesn't seem like a big deal at all. For large node programs, this approach may require careful optimization of the start process in the same way that we optimize the client-side page loading process.
- rubenv 14y agoChad_oliver is right: the impact is negligible. We wouldn't do it if it would deteriorate the user experience. There's a lot of great documentation on the systemd site. An exact description of socket activation and its intended use cases is on there as well: this is definitely one of them.
- funthree 14y agodifferent node processes start up differently, some can take a while. auto-quit after 5 minutes, really? socket activation is helpful for lazily loading things when a system boots up, so everything can be started in parallel and the order that processes come online doesnt matter. its been adapted to all kinds of things and im not saying it wouldnt work in some use cases to conserve resources, but socket activation + auto quit is a bit odd. node actually benefits from running for a long time or from being hit with a lot of requests -- even if your app starts fast you are trading this away among many other things...