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

Lennart Poettering lennart at poettering.net
Thu Nov 14 10:10:51 PST 2013


On Thu, 14.11.13 07:50, Shawn Landden (shawn at churchofgit.com) wrote:

Heya,

So, if I understand this patch correctly then you are spawning
additional processes inside the same service, reaching voer from the
socket? Hmm, no, please not.

The way I believe this should work is more akin to the handling of
per-connection instances, i.e. how Accept=yes is handled. We'd spawn a
couple of service instances from the same template. Instead of naming
each instance after the incoming connection (which in this case we know
nothing about, since we wouldn#t accept the connection) we'd just number
them. Instead of passing along the connection socket we'd pass the
listening socket over to each instance. (Well, or a new socket if
ReusePort is enabled and the specific socket type supports
SO_REUSEPORT).

This way, each instance can have its own Restart setting to ensure it
stays running.

When the first connection comes in we'd spawn as many instances as
configured in Distribute=, and as soon as the last instance is gone we'd
go back to the beginning, wait for the next connection coming in, and
then start the same number again. As long as at least one instance is
still running we'd not watch the listening socket.

Hope that makes sense,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list