<div dir="auto">The default mode (Accept=no) expects your daemon to remain running forever and handle *all* requests in the same instance. Basically once the daemon is started and receives the listening socket, it continues working like a traditional daemon would: start an event loop, perhaps use threads or workers, and so on. Parallelization is up to you.<div dir="auto"><br></div><div dir="auto">If you actually want to have one instance per client, then use Accept=yes and make sure your .service unit is templated – i.e. named "foobar@.service". (In this case systemd will call accept() for you, so you'll directly receive the client socket, not the listener socket.)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 6, 2020, 00:16 Daniel Tihelka <<a href="mailto:dtihelka@gmail.com">dtihelka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div>I am adding socket activation to a daemon. It basically works well, but for multiple simultaneous connections, the systemd seems to serialize the incoming requests, spawning the daemon for each request only after the previous request is served (i.e. the daemon terminates). </div><div><br></div><div>Is it really the case? Or I am doing something wrong?</div><div><br></div><div>I use "classic" approach as:</div><div><br></div><div>n = sd_listen_fds(0);<br>      if (n >= 1) {<br>  for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++)<br></div><div> ...</div><div><br></div><div><br></div><div>So, the question is: how to convince systemd to spawn instances in parallel every time a new connection is established on the socket, instead of serializing them? Although the server is contacted rather rarely (and thus I deal with socket activation), it takes a longer time to finish with the client. And when would multiple clients contact the server simultaneously, they will wait for a long time ...</div><div><br></div><div>Thank you for your advice.</div><div><br></div><div>Best regards,</div><div>Dan T.</div><div><br></div><div><br></div><div><br></div></div>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div>