VPS侦探论坛

 找回密码
 注册
查看: 7699|回复: 4

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

[复制链接]
发表于 2012-2-8 09:53:20 | 显示全部楼层 |阅读模式

租用的万网独立服务器 独享主机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

问题:2  Intel(R) Pentium(R) Dual  CPU  E2180  @ 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 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-8 11:25:10 | 显示全部楼层


关注。。。。。关注。。。。。关注。。。。。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 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没法说,按你自己的实际使用调,不够就加。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2012-2-8 14:21:11 | 显示全部楼层

谢谢军哥




2  Intel(R) Pentium(R) Dual  CPU  E2180  @ 2.00GHz
------------------------------
那么我可以这样设置么:
worker_processes 2;
worker_cpu_affinity 01 10;
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2012-2-8 22:33:54 | 显示全部楼层

worker_processes 2
max_children  64 (你这样的配置别超过128)

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 07:25 , Processed in 0.026459 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表