[Unbound-users] [PATCH] performance increase with SO_REUSEPORT on Linux 3.9+
W.C.A. Wijngaards
wouter at nlnetlabs.nl
Mon Jan 27 10:28:47 UTC 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Robert,
On 01/24/2014 06:12 PM, Robert Edmonds wrote:
> W.C.A. Wijngaards wrote:
>> Hi Robert,
>>
>> On 01/07/2014 04:05 AM, Robert Edmonds wrote:
>>> Hi,
>>>
>>> There is a SO_REUSEPORT socket option available on Linux 3.9+,
>>> described in this LWN article:
>>
>> Thank you very much for this patch. I have applied it. (small
>> changed in header comments, and documentation entry).
>>
>> The only thing I wonder if it wouldn't be better to make this
>> the default setting. It could be disabled if you then mention it
>> in the config file? This would still only apply to Linux systems
>> (unless we had some way for a similar effect on other systems,
>> and then we have to rename this linux-reuseport?)
>>
>> Best regards, Wouter
>
> Hi, Wouter:
>
> You could try to enable Linux/SO_REUSEPORT support if it is
> available, by detecting whether __linux__ and SO_REUSEPORT are
> defined at compile time. But it's possible for SO_REUSEPORT to be
> defined at compile time but not usable at run time (e.g., new
> headers with old kernel, for example during a Linux distribution
> upgrade where the new userland is temporarily running with the
> previous kernel), in which case setsockopt() will fail with
> ENOPROTOOPT.
>
> With the current version of this patch, the daemon will fail to
> start if it tries to set SO_REUSEPORT and setsockopt() fails. So I
> would not recommend making this the default just yet.
>
> It would be possible to detect if SO_REUSEPORT is not available at
> run time and fall back to only using a single listening socket.
> That would require a little more coordination between the daemon
> code and the code that initializes the sockets but it's certainly
> possible.
This is implemented, it detectes and uses it. You can thus enable
this option on multiple platforms, but only on the linux platforms
with the right kernel will it take effect, on the others it falls back
to using the existing setup. This means you can have the same config
(and perhaps binary) on multiple machines.
Best regards,
Wouter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJS5jTfAAoJEJ9vHC1+BF+NyHMP/075lP8GW38BGPS4zbb5RUCZ
eRnHUDvtqsYZi0uqUqzyzOlke/S1xIhl56wrOtp3yOtQmF24IUmgbIflXpmhBpeH
TG3ULpz3BPX3efsbw0WrcsACUSgg59M0LBcywYBuB69FVSN1aCaXrJhgUxICfhHF
bv3XVQW4jxDQKjtqmGSluZTrQR5lavwWlMRxu/j/H64AWiX6UgVZv/IhS8SyRDlR
G/BJH2Hyrq3hV0DStT6hSMslEoatJbnndz7jnt9EFMzTPC0bTuYY8jvAO7SreTZF
k8kpHG9+v01PGgoCxi73i70t2IU4KjiyzYT1ny9E4GPIERBsONlVQVVDE9OgdT6C
GnGwTsHJPc2LeRmLwmS9dAeUt4DuQkbS9Kuyu5XOCXQsczFZkm1t4cdkFasm6z1F
ockO3++QskF9o9ogxViORqrRIxkCZ8ExO4GxTP7b+NLZswWVC8z6CBJCdU5+Y1Z0
yg+7y0wFE0aMn1AZp0zdTd3Dp5U949WoPFI4eqOFs0sn8chAjJn8HWS/MIPlmyis
/7TvRTi9nYZjFDM9Sq2FJRcY/OevLPmTXLQFa99+dU4l53cRnFd5HFuJ23nSxK2x
1zFCNamwJhrp5Tblc6F5ktn82wT9g9TSrxVXt0CPfUUlJqB8IqA+Qr62PmAVfPz6
grWLx6f6kaRgdrK8UHNa
=n7gU
-----END PGP SIGNATURE-----
More information about the Unbound-users
mailing list