]> git.ipfire.org Git - thirdparty/bind9.git/commit
Distribute queries among threads even on platforms without lb sockets
authorOndřej Surý <ondrej@sury.org>
Wed, 2 Dec 2020 14:37:18 +0000 (15:37 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 3 Dec 2020 08:20:33 +0000 (09:20 +0100)
commit1d066e4bc5dfcd72a8d82c5318247efb9ed86aae
treee253e0dd0196dfc62b970d9bb3616448463f016a
parentd0f540782576f53394e9be3940ba8a6d6ec6ed41
Distribute queries among threads even on platforms without lb sockets

On platforms without load-balancing socket all the queries would be
handle by a single thread.  Currently, the support for load-balanced
sockets is present in Linux with SO_REUSEPORT and FreeBSD 12 with
SO_REUSEPORT_LB.

This commit adds workaround for such platforms that:

1. setups single shared listening socket for all listening nmthreads for
   UDP, TCP and TCPDNS netmgr transports

2. Calls uv_udp_bind/uv_tcp_bind on the underlying socket just once and
   for rest of the nmthreads only copy the internal libuv flags (should
   be just UV_HANDLE_BOUND and optionally UV_HANDLE_IPV6).

3. start reading on UDP socket or listening on TCP socket

The load distribution among the nmthreads is uneven, but it's still
better than utilizing just one thread for processing all the incoming
queries
lib/isc/netmgr/netmgr-int.h
lib/isc/netmgr/netmgr.c
lib/isc/netmgr/tcp.c
lib/isc/netmgr/tcpdns.c
lib/isc/netmgr/udp.c
lib/isc/netmgr/uverr2result.c