nginx slow for no reason

Maxim Dounin mdounin at mdounin.ru
Mon Aug 8 20:01:17 UTC 2011


Hello!

On Mon, Aug 08, 2011 at 02:01:55PM -0400, Marki555 wrote:

> Thanks, I wasn't sure whether kernel or nginx replies to the SYN
> packets. Now the question is how can I check for the network problems.
> SYN_RECV is also when kernel has replied with SYN+ACK, but I waiting for
> a final ACK? But SYN_RECV is also when user-space is unable to accept()
> the new connections so fast. How can I distinguish between these 2
> reasons?

Again: SYN_RECV connections are sitting in kernel waiting for ACK 
to happen.  Only ESTABLISHED connections are passed to userland.

SYN_RECV connections may appear on Linux as a result of listen 
queue being overflowed (as Linux just drops ACKs by default if 
there isn't enough room in listen queue), but this is *not* a 
listen queue, these connections can't be acepted.  This is rather 
artifact of the way how Linux handles listen queue overflows.

> But anyway, why should that prevent legitimate normal connections from
> being accepted? When I try to access nginx' server-status, I am waiting
> for many seconds...

First of all, you may want to actually check how many connections 
are sitting in listen queue.  Under FreeBSD use

   netstat -Lan

to find queue lengths.  Under Linux 2.6.18+ it should be possible 
to examine listen queue with

   ss -nlt

For older Linux versions check

   netstat -ntp

and count connections in ESTABLISHED state without associated 
process.

Maxim Dounin



More information about the nginx mailing list