netstat showing multiple lines for each listening socket
Thomas Hungenberg
th+bind at cert-bund.de
Tue Jul 9 12:52:04 UTC 2024
On 08.07.24 15:59, Lee wrote:
> How many cpus does your machine have?
> I'm running bind at home; not a whole lot of traffic to named so it
> seemed like all those threads were a waste. So pretend there's only
> one cpu:
> $ grep bind /etc/default/named
> # OPTIONS="-u bind "
> OPTIONS="-u bind -n 1"
Thanks!
I can confirm netstat and ss show only one line per socket when starting
named with option "-n 1".
However, according to the manpage there should be "*two* threads per each CPU present":
=========================================
-n #cpus
This option controls the number of CPUs that named assumes the presence of.
If not specified, named tries to determine the number of CPUs
present automatically; if it fails, a single CPU is assumed to be present.
named creates two threads per each CPU present (one thread for receiving
and sending client traffic and another thread for sending and
receiving resolver traffic) and then on top of that a single thread for
handling time-based events.
=========================================
When running named without setting "-n" on a test VM with a single CPU assigned,
I see two threads per socket which matches what the manpage says.
When starting named with "-n 1" I would expect to see two threads as well
but there is only one in the netstat / ss output.
And on a small embedded system with a single CPU, it creates *four* threads
per socket.
Hmmm...
- Thomas
More information about the bind-users
mailing list