nginx latency/performance issues

Maxim Dounin mdounin at
Fri Jan 5 01:58:45 UTC 2018


On Thu, Jan 04, 2018 at 06:12:38PM -0500, eFX News Development wrote:

> Hello! Thanks for your response. I'm using apache bench for the 
> tests, simply hitting the same static javascript file (no php). 
> I was thinking since I'm using the same location and as long as 
> the tests are repeatable, using remote testing would be ok and 
> give more realistic results.

With ApacheBench on an SSL host you are likely testing your SSL 
configuration.  Or, rather, performance of handshakes with most 
secure ciphersuite available in your OpenSSL library.  Try 
looking into detailed timing information provided by ApacheBench, 
it should show that most of the time is spend in the "Connect" 
phase - which in fact means that the time is spent in SSL 
hadshakes.  Also try using keepalive connections with "ab -k" to 
see a drammatic difference.

> Both apache and nginx are on the same machine, just using 
> different IP aliases so I can connect to both via port 443. 
> After more detective work, I think I've narrowed the problem to 
> the aliasing. The first alias which nginx is on is slower than 
> the second where apache is. When I placed nginx on the same ip, 
> but different port than apache, the speed is much better. There 
> must be some ip address priority as the nginx server is new and 
> has zero traffic on it. This is probably out of scope, but if 
> you have any other thoughts or advice, let me know.

First of all, check if your results are statistically significant.  
That is, take a look at the "+/-sd" column in the ApacheBench 
detailed output.  Alternatively, run both tests at least three 
times and compare resulting numbers using ministat(1).

Maxim Dounin

More information about the nginx mailing list