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
|