> - a cache hit means that the resource should also be in the linux page cache - so no physical disk read needed.

That's a very wrong assumption to make, and only makes sense in very small scale setups - and multiple terabytes of memory isn't exactly cheap, that's why we have SSD storage to handle such things, and it would still be a "HIT" even if it's not within the memory.



Peter Booth wrote:
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-fo...@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@nginx.org <mailto:nginx@nginx.org>
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to