# How to calculate the optimal number of workarou for maksimalnaya performance for a given hardware?

For 4 (or n — processors) hardware processor is spinning for a number of workerb — demons.

Need to find the optimal number of workerb, if a worker maintains for a time only one connection ( single-threaded daemon for interlocked sockets)

I want to understand the approach,
October 8th 19 at 00:26
October 8th 19 at 00:28
According to the book of John Allspaw the Art of capacity planning, you need to initially set the n-th number of sarkerov (eg. from a guide on the setting) and gently try them to povlecite-to whittle, watching the behavior of key metrics, eg. memory, CPU and disk I\O.
Generally very suggest this book to read, approaches to capacity planning is sure to understand.
thank you - mathias0 commented on October 8th 19 at 00:31
October 8th 19 at 00:30
If the worker from the real time spent on processing the request uses an average of only 25% cpu — it means workarou is run four times more than the number of cores. Plus or minus. Usually there is still additional load, like databases, so you can set a bit smaller value.
For workarou that efficiently use the cpu, not blockerase in the process, or need to put just the number of cores.
To clarify.
If you set a lower value for peak cpu will be idle, no one will load.
If more peak load will have to compete for cpu, and the worker, instead of to Refine and finish the query will terminate and return to work after a pause or will increase the average query execution time. - mathias0 commented on October 8th 19 at 00:33
I have a worker consumes 100% CPU
mean count of processors - raven_Ort commented on October 8th 19 at 00:36
and if it took 25% CPU, it is possible to increase this number to 4? - mathias0 commented on October 8th 19 at 00:39
If one stream at a constant load (when you benchmark for example) eats only 25% — then Yes, multiply by 4. - mathias0 commented on October 8th 19 at 00:42
thanks, will be measured - raven_Ort commented on October 8th 19 at 00:45
October 8th 19 at 00:32
experimenting with the number of workerb uWSGI on Python(Django) application, found that the optimum number of sarkerov (for my app), though the count of cores.

Test using ab tool.
If only in my application was a task waiting for a long time to answer and do not strain at the same percent (parsim website, waiting for a response from the database from another server, etc.) the number of workerb of newreno had to increase.

In other words my approach is an experiment. Take something in between recommended and smoothly neatly try to change it, nabludal, analyze draw conclusions, make a decision.
>> found that the optimal number of sarkerov (for my app), though the count of cores.
For 8-core and 16-core machines looked? There in theory should be close to colechester*2 (for each kernel pair of conveyors, with a couple of tasks from the OS doesn't affect the accuracy of the experiment) - mathias0 commented on October 8th 19 at 00:35
October 8th 19 at 00:34
Remember Sysoev of nginx mailing mentioned that the number of workarou can be set equal to the number of cores, but involved in this is not necessary, because due to the movement in the process of working on kernels efficiency may fall. Therefore, in the first approximation, it is still worthwhile to focus on the number of cores.
I was told that it is better to count of: number of cores x 1.5 - mathias0 commented on October 8th 19 at 00:37

Find more questions by tags Search engine optimization