nginx latency/performance issues

Maxim Dounin mdounin at
Thu Jan 4 16:52:44 UTC 2018


On Wed, Jan 03, 2018 at 09:01:16PM -0500, Ameer Antar wrote:

>    Hello All,
>    First time subscriber here, as I am new to using nginx. My question is
>    about latency/performance issue as compared to our previously
>    configured Apache server. Our web application is running on Apache +
>    PHP-FPM, and we are planning on publishing a new site which contains
>    only static files "published" from within the web application on a set
>    interval. Thinking of saving the overhead of apache and php, I've setup
>    nginx-light package on ubuntu and configured the server with minimal
>    changes from default. Just to see what kind of improvement we have, I
>    compared avg response times for the same static javascript file and
>    noticed a difference, but the opposite of what I expected: ~128ms from
>    apache and ~142ms from nginx. I've also tested with php enabled on
>    nginx and seen about the same results.
>    There must be something not right. I've looked at a lot performance
>    tips, but no huge difference. The only minor help was switching to
>    buffered logging, but the difference is probably close to the margin of
>    error. Can anyone help?

Depending on what and how you've measured, the difference between 
~128ms and ~142ms might be either non-significant, or explainable by 
different settings, or have some other explanation.  You may want 
to elaborate a bit more on what and how you are measuring.  Also, 
you may want to measure more details to better understand where 
the time is spent.

In any case, both values are larger than 100ms, and this suggests 
that you aren't measuring local latency.  Likely, most of the 
latency is network-related, and switching servers won't help much 
here.  In particular, if you are measuring latency on real users 
within your web application, the difference might be due to no 
established connection and/or no cached SSL session to a separate 
static site.

Maxim Dounin

More information about the nginx mailing list