Skip to main content

Name

thread_pool_stats — Obtain information about thread pools

Synopsis

thread_pool_stats { poolname } [ jobname ]

Description

thread_pool_stats takes a thread pool name as its first argument and returns a hash containing various information about the pool, including the number of threads in the pool, queue size, and number of invocations.

If the optional jobname is also specified, the queue size and the number of running instances for that specific job in the pool is also returned.

Note

The list of thread pools can be obtained on the console using the threads stats command.

The returned hash contains these keys and associated values:

poolname

The name of the pool (e.g. "CPU", "IO", "SWAPIN", etc).

queue_sz

The queue size (number of jobs pending for this thread pool).

invocations

The number of jobs that have been handled by this thread pool.

job_num_queued

The queue size for the specific job described in jobname. This will be present only if the jobname argument was given.

job_num_running

The number of running instances of the specific job described in jobname. This will be present only if the jobname argument was given.

$stats = thread_pool_stats "CPU";
$qsize = $stats["queue_sz"];
if ec_test :value "gt" :comparator "i;ascii-numeric" "${qsize}" "100" {
  ec_tarpit 10 "CPU queue backlog";
}

$stats = thread_pool_stats "CPU" "clamav_avscan";
$jqsize = $stats["job_num_queued"];
if ec_test :value "gt" :comparator "i;ascii-numeric" "${jqsize}" "100" {
  ec_action 451 "resource unavailable";
}
Was this page helpful?