pcp
[Top] [All Lists]

Default Number of Threads for Service Discovery via Active Probing

To: PCP Mailing List <pcp@xxxxxxxxxxx>
Subject: Default Number of Threads for Service Discovery via Active Probing
From: Dave Brolley <brolley@xxxxxxxxxx>
Date: Wed, 02 Jul 2014 12:09:40 -0400
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
Frank had asked me on IRC to consider lowering the default number of threads use for this. There is currently a hard limit of FD_SETSIZE which is 1024 on linux and this is also the default. This was chosen since it is the maximum number of open file descriptors that can be tolerated by libpcp due to the use of __pmFdSet.

However, while this is the hard upper limit, the code currently automatically reduces this to the size of the subnet being probed. So, for example, for a /24 inet network, this is automatically be reduced to 256. Thus the hard limit of 1024 would only be enforced when probing a network of size 1024 or greater (inet /22 or more)

The current max stack size for the worker threads is 2 * PTHREAD_STACK_MIN which is 2 * 16k on linux. 1024 threads would then be 32M of stack on linux. I see that solaris uses _sysconf(_SC_THREAD_STACK_MIN). Perhaps one way to do this would be to decide what the maximum amount of total stack we want to use is and then to divide that by the amount of stack used per thread. Of course, the hard limit of FD_SETSIZE would still be applied.

Thoughts?

Dave

<Prev in Thread] Current Thread [Next in Thread>
  • Default Number of Threads for Service Discovery via Active Probing, Dave Brolley <=