? worker_cpu_affinity with HEX-mask

Maxim Dounin mdounin at mdounin.ru
Tue Nov 15 00:50:08 UTC 2022


Hello!

On Mon, Nov 14, 2022 at 07:38:53AM -0500, ymarkman wrote:

> The documentation gives an worker_cpu_affinity example with BINARY Bit-mask
> with 1word-per-1cpu
> Is it possible to give a HEX-mask like 0xf0f0 instead long-long BBIN mask
> 
> I have 96 CPUs and would like to use last CPU-numbers in the affinity.
> How to do that?

As of now, only binary masks are supported by nginx, so you'll 
have to write a long binary mask if you need to.  The most simple 
approach would be to use "auto" with just one mask, so nginx will 
distribute worker processes automatically among the allowed CPUs, 
e.g.:

worker_cpu_affinity auto 111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;

For readability you can use spaces to separate groups of bits 
(though you'll have to use quotes to ensure the whole mask will be 
in a single argument):

worker_cpu_affinity auto "11111111 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000";

See http://nginx.org/r/worker_cpu_affinity for details.

Hope this helps.

-- 
Maxim Dounin
http://mdounin.ru/



More information about the nginx mailing list