Find the size of the ideal thread pool

suppose you have a quad-core machine with no hyperthreading, running multiple parallel tasks, with 75% of each task"s time spent on IO,25% computing. Ask what the ideal thread pool size is


for reference only

Thread pool size generally needs to be configured according to the type of task:

if it is a CPU-intensive task, you need to squeeze the CPU, reference value as much as possible. You can set the reference value to NCPU+1

.

if it is an IO-intensive task, the reference value can be set to 2*NCPU

of course, this is only a reference value, and the specific settings need to be adjusted according to the actual situation. For example, you can set the thread pool size to the reference value first, and then make appropriate adjustments by observing the task operation, system load and resource utilization

.

you can refer to the following information:
how to reasonably estimate the thread pool size?

Menu