Recommended worker_processes configuration #103
-
As I understand, the general rule of thumb is to configure the number of workers the same as the number of CPU cores. I know that every application is different, but I'm wondering what's your recommendation based on your experience. Would be fine if it's set x1.5? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That is true for servers that use threads such as Puma. For Pitchfork or Unicorn, since processes are mostly idle when doing IOs, the recommendation is to have more processes than CPU cores to increase utilization. Like many other things, it's a latency vs throughput tradeoff. If you wish to get latency as low as possible at all costs, 1 process per core is the way to go. If you are trying to squeeze as much throughput as possible out of a given server, then adding more processes until system metrics show processes are queuing to be executed is the way to go. And of course there is potentially some sweet spot in the middle based on your priorities. |
Beta Was this translation helpful? Give feedback.
That is true for servers that use threads such as Puma.
For Pitchfork or Unicorn, since processes are mostly idle when doing IOs, the recommendation is to have more processes than CPU cores to increase utilization.
Like many other things, it's a latency vs throughput tradeoff. If you wish to get latency as low as possible at all costs, 1 process per core is the way to go.
If you are trying to squeeze as much throughput as possible out of a given server, then adding more processes until system metrics show processes are queuing to be executed is the way to go.
And of course there is poten…