Nginx超时和错误

时间:2015-08-20 11:23:39

标签: php nginx memcached

我正在使用带有php-fpm和memcached的Nginx,我的nginx以前工作得很好而且我在脚本中没有使用会话10天前我更新了我的脚本并开始使用session,对于会话我使用了memcache,但之后这个更新我的nginx和php-fpm给出了很多错误。我的网站运行在云服务器上,该服务器有2个核心CPU和2GB RAM,网站平均有~480个并发用户。 安装memcached后,我的cpu使用率增加了10%。

两天以来,我在php-fpm错误日志中得到了95个这样的错误。

[19-Aug-2015 22:33:05] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 4 idle, and 49 total children
[19-Aug-2015 22:33:06] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
[20-Aug-2015 01:32:37] WARNING: [pool www] child 14293 exited on signal 9 (SIGKILL) after 36091.050170 seconds from start
[20-Aug-2015 01:32:37] NOTICE: [pool www] child 19144 started

在nginx错误日志中,我收到了这些错误。

recv() failed (104: Connection reset by peer) while reading response header from upstream

upstream timed out (110: Connection timed out) while reading response header from upstream

connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream

这是我的Nginx配置;

user              nginx;
worker_processes  2;
worker_rlimit_nofile 30000;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;
events {
    worker_connections  2048;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  off;
    sendfile        on;
    keepalive_timeout  65;
    include /etc/nginx/conf.d/*.conf;

}

这是Memcached配置,

USER="memcached"
MAXCONN="5024"
CACHESIZE="100"
OPTIONS=""

请告诉我这是什么问题?我该如何解决呢。

0 个答案:

没有答案