我們有nginx的PHP5 - fpm的APC設定運行的web服務器。 然而,我們的頁面呈現在最近經歷了上游連接超時錯誤和緩慢起伏。一個快速的php5-fpm重啓解決了這個問題,但我們找不到原因。nginx的PHP5 - fpm的上游超時(110:連接超時),同時連接到上游
我們有另一個Web服務器正在運行的Apache2下另一個子域,連接同一個數據庫,這樣做完全一樣的工作。但是緩慢的下降只發生在nginx-fpm服務器上。 我認爲PHP5-FPM或APC可能導致的問題。
日誌告訴各種連接超時:
upstream timed out (110: Connection timed out) while connecting to upstream bla bla bla
的PHP5-FPM日誌不顯示任何東西。只要孩子開始和結束:
Apr 07 22:37:27.562177 [NOTICE] [pool www] child 29122 started
Apr 07 22:41:47.962883 [NOTICE] [pool www] child 28346 exited with code 0 after 2132.076556 seconds from start
Apr 07 22:41:47.963408 [NOTICE] [pool www] child 29172 started
Apr 07 22:43:57.235164 [NOTICE] [pool www] child 28372 exited with code 0 after 2129.135717 seconds from start
服務器時出現錯誤和負載平均爲僅2(2cpus 16cores)未加載和PHP5-FPM過程似乎是工作的罰款。
的nginx的conf:
user www-data;
worker_processes 14;
pid /var/run/nginx.pid;
# set open fd limit to 30000
worker_rlimit_nofile 30000;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
nginx的啓用站點的conf:
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors off;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 20;
fastcgi_send_timeout 20;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
## Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}
}
upstream backend {
server 127.0.0.1:9000;
}
FPM的conf:
pm.max_children = 500
pm.start_servers = 100
pm.min_spare_servers = 50
pm.max_spare_servers = 100
pm.max_requests = 10000
有在FPM的conf文件緊急重新啓動設置。 我不知道他們是否幫我們解決了這個問題?
emergency_restart_interval = 0
fpm.conf中的listen選項怎麼樣?它監聽端口9000嗎? – CyberDem0n 2011-04-08 03:08:36
當然。聽= 127.0.0.1:9000 – faraklit 2011-04-08 15:24:56