Distribute queries among threads even on platforms without SO_REUSEPORT_LB
requested to merge 2137-so_reuseport-doesn-t-distribute-udp-queries-to-multiple-netmgr-workers-on-macos into main
On platforms without load-balancing socket all the queries would be handle by a single thread. This commit adds workaround for such platforms that:
-
setups single shared listening socket for all listening nmthreads for UDP, TCP and TCPDNS netmgr transports
-
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 UV_HANDLE_BOUND and optionally UV_HANDLE_IPV6).
-
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
Closes #2137 (closed)
Edited by Ondřej Surý