Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So here's the situation, I run a small cluster, Dedicated box for MySQL, and a dedicated PHP-FPM/NGINX box, Nginx talks to php-fpm via socket, As far as i can tell the problem does not lie in php-fpm, it lies somewhere in my configuration.

What happens, is the site loads instant for a few moments after starting and slowly starts to degrade to load times of greater than 2 seconds, eventually taking 12 seconds to complete a load, PHP is configured to close a child after 175 requests, and spawn 20 at start and have a max of 60.

Not really sure where the bottle neck is, most of my code is optimized and works flawlessly, but these issues with nginx will most likely force me to switch back over to Apache, And I really dont want to do that, NGINX.conf configuration below.

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 {
worker_connections  512;
multi_accept on;
use epoll;

http {
include         /etc/nginx/mime.types;
access_log  /var/log/nginx/access.log;
resolver_timeout 5s;
satisfy all;

## Size Limits
limit_zone brainbug $binary_remote_addr 5m; 
client_body_buffer_size     8k;
client_header_buffer_size   75M;
client_max_body_size        1k;
large_client_header_buffers 2 1k;

## Timeouts 
client_body_timeout   60;
client_header_timeout 60;
keepalive_timeout     60;
send_timeout          60;

## General Options
ignore_invalid_headers   on;
recursive_error_pages    on;
sendfile                 on;
server_name_in_redirect off;
server_tokens           off;

## TCP options  
tcp_nodelay on;
#tcp_nopush  on;

output_buffers        128 512k;

gzip                    on;
gzip_http_version   1.0;
gzip_comp_level     7;
gzip_proxied            any;
gzip_min_length     0;
gzip_buffers            32 32k;
gzip_types          text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/jpeg image/png image/gif;

## Disable GZIP for MSIE 1-6
gzip_disable "MSIE [1-6].(?!.*SV1)";

## Set a vary header so downstream proxies don't send cached gzipped content to IE6
gzip_vary on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

share|improve this question
Sounds like a Windows server. Does a reboot "refresh" it? –  tomjedrz Jun 29 '11 at 23:28
Check log files (especially Nginx's error.log and PHP-FPM log). Define a custom log format in Nginx and log $upstream_response_time to access.log to see how long your upstream (PHP-FPM) processes requests –  Alexander Azarov Jun 30 '11 at 5:16
Tomjedrz, The server is linux (ubuntu 10.10 server) –  Rylea Stark Jul 2 '11 at 3:28
Alexander, I have done that over the last few days, and i have worked it out to a degree, I had an i/o bottleneck that i fixed and now im also working on flattening out all the errors that have recently popped up, once those are done ill see if it improves, if so, We might have a fix. I also turned down how many php children are running and that seems to have given a speed performance. –  Rylea Stark Jul 2 '11 at 3:30
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.