0

I'm trying to calculate the maximum number of threads that can be created for a specific application based on my system configuration.

I've gone through one formula for this:

N_threads = N_cpu * U_cpu * (1 + W / C)

where,
    N_threads is the optimal number of threads
    N_cpu is the number of prcessors
    U_cpu is the target CPU utilization 
    W / C is the ratio of wait time to compute time (0 for CPU-bound task,   maybe 10 or 100 for slow I/O tasks)

Based on what W/c is calculated for I/o bound tasks.

Can anyone please help me out regarding this issue ...

dev777
  • 999
  • 6
  • 17
  • 34

2 Answers2

0

the ratio "W / C" depend on various parameters and can different between development environment and real service environment. IMHO, the best practice is convert #thread to parameter, and probe it with various values then choose the value that give your system the best performance.

vudangngoc
  • 128
  • 2
  • 6
0

W/C represents the ratio between the waiting time over the computing time and it belongs to the range [0; 100].

For example, when you choose 10 as the value of W/C, it means that the waiting time should be 10 times larger than the computing time. In general, the higher value, the longer waiting time is.

I have no exact method to identify this ratio. But I would share with you my heuristic one. I would ask myself: "How likely I should wait for the answers from other hosts?"

  • most of the time:
  • sometimes:
  • there is no waiting time, then of course 0
Uvuvwevwevwe
  • 971
  • 14
  • 30