Re: [nginx logging module]$Request_time almost show 0.000 with proxy cache configuration

Peter Booth peter_booth at me.com
Thu Jun 22 13:58:06 UTC 2017


This might not be a bug at all. Remember that when nginx logs request
time it's doing so with millisecond precision. This is very, very coarse-grained when you consider what
modern hardware is capable of. The Tech Empower benchmarks shwo that an (openresty) nginx on
a quad-socket host can server more than 800,000 dynamic lua requests per second. We should expect 
that static resources served from ngixn cache to be faster than this.

Remember:
 - a cache hit means that the resource should also be in the linux page cache - so no physical disk read needed.
- writing a small png file from memory to the network (on a 10G ethernet ) could take a few microsec. Depending on NIC IRQ consolidation settings this might be as much as 60/70micros.
- reading the time (gettimeofday()) will itself take about 30 nanoseconds.

These are al intervals that are too small to be visible to the 1ms granularity of the request_time logging.

My experience has been that very busy webservers running on even five year old hardware
will consistently log 0ms  request time for cache hits. If I saw anything different I'd be wondering
what was wrong with the environment.

Peter

On Jun 22, 2017, at 05:53 AM, jindov <nginx-forum at forum.nginx.org> wrote:

Hi guys,

I've configured for nginx to cache static like jpeg|png. The problem is if
request with MISS status, it will show a non-zero value request_time, but if
a HIT request, the request_time value is 0.000.
This is an nginx bug and is there anyway to resolve it.

My log format

```
log_format cache '$remote_addr - [$time_local] $upstream_cache_status
$upstream_addr '
'"$request" $status $body_bytes_sent $request_time
["$upstream_response_time"] "$http_referer" '
'"$http_user_agent" "$host" "$server_port"
"$connection"';
```

I read a topic about this but this is not informational. I've try to set
timer_resolution to 0ms but nothing was changed

Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,275053,275053#msg-275053

_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170622/9debc2b2/attachment.html>


More information about the nginx mailing list