About Nginx status

This is my nginx status below:

Active connections: 6119
server accepts handled requests
 418584709 418584709 455575794 
Reading: 439 Writing: 104 Waiting: 5576

      

The wait value is much higher than Read and Write, is this ok?

Is it open because of "keep-alive"?

But if I send a lot of requests to the server, the Read and Write value does not increase, so I think there must be a bottleneck for nginx or whatever.

+3


source to share


2 answers


The time Waiting

is equal Active - (Reading + Writing)

, meaning the connection is still open, waiting for either a new request or an expiration date.

You can change the default keepalive value (which is 75 seconds)

keepalive_timeout 20s;

      

or tell the browser when it should close the connection by adding an extra second timeout in the header sent to the browser



keepalive_timeout 20s 20s;

      

but in this nginx page on keepalive, you see that some browsers don't care about the header (anyway, your site is not very grateful for this optional parameter).

keepalive is a way to reduce the overhead of making a connection as most of the time the user will be navigating the site, etc. (plus multiple requests from one page, loading css, javascript, images, etc.)

It depends on your site, you can reduce keepalive - but keep in mind that connections are expensive. This is a trade-off that you should refine depending on the site statistics. You can also decrease the timeout a little (75s → 50, then 30 weeks later ...) and see how the server behaves.

+2


source


You really don't want to fix this, since "wait" means "keep" the connections. They consume almost no resources (socket + about 2.5 MB memory per 10,000 connections in nginx).

Are short queries expected? perhaps they read / write and then close in a short amount of time.



If you are sincerely interested in fixing it, you can check if nginx is a bottleneck, you can set keep-alive to 0 in nginx config:

keepalive_timeout 0;

      

0


source







All Articles