On 30 Apr 2017, at 13.51, Timo Sirainen tss@iki.fi wrote:
New processes aren't created until client_limit is reached in all the existing processes. When there are multiple processes they're all listening for new connections and whichever happens to be fastest gets it. Related to this, I'm thinking about implementing SO_REUSEPORT (https://lwn.net/Articles/542629/ https://lwn.net/Articles/542629/ <https://lwn.net/Articles/542629/ https://lwn.net/Articles/542629/> <https://lwn.net/Articles/542629/ https://lwn.net/Articles/542629/ <https://lwn.net/Articles/542629/ https://lwn.net/Articles/542629/>>) soon that would change the behavior a bit. Although its main purposes would be as a workaround to allow Dovecot restarts to work even though some of the old processes are still keeping the listener port open.
Huh, SO_REUSEPORT was already implemented in 2013. I completely forgot about that. Would be useful to try if it works better (or at least not worse) and maybe change it to be enabled by default in some version.
service ... { inet_listener ... { reuse_port = yes
After some testing, looks like it's not working correctly. Needs some further thinking to figure out if it can be even made to work well with Dovecot.