hitxiong 发表于 2012-2-8 09:53:20

双核CPU,2G内存跑过万IPDZ论坛优化设置问题

租用的万网独立服务器 独享主机II型
E2140/E2180/   PD2.8G双核2G DDRII 160GSATA


服务器上跑的应用概况:
1) discuz7.2搭建的论坛 每日IP 14000左右 PV 8万左右伪静态
2)ECMS 主页 ,每日IP 2000 ,PV 1万左右静态页面
3)ucenter home 社区 PV 3000动态


服务器装的LNMP 0.8

1)my.cnf 的设置

cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf

但是原来 /etc/my.cnf 中的以下设置我没有删除

set-variable=max_connections=1500
set-variable=max_user_connections=1000
set-variable=wait_timeout=200

max_connections,max_user_connections
//有所增大,因为discuz 论坛出现过 User XXXX already has more than 'max_user_connections' active connections

2)nginx优化
修改/usr/local/nginx/conf/nginx.conf中的
worker_processes 1为worker_processes 4

问题:2Intel(R) Pentium(R) DualCPUE2180@ 2.00GHz
worker_processes 设置多少合适?
我没有设置 worker_cpu_affinity
我看有些配置如下:
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;

worker_cpu_affinity 设置是否需要加呢?

3)php-cgi优化:
"max_children"我现在设置为108
服务器是2G DDRII设置这么大合适么?

eaccelerator 我安装了

[ 本帖最后由 hitxiong 于 2012-2-8 10:12 编辑 ]

cnmt 发表于 2012-2-8 11:25:10

关注。。。。。关注。。。。。关注。。。。。

licess 发表于 2012-2-8 13:01:11

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

    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

多核可以加上worker_cpu_affinity

max_children没法说,按你自己的实际使用调,不够就加。

hitxiong 发表于 2012-2-8 14:21:11

谢谢军哥

2Intel(R) Pentium(R) DualCPUE2180@ 2.00GHz
------------------------------
那么我可以这样设置么:
worker_processes 2;
worker_cpu_affinity 01 10;

sofs 发表于 2012-2-8 22:33:54

worker_processes 2
max_children64 (你这样的配置别超过128)
页: [1]
查看完整版本: 双核CPU,2G内存跑过万IPDZ论坛优化设置问题