[PATCH] SO_REUSEPORT support for listen sockets
Tom van der Woerdt
info at tvdw.eu
Fri Jul 26 08:31:13 UTC 2013
You might want to add some checks to ensure compilation doesn't fail on platforms that don't define the constant, such as Windows.
> On 26 jul. 2013, at 10:07, Sepherosa Ziehau <sepherosa at gmail.com> wrote:
> Hi all,
> I have the following preliminary patch to enable SO_REUSEPORT feature
> on listen sockets:
> The basic idea of the above patch is:
> - Defer the listen socket creation until work processes are forked
> - Work process creates listen socket, and set SO_REUSEPORT before bind(2)
> - Accept mutex is no longer needed, since worker process is not
> contended on the single listen socket anymore
> The SO_REUSEPORT sockopt on Linux:
> The SO_REUSEPORT sockopt on DragonFlyBSD:
> The non-blocking accept(2) w/ SO_REUSEPORT performance improvement on
> The preliminary httperf test shows w/ "so_reuseport on" gives me ~33%
> req/s performance improvement on DragonFlyBSD:
> httperf is running as:
> httperf --server=$server_name --wsess=5000,1,1 --max-conn=4
> Same testing machines and network configuration as in:
> Each client runs 16 above httperf test, except the box w/ bce, which
> runs 8 above httperf.
> The nginx w/ "so_reuseport on" is doing 49852 reqs/s (4 run avg) and
> there are 35%~40% idle time on each hyperthread.
> The nginx w/o "so_reuseport on" is doing 37386 reqs/s (4 run avg).
> Any feedbacks are welcome.
> Best Regards,
> Tomorrow Will Never Die
> nginx-devel mailing list
> nginx-devel at nginx.org
More information about the nginx-devel