freebsd-dev/sys/netinet6
Andrew Gallatin a034518ac8 Filter TCP connections to SO_REUSEPORT_LB listen sockets by NUMA domain
In order to efficiently serve web traffic on a NUMA
machine, one must avoid as many NUMA domain crossings as
possible. With SO_REUSEPORT_LB, a number of workers can share a
listen socket. However, even if a worker sets affinity to a core
or set of cores on a NUMA domain, it will receive connections
associated with all NUMA domains in the system. This will lead to
cross-domain traffic when the server writes to the socket or
calls sendfile(), and memory is allocated on the server's local
NUMA node, but transmitted on the NUMA node associated with the
TCP connection. Similarly, when the server reads from the socket,
he will likely be reading memory allocated on the NUMA domain
associated with the TCP connection.

This change provides a new socket ioctl, TCP_REUSPORT_LB_NUMA. A
server can now tell the kernel to filter traffic so that only
incoming connections associated with the desired NUMA domain are
given to the server. (Of course, in the case where there are no
servers sharing the listen socket on some domain, then as a
fallback, traffic will be hashed as normal to all servers sharing
the listen socket regardless of domain). This allows a server to
deal only with traffic that is local to its NUMA domain, and
avoids cross-domain traffic in most cases.

This patch, and a corresponding small patch to nginx to use
TCP_REUSPORT_LB_NUMA allows us to serve 190Gb/s of kTLS encrypted
https media content from dual-socket Xeons with only 13% (as
measured by pcm.x) cross domain traffic on the memory controller.

Reviewed by:	jhb, bz (earlier version), bcr (man page)
Tested by: gonzo
Sponsored by:	Netfix
Differential Revision:	https://reviews.freebsd.org/D21636
2020-12-19 22:04:46 +00:00
..
dest6.c Fix m_pullup() problem after removing PULLDOWN_TESTs and KAME EXT_*macros. 2019-12-01 00:22:04 +00:00
frag6.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
icmp6.c Fix use-after-free in icmp6_notify_error(). 2020-10-28 20:22:20 +00:00
icmp6.h
in6_cksum.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
in6_fib.c Refactor fib4/fib6 functions. 2020-11-29 13:41:49 +00:00
in6_fib.h Refactor fib4/fib6 functions. 2020-11-29 13:41:49 +00:00
in6_gif.c Switch gif(4) path verification to fib[46]_check_urfp(). 2020-05-28 07:26:18 +00:00
in6_ifattach.c Make sure the multicast release tasks are properly drained when 2020-08-10 10:46:08 +00:00
in6_ifattach.h
in6_jail.c
in6_mcast.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
in6_pcb.c Filter TCP connections to SO_REUSEPORT_LB listen sockets by NUMA domain 2020-12-19 22:04:46 +00:00
in6_pcb.h Filter TCP connections to SO_REUSEPORT_LB listen sockets by NUMA domain 2020-12-19 22:04:46 +00:00
in6_pcbgroup.c
in6_proto.c Remove unused nhop_ref_any() function. 2020-09-20 21:32:52 +00:00
in6_rmx.c Introduce scalable route multipath. 2020-10-03 10:47:17 +00:00
in6_rss.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
in6_rss.h Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
in6_src.c Remove unused nhop_ref_any() function. 2020-09-20 21:32:52 +00:00
in6_var.h Simplify dom_<rtattach|rtdetach>. 2020-08-14 21:29:56 +00:00
in6.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
in6.h Expose nonstandard IPv6 kernel definitions to standalone builds. 2020-12-04 21:51:47 +00:00
ip6_ecn.h
ip6_fastfwd.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip6_forward.c ipv6: quit dropping packets looping back on p2p interfaces 2020-08-31 01:45:48 +00:00
ip6_gre.c Introduce NET_EPOCH_CALL() macro and use it everywhere where we free 2020-01-15 06:05:20 +00:00
ip6_id.c ip6_randomflowlabel: Avoid blocking if random(4) is not available 2019-04-23 17:18:20 +00:00
ip6_input.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip6_mroute.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip6_mroute.h
ip6_output.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
ip6_var.h Convert route caching to nexthop caching. 2020-04-25 09:06:11 +00:00
ip6.h
ip6protosw.h
ip_fw_nat64.h Reapply r345274 with build fixes for 32-bit architectures. 2019-03-19 10:57:03 +00:00
ip_fw_nptv6.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
mld6_var.h icmpv6: Fix mbuf change in mld 2019-11-18 21:59:47 +00:00
mld6.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
mld6.h
nd6_nbr.c icmp6: Count packets dropped due to an invalid hop limit 2020-10-19 17:07:19 +00:00
nd6_rtr.c Refactor rib iterator functions. 2020-11-22 20:21:10 +00:00
nd6.c Remove RADIX_MPATH config option. 2020-11-29 19:43:33 +00:00
nd6.h Switch inet6 default route subscription to the new rib subscription api. 2020-07-12 11:24:23 +00:00
pim6_var.h
pim6.h
raw_ip6.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
raw_ip6.h
route6.c Fix m_pullup() problem after removing PULLDOWN_TESTs and KAME EXT_*macros. 2019-12-01 00:22:04 +00:00
scope6_var.h Make net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl. 2020-08-15 11:37:44 +00:00
scope6.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp6_usrreq.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp6_var.h
send.c
send.h
tcp6_var.h Remove tcp_rtlookup6() function signature. 2020-04-13 08:26:11 +00:00
udp6_usrreq.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
udp6_var.h