nginx的worker_processes,worker_cpu_affinity及worker_connections
worker_processes:nginx要开启的进程数,一般为cpu的核数
worker_cpu_affinity:为每个进程绑定一个cpu,减少cpu切换的开销
配置示例:
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_connections:一个worker进程能并发处理(发起)的最大连接数
对于nginx最大客户端,计算方法大致如下:
nginx作为http服务器的时候:
max_clients = worker_processes * worker_connections
nginx作为反向代理服务器的时候:
max_clients = worker_processes * worker_connections/4