BUG/MINOR: sock_inet: use SO_REUSEPORT_LB where available
authorWilly Tarreau <w@1wt.eu>
Sat, 22 Apr 2023 18:12:59 +0000 (20:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 23 Apr 2023 07:46:15 +0000 (09:46 +0200)
commit9f53b7b41ac7bb8b415550ca626a635b2808cc3b
tree32ed8e67db2ca6bd696e4817cbdbe7f151f3ba76
parentccf8012f283ce075c9b962cf461fdb4fdc06ee7c
BUG/MINOR: sock_inet: use SO_REUSEPORT_LB where available

On FreeBSD 13.1 I noticed that thread balancing using shards was not
always working. Sometimes several threads would work, but most of the
time a single one was taking all the traffic. This is related to how
SO_REUSEPORT works on FreeBSD since version 12, as it seems there is
no guarantee that multiple sockets will receive the traffic. However
there is SO_REUSEPORT_LB that is designed exactly for this, so we'd
rather use it when available.

This patch may possibly be backported, but nobody complained and it's
not sure that many users rely on shards. So better wait for some feedback
before backporting this.
src/sock_inet.c