Ngin goes down under high traffic


#1

Please look at http://pub.horror.superhosting.cz/data/eth0-6h.png.
Everytime nginx goes under high traffic, it stops offering files and
instead of
this, it starts reading of discs (it reads about 400Mb/s but send
nothing). I
have to restart nginx then.
Linux Debian etch 2.6.24, nginx 0.6.32,
nginx.conf:
user www-data;
worker_processes 64;

error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;

events {
worker_connections 2048;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log  /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;

include /etc/nginx/sites-enabled/*;

}

You may add here your

server {

}

statements for each of your virtual hosts

server {
listen xx.89.xx.xx:80;
server_name free.xx.com;

    access_log  "/home/logs/free/nginx_access.log";

error_log “/home/logs/free/nginx_error.log” info;

    location / {
            root   "/home/www/xx.com/free";
            index  index.html index.htm;
rewrite "^/(.*)" "/index.php?cgi_download_uri=$1" last;

}

location /storage/ {
internal;
alias /storage/;
}

    #error_page  404  /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
            root   /var/www/nginx-default;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    location ~ \.php$ {
       proxy_pass   http://127.0.0.1;
 proxy_set_header  X-Real-IP  $remote_addr;
       proxy_set_header  Host  $host;
             proxy_set_header  X-Forwarded-For 

$proxy_add_x_forwarded_for;
proxy_buffering off;
}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
            #deny  all;
    #}

}

Thank you for any suggestion.


#2

Try reducing the number of workers you have. Nginx is not like apache,
you don’t need one worker per active connection. I would suggest no
more than 1 or 2 workers per spindle max.

Cheers

Dave


#3

You sure its nginx, maybe php ?
Anything in logs ? Tryed strace on working nginx processes (when it
starts reading off the disc) to see what’s happening ?

I think more info is needed. What type of content your delivering, disc
configuration, etc.

On Sun, 16 Nov 2008 18:19:17 +0000 (UTC)


#4

Hi David,

David Pospisil schrieb:

Please look at http://pub.horror.superhosting.cz/data/eth0-6h.png.
Everytime nginx goes under high traffic, it stops offering files and instead of
this, it starts reading of discs (it reads about 400Mb/s but send nothing). I
have to restart nginx then.
Linux Debian etch 2.6.24, nginx 0.6.32,

[…]

Thank you for any suggestion.
It might be something pretty basic. I just had it in a similar
constellation with a database server. Did you test whether your network
interface supports more than the maximum throughput your graph is
showing? I realized that GBit interfaces are sometimes already maxed out
at 300-400 MBit and when I added additional interfaces and created a
bonding interface the load went away and everything was working fine
again.

Just a thought.

Sebastian


Sebastian Geib

Chabango IT Services
Zillestraße 74/76
10585 Berlin

Fon: +49 (0) 30 327 67 98-0
Fax: +49 (0) 30 327 67 98-5

E-Mail: removed_email_address@domain.invalid