[systemd-devel] [PATCH] core: support Distribute=n to distribute to n workers

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Jan 6 05:29:11 PST 2014


On Mon, Jan 06, 2014 at 04:14:40AM -0800, David Timothy Strauss wrote:
> On Sun, Jan 5, 2014 at 1:44 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > 3. The strategy of dup()ing the socket doesn't work. I wrote
> >    a simple server in python which logs the connections [2], and hooked
> >    it up into systemd [3-4] (*). If REUSEPORT was working correctly,
> >    each connection would be handled by just one instance, either created
> >    previously, or newly created by systemd for this connection. But
> >    I see the same connection being accept()ed by one of the instances
> >    and systemd itself spawning a new instance. I'm pretty sure that what
> >    Lennart wrote before, that you need to create a new socket bound to
> >    the same port for REUSEPORT to take effect, is true.
> 
> I've also seen pretty even (but not perfect, especially with
> event-based designs) distribution with multiple processes simply
> running accept() on the same inherited socket.
It'll work fine with multiple daemons all waiting in accept (e.g. in a threaded
server), because only one will be woken. But if they are using poll, they will
all get notified and race. But this second option is what we're working towards
here.

Zbyszek



More information about the systemd-devel mailing list