worker_cpu_affinity
Syntax: worker_cpu_affinity cpumask [cpumask...]
Default: none
Linux only.
With this option you can bind the worker process to a CPU, it calls sched_setaffinity().
For example worker_processes 2; worker_cpu_affinity 01 10; worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000; Bind each worker process to one CPU only. worker_processes 2; worker_cpu_affinity 0101 1010; Bind the first worker to CPU0/CPU2, bind the second worker to CPU1/CPU3. This is suitable for HTT
nginx可以使用多个worker进程,原因如下:
to use SMP to decrease latency when workers blockend on disk I/O 。to limit number of connections per process when select()/poll()。 is used The worker_processes and worker_connections from the event sections allows you to calculate maxclients value:
max_clients = worker_processes * worker_connections
综上:2核是 01,四核是0001,8核是00000001,有多少个核,就有几位数,1表示该内核开启,0表示该内核关闭。
时间: 2024-10-07 05:12:32