Multi-threaded operation?

Havard Eidnes he at uninett.no
Mon Oct 5 12:43:11 UTC 2015


Hi,

it looks like I'll have to answer my own question, which is a
little disappointing:

> I'm running unbound 1.5.4 on NetBSD/amd64 7.0, and I notice that
> despite me having configured
>
> server:
>   num-threads: 12
>   so-reuseport: yes
>
> only one of the threads is handling all the queries, according to
> the output from "unbound-control stats".  "Not what I wanted."

It turns out that using the "so-reuseport" setting to distribute
the load over the threads is a fairly recent Linuxism, and
relying on it causing the kernel to distribute the load over the
different sockets is not portable.

The first answer in

  http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t

says it quite clearly:

    Linux 3.9 added the option SO_REUSEPORT to Linux as well.
    [...] Additionally the kernel performs some "special magic"
    for SO_REUSEPORT sockets that isn't found in any other
    operating system so far: For UDP sockets, it tries to
    distribute datagrams evenly, for TCP listening sockets, it
    tries to distribute incoming connect requests (those accepted
    by calling accept()) evenly across all the sockets that share
    the same address and port combination.  [...]

I'll try to turn off the so-reuseport option later today, and see
if that improves the situation.

Regards,

- Håvard



More information about the Unbound-users mailing list