Hello to all,
I’m an nginx user since version 0.4 (thank’s Igor for this great webserver!) but now I’m going crazy due to a vm powered by debian 6, nginx 1.0.13, php 5.3 (fpm + xcache) and mysql 5.5.
Doing some benchmark using siege, I saw that the server doesn’t serve more that ~9 transactions/s with a default wordpress installation. The server is a virtual machine (kvm hypervisor) with 4gb ram and 2 last gen physical XEON cores (100% dedicated to my vm).
The bottleneck is not mysql or nginx (I hope), the high CPU load (there isn’t waiting I/O %) is generated by PHP processes spawned to handle incoming requests.
Here you can read my nginx/php-fpm config, I hope that someone may write me where I’m wrong.
NGINX:
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
server_names_hash_bucket_size 64;
sendfile on;
#tcp_nopush on;
client_max_body_size 700m;
connection_pool_size 256;
client_body_buffer_size 1024k;
client_header_buffer_size 8k;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
}
server {
listen 192.168.1.110:80;
server_name localwptest.com;
root /home/htadmin/domains/localwptest.com/public_html;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9100;
}
}
PHP-FPM:
listen = 127.0.0.1:9100
pm = dynamic
pm.max_children = 50
pm.start_servers = 25
pm.min_spare_servers = 15
pm.max_spare_servers = 25
pm.process_idle_timeout = 10s;
pm.max_requests = 400