Giuseppe,
thanks for having a look.
Regarding 10 lines of JS: The node cluster module
<http://nodejs.org/api/cluster.html> is part of nodejs core and runs a bit
longer than that. It's actually a fairly elegant way to implement prefork
style servers with support for graceful restarts, sane signal handling etc
without requiring changes in the individual services. It is also not
specific to HTTP, but works with arbitrary socket servers.
On Tue, Feb 24, 2015 at 12:02 AM, Giuseppe Lavagetto <
glavagetto(a)wikimedia.org> wrote:
So, is there a way to run a single worker without
forking out? If not, I guess it would be easy to add this option ('run
as a single worker on port XXX') to the service-runner.
Yes, you can either set num_workers to 0 in the config, or pass in -n 0 on
the commandline. This is especially useful for small installs and
development / profiling.
What you seem to be hinting at though is a preference for running each
worker on a different port & then using iptables or LVS to distribute
requests across the workers. This model can be supported with
service-runner as well (with -n 0 or 1), but would involve a lot more
moving parts and require solutions for coordinated graceful restarts. Which
compelling benefit do you see in going down that route?
Gabriel