NGiNX performance degrades over time.

Posted by Rylea Stark on Server Fault See other posts from Server Fault or by Rylea Stark
Published on 2011-06-29T23:17:31Z Indexed on 2011/06/30 0:23 UTC
Read the original article Hit count: 256

Filed under:
|
|

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/*;

}

© Server Fault or respective owner

Related posts about nginx

Related posts about php-fpm