Use of worker_cpu_affinity in hyper-threading context

Maxim Dounin mdounin at
Fri Nov 21 19:23:56 UTC 2014


On Thu, Nov 20, 2014 at 07:37:56PM +0100, Alex wrote:

> Hi,
> I have one E3-1240 v3 CPU here, which has 4 cores with hyper-threading
> enabled. Currently I have the following setup in nginx.conf:
> worker_processes 4;
> worker_cpu_affinity 10100000 01010000 00001010 00000101;
> In other words, I bind each of the four workers to two (virtual) cores
> (similar to example in
> For a
> medium-sized frequented site, would you consider this the "correct" way? Or
> would you leave out the worker_cpu_affinity setting and let the CPU
> scheduler do the rest?

Unless in your workload nginx is CPU-bound, I would recommend to 
let the OS scheduler to do the work.

Maxim Dounin

More information about the nginx mailing list