# Inconsistent latency to sub\_status

**URL:** <https://www.ruby-forum.com/t/inconsistent-latency-to-sub-status/215777>\
**Category:** NGINX\
**Created:** [January 15, 2012, 8:40pm UTC](https://www.ruby-forum.com/t/inconsistent-latency-to-sub-status/215777 "2012-01-15T20:40:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 15, 2012, 8:40pm UTC](https://www.ruby-forum.com/t/inconsistent-latency-to-sub-status/215777/1 "2012-01-15T20:40:30Z")

</div>

Hi,

We use nginx in a latency sensitive application on our own hardware. We  
have a monitoring system running on the local network that pings the  
nginx\_status page from the sub\_status module once per minute. In  
addition to collecting the stats from the page, it also measures the  
round trip latency. Latency is often sub 1ms, but sometimes spikes to  
over 30ms or more and can stay there for up to 5 consecutive minutes. I  
am trying to identify the source of the latency jitter, if possible.

We run ubuntu 10.04, which has a 100Hz system timer, so I expect that  
consistently getting below 10ms response is unlikely. Spiking to 30ms,  
however, feels like there is a config issue somewhere - whether system  
or nginx. Nginx is a front end for us; all requests are passed to a  
FCGI backend via unix sockets (no static file serving).

This is an 8 physical core box with hyperthreading turned on. It isn’t  
swapping, has very low disk activity, no TCP/IP issues that I can tell.  
CPU use ranges from 20 - 40% across all cores (the application and nginx  
are co-resident). The box handles between 300 and 1500 requests/sec. I  
have not noticed any correlation between higher overall load and higher  
ping latency; it seems to be pretty random.

Any suggestions on other things to investigate are appreciated.

Config details follow.

Cheers,

Dean

We are running Nginx 1.0.5

nginx.conf (excerpt):  
worker\_processes 8;  
worker\_rlimit\_nofile 16384;  
worker\_priority 0;

events {  
multi\_accept off;  
accept\_mutex off;  
worker\_connections 8192;  
}

http {  
error\_log /var/log/nginx/error.log info buffer=32k;  
access\_log /var/log/nginx/access.log main buffer=128k;  
sendfile off;  
tcp\_nodelay on;  
}

server {  
listen :80 default\_server backlog=1024;  
}

sysctl.conf (excerpt):

vm.swappiness=0  
vm.vfs\_cache\_pressure = 50  
fs.file-max = 65535  
net.ipv4.ip\_local\_port\_range = 2000 65000  
net.ipv4.tcp\_rmem = 4096 87380 8388608  
net.ipv4.tcp\_wmem = 4096 87380 8388608  
net.core.rmem\_max = 8388608  
net.core.wmem\_max = 8388608  
net.core.netdev\_max\_backlog = 5000  
net.core.somaxconn=4096  
net.ipv4.tcp\_max\_syn\_backlog = 2048  
net.ipv4.tcp\_window\_scaling = 1  
net.ipv4.tcp\_fin\_timeout = 30  
net.unix.max\_dgram\_qlen=1024

Posted at Nginx Forum:

> **[Inconsistent latency to sub\_status](https://forum.nginx.org/read.php?2,221270,221270#msg-221270)**
>
> Hi, We use nginx in a latency sensitive application on our own hardware. We have a monitoring system running on the local network that pings the nginx\_status page from the sub\_status module once per minute. In addition to collecting the stats from...

---

<div class="post-metadata">

**Author:** ![dbanks](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@dbanks](https://www.ruby-forum.com/u/dbanks)\
**Post date:** [April 28, 2012, 4:05am UTC](https://www.ruby-forum.com/t/inconsistent-latency-to-sub-status/215777/2 "2012-04-28T04:05:44Z")

</div>

I found the issue – this server handles a mix of SSL and regular  
traffic. When initially configuring SSL, I used a 4096-bit CSR and did  
not manage cypher selection carefully. As a result, nginx workers spent  
a lot of time in OpenSSL, calls unable to service other requests. The  
ratio of SSL to regular traffic made the ping latency erratic.

The fix was straightforward: use a smaller CSR and select  
server-preferred cyphers that were less computationally intensive.

Cheers,

Dean

Posted at Nginx Forum:

> **[Re: Inconsistent latency to sub\_status](https://forum.nginx.org/read.php?2,221270,225889#msg-225889)**
>
> Hi, We use nginx in a latency sensitive application on our own hardware. We have a monitoring system running on the local network that pings the nginx\_status page from the sub\_status module once per minute. In addition to collecting the stats from...
