Strange change in writing. (webserver)

Maxim Dounin mdounin at mdounin.ru
Wed Sep 8 00:10:37 MSD 2010


Hello!

On Mon, Sep 06, 2010 at 11:08:50PM -0400, heric wrote:

> Hello!
> 
> I use Nginx / fastcgi.
> 
> See the graph of connections:
> 
> [img]http://img707.imageshack.us/img707/3285/graf19.png[/img]
> 
> 
> [b]Normal requests:[/b]
> 
> Active connections: 2185 
> Reading: 94 Writing: 736 Waiting: 1355 
> 
> [b]Strange behavior:[/b]
> 
> Active connections: 10893 
> Reading: 136 Writing: 9454 Waiting: 1303 
> 
> Periodically, the number of "Writing" requests increases, slowing the
> server.

"Writing" state counts requests with already read request headers, 
but not yet fully answered.

Increase may indicate that your backend(s) don't cope with load 
and nginx is waiting for backend replies...

> [b]part of nginx.conf:[/b]
> 
> worker_processes  2;
> events {
>     worker_connections  11000;
> }
> http {
> keepalive_timeout     30 60;
> limit_zone eueu $binary_remote_addr 10m;
> limit_req_zone  $binary_remote_addr  zone=one:10m   rate=2r/s;
> 
> server {
> 
>         location ~ \.php$ {
>                 fastcgi_pass 127.0.0.1:9000;
>                 fastcgi_index index.php;
>                 fastcgi_param SCRIPT_FILENAME
> /var/www$fastcgi_script_name;
>                 include fastcgi_params;
>         }
> 
> 
> limit_conn  eueu 30;
> limit_req   zone=one  burst=5;

... or requests are just sitting in limit_req's delay.  Extra 8k 
connections with limit_conn set to 30 will require only something 
about 300 clients.  And 2r/s is quite low, especially if images 
are on the same server with the same limits applied, and likely to 
delay significant part of your users.  You may want to try 
limit_req with 'nodelay' flag.  Or at least do some stats to check 
if the above actually applies.

Maxim Dounin



More information about the nginx mailing list