正在加载...

搜索到原作者的话:

As a general rule you need the only worker with large number of
worker_connections, say 10,000 or 20,000.

However, if nginx does CPU-intensive work as SSL or gzipping and
you have 2 or more CPU, then you may set worker_processes to be equal
to CPU number.

Besides, if you serve many static files and the total size of the files
is bigger than memory, then you may increase worker_processes to
utilize a full disk bandwidth.

Igor Sysoev

一般一个进程足够了,你可以把连接数设得很大。如果有SSL、gzip这些比较消耗CPU的工作,而且是多核CPU的话,可以设为和CPU的数量一样。或 者要处理很多很多的小文件,而且文件总大小比内存大很多的时候,也可以把进程数增加,以充分利用IO带宽(主要似乎是IO操作有block)。

根据我配置实践,服务器是“多个CPU+gzip+网站总文件大小大于内存”的环境,worker_processes设置为CPU个数的两倍比较好。

: http://www.ha97.com/1124.html

本文相关评论 - 才 3 条评论
2010-07-26 22:28:17
Google Chrome 6.0.472.0 Google Chrome 6.0.472.0 Windows 7 Windows 7

谢谢楼主的分享….

CPU的个数是不区分的单核还是多核的么?

2010-07-26 23:45:32
Firefox 3.6.8 Firefox 3.6.8 Windows Vista Windows Vista

上面的意思其实是根据CPU的内核数,如果两个4核的CPU,worker_processes可以设置为8或16。