Hi all,
For yesterday, my server is getting slower and slower…
Sometime php-fpm is taking up 100% cpu, and there are about 1G free
memory.
Everytime I restart nginx and php-fpm, webserver will be OK. But after
about
15minutes, it’ll be very slow…
My server is running debian, and web server is
Nginx+php-fpm+memcached+mysql.
Hardware environment is I3 and 4G memory. It’s that it’s not hardware
problem.
And below is my configurations, anyone can give me a suggestion about
this
issue? How can I optimize server performance?
Nginx.conf
user www-data;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 10240;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_bucket_size 128;
server_name_in_redirect off;
server_tokens off;
keepalive_timeout 60;
send_timeout 60;
client_header_buffer_size 4k;
large_client_header_buffers 4 4k;
client_max_body_size 20m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 9;
gzip_types text/plain text/css image/x-icon image/bmp
application/x-javascript application/xml;
gzip_vary on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/;
}
php5-fpm.conf
listen = 127.0.0.1:9000
user = www-data
group = www-data
pm = dynamic
pm.max_children = 66
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 16
pm.max_requests = 512