soreuseport: TCP/IPv4 implementation
Allow multiple listener sockets to bind to the same port. Motivation for soresuseport 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. Signed-off-by:Tom Herbert <therbert@google.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
Showing
- include/net/inet_hashtables.h 10 additions, 3 deletionsinclude/net/inet_hashtables.h
- include/net/netfilter/nf_tproxy_core.h 1 addition, 0 deletionsinclude/net/netfilter/nf_tproxy_core.h
- net/ipv4/inet_connection_sock.c 37 additions, 11 deletionsnet/ipv4/inet_connection_sock.c
- net/ipv4/inet_hashtables.c 22 additions, 6 deletionsnet/ipv4/inet_hashtables.c
- net/ipv4/tcp_ipv4.c 3 additions, 1 deletionnet/ipv4/tcp_ipv4.c
Please register or sign in to comment