nginx運行出現cpu us+sy 100% id 0的情況,網站訪問不了
大家好,我的nginx運行出現cpu us+sy =100$ id和wa都是0
還是第一次見這麼怪異的cpu佔用
大概配置如下:
nginx.confworker_processes 16;
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
...php-fpm.conf...
<value name="max_children">128</value>
Settings group for 'apache-like' pm style
<value name="apache_like">
Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected
<value name="StartServers">20</value>
Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>
Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MaxSpareServers">35</value>
</value>
...是怎麼回事?謝謝了
《解決方案》
有攻擊 ?
《解決方案》
回復 2# Fjcyz
沒有攻擊
《解決方案》
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S}'
看下狀態
《解決方案》
就是nginx吃的cpu么?
《解決方案》
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.
《解決方案》
關注中。。。。
《解決方案》
和那個是一個帖子吧 可以下面操作后看看。
看下你的ulimit估計是不夠用了
# vi /etc/sysctl.conf
底部添加
fs.file-max=65535
#vi /etc/security/limits.conf
加上
* soft nofile 65535
* hard nofile 65535
啟動Nginx
ulimit -SHn 65535
/usr/local/nginx/sbin/nginx
配置開機自動啟動Nginx + PHP
vi /etc/rc.local
在末尾增加以下內容:
引用
ulimit -SHn 65535
/usr/local/php/sbin/php-fpm start
/usr/local/nginx/sbin/nginx
《解決方案》
回復 4# xuledw
TCP狀態異常,是ESTABLISHED超少
《解決方案》
回復 8# xuledw
是的,系統打開文件限制已配置