Changing shared thread pool settings

Changing shared thread pool settings

Dynamic shared thread pool performance is tunable via cbepctl set flush_param command options.


The dynamic shared thread pool performance is tunable by changing the thread types inside the ep-engine and memcached at run time. cbepctl set flush_param command options adjust the number of threads that prioritize read, write, non-i/o and auxiliary-i/o operations. These settings take effect immediately and do not require that the bucket be restarted.

Note: These settings only take effect if the underlying operating system has a sufficient number of CPU cores. The minimum number of CPU cores is four (4), however, three (3) additional cores are required for each additional writer thread. For example, five (5) writer threads is a valid setting if the underlying hardware has at least sixteen (16) cores.

The following are the command option parameters used for performance tuning:

Table 1. Performance tuning parameters
Parameter Description
max_num_readers Overrides the default number of global threads that prioritize read operations.
max_num_writers Overrides the default number of global threads that prioritize write operations.
max_num_auxio Overrides the default number of global threads that prioritize auxio operations.
max_num_nonio Overrides the default number of global threads that prioritize nonio operations.


The following is the basic syntax:

cbepctl [localhost]:11210 -b [bucket-name] set flush_param [parameter] [value]


To set the maximum number of writers, use max_num_writers parameter. In the following example, max_num_writers sets the number of writer threads to five (5).

cbepctl -b foo_bucket set flush_param max_num_writers 5 


The following is an example response when setting the maximum number of writer threads.

setting param: max_num_writers 5
set max_num_writers to 5

To check how many threads of various types are currently running, use cbstats workload . For example:

cbstats [localhost]:11210 -b [bucket-name] workload 

For example, the following shows an example request and response for cbstats workload , in this case, for the default bucket. The setting change, ep_workload:max_writers: 5 , is displayed via the cbstats workload response:

cbstats workload

 ep_workload:LowPrioQ_AuxIO:InQsize:   2
 ep_workload:LowPrioQ_AuxIO:OutQsize:  0
 ep_workload:LowPrioQ_NonIO:InQsize:   18
 ep_workload:LowPrioQ_NonIO:OutQsize:  0
 ep_workload:LowPrioQ_Reader:InQsize:  8
 ep_workload:LowPrioQ_Reader:OutQsize: 0
 ep_workload:LowPrioQ_Writer:InQsize:  12
 ep_workload:LowPrioQ_Writer:OutQsize: 0
 ep_workload:max_auxio:                1
 ep_workload:max_nonio:                1
 ep_workload:max_readers:              4
 ep_workload:max_writers:              5
 ep_workload:num_auxio:                1
 ep_workload:num_nonio:                1
 ep_workload:num_readers:              4
 ep_workload:num_shards:               4
 ep_workload:num_sleepers:             10
 ep_workload:num_writers:              5
 ep_workload:ready_tasks:              0