Measuring request processing time

Hi!

Is there a way to measure time Nginx takes to process request? Not
$request_time, but rather something like “time between request was fully
read and request is ready to pass it to the backend”.
I need it to evaluate perfomance of the geoip2 module:

I need this because I’ve measured speed of official MaxMind Perl modules
for legacy and new versions of their databases and found that lib for
new
version is hundreds times slower than legacy. (yes, I’ve used XS
version)
Now, I will be using new format anyway - because MaxMind provide only
free
legacy databases, and free databases have way too bad accuracy.
But I would like to assess the consequences.

Best regards,
Dmitriy Shalashov

Hi!

Is there a way to measure time Nginx takes to process request? Not
$request_time, but rather something like “time between request was fully
read and request is ready to pass it to the backend”.
I need it to evaluate perfomance of the geoip2 module:

I need this because I’ve measured speed of official MaxMind Perl modules
for legacy and new versions of their databases and found that lib for
new
version is hundreds times slower than legacy. (yes, I’ve used XS
version)
Now, I will be using new format anyway - because MaxMind provide only
free
legacy databases, and free databases have way too bad accuracy.
But I would like to assess the consequences.

Maybe $request_time - $upstream_response_time will fit?

Best regards,
Dmitriy Shalashov

Hello!

On Wed, May 27, 2015 at 05:08:52PM +0300, wrote:

version is hundreds times slower than legacy. (yes, I’ve used XS version)
Now, I will be using new format anyway - because MaxMind provide only free
legacy databases, and free databases have way too bad accuracy.
But I would like to assess the consequences.

Maybe $request_time - $upstream_response_time will fit?

I don’t think that resolution of nginx time-related variables will
be enough to measure geoip lookup times. If you want to evaluate
performance, I would rather suggest to write some simple configs
like:

    location = /geoip1 {
        return 200 $geoip_country_code;
    }

    location = /geoip2 {
        return 200 $geoip2_data_country_code;
    }

    location = /static {
        return 200 XX;
    }

and to try benchmarking them with something like wrk.


Maxim D.
http://nginx.org/

Thanks! That is a good idea.

So Nginx will do some work to fill these variables only in their
corresponding locations?

Best regards,
Dmitriy Shalashov

2015-05-27 17:53 GMT+03:00 Maxim D. [email protected]:

Hello!

On Wed, May 27, 2015 at 07:28:56PM +0300, wrote:

Thanks! That is a good idea.

So Nginx will do some work to fill these variables only in their
corresponding locations?

Yes, both standard geoip module and 3rd party geoip2 module you’ve
linked only do database lookups if you try to use corresponding
variables.


Maxim D.
http://nginx.org/