Re: [PATCH 1/1] net: Add SO_REUSEPORT_LISTEN_OFF socket option as drain mode
From: Eric Dumazet <hidden>
Date: 2015-09-27 01:04:05
On Sat, 2015-09-26 at 17:30 -0700, Tolga Ceylan wrote:
For applications using SO_REUSEPORT listeners, there is no clean way to switch traffic on/off or add/remove listeners without dropping pending connections. With this patch, applications can turn off queueing of new connections for a specific listener socket which enables implementation of zero down time server applications. For example, a popular web server nginx handles application configuration changes by forking new processes (listeners) and waiting for old processes (listeners) to finish up their processing. However, this approach is distruptive as removal of a listener will drop pending connections for that listener. Instead, with this patch, nginx can maintain two sets of listener socket pools to be used by old/new processes and switch traffic off/on using this socket option. Old processes set set this socket option to drain their existing queues.
What about listen(fd, 0) ? Not sure we need to add a new socket option. It makes sense to extend reuseport logic to ignore listeners with a 0 backlog (if not already done, I did not check)