linux: set SO_REUSEPORT on listen sockets #747

Closed
bnoordhuis opened this Issue Mar 16, 2013 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

bnoordhuis commented Mar 16, 2013

    The motivating case for so_resuseport in TCP would be something like
    a web server binding to port 80 running with multiple threads, where
    each thread might have it's own listener socket.  This could be done
    as an alternative to other models: 1) have one listener thread which
    dispatches completed connections to workers. 2) accept on a single
    listener socket from multiple threads.  In case #1 the listener thread
    can easily become the bottleneck with high connection turn-over rate.
    In case #2, the proportion of connections accepted per thread tends
    to be uneven under high connection load (assuming simple event loop:
    while (1) { accept(); process() }, wakeup does not promote fairness
    among the sockets.  We have seen the  disproportion to be as high
    as 3:1 ratio between thread accepting most connections and the one
    accepting the fewest.  With so_reusport the distribution is
    uniform.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c617f398edd4db2b8567a28e899a88f8f574798d

Available in 3.9-rc1.

@ghost ghost assigned bnoordhuis Mar 16, 2013

@bnoordhuis bnoordhuis removed their assignment May 12, 2015

@bnoordhuis bnoordhuis closed this May 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment