Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2011 17:01:54 +0400
From:      Maxim Dounin <mdounin@mdounin.ru>
To:        Michael <michael@gameservice.ru>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Random TCP 3 second delay
Message-ID:  <20110513130154.GV42265@mdounin.ru>
In-Reply-To: <1069574542.20110512235022@gameservice.ru>
References:  <17710363528.20110512130123@gameservice.ru> <20110512104939.GS42265@mdounin.ru> <1069574542.20110512235022@gameservice.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello!

On Thu, May 12, 2011 at 11:50:22PM +0300, Michael wrote:

> 
> MD> 3 seconds delay usually indicate packet loss somewhere along the 
> MD> path.  You have to examine your network between nginx and your app 
> MD> to find out where (and why) packets are lost.
> I don't think i have packet loss, traffic is going via loopback

Packet loss is quite possible over loopback as well, though it's 
usually caused by some resource shortage or policy rules in 
action.

BTW, please make sure you don't have net.inet.tcp.nolocaltimewait 
set.

> MD> Some basic steps on FreeBSD include looking though "netstat -id", 
> MD> "netstat -s" output, "vmstat -z" output and your ethernet 
> MD> controller stats via "sysctl dev.<driver>" (if any).
> I don't see dropped packets on lo0 with netstat -id
> What  should i see in "netstat -s" and "vmstat -z"?

In netstat - look for various drops and overflows, most notably 
syncache and others tcp-related.  In vmstat -z - look for 
allocation failures and/or full zones, most notably mbufs and 
other tcp-related zones.

> MD> You may also want to check if you by accident have some statefull 
> MD> firewall between nginx and backend.
> I  have  only  ipfw  rules,  and  the  first  rule is accepting local
> traffic: 00005 8211184509 4547370329265 allow ip from me to me
> 
> can this be the problem?

AFAIK it shouldn't, but you may want to check sysctl 
net.inet.ip.fw.dyn_count and net.inet.ip.fw.dyn_max sysctl's 
anyway.

Maxim Dounin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110513130154.GV42265>