<html><body><div>This might not be a bug at all. Remember that when nginx logs request </div><div>time it's doing so with millisecond precision. This is very, very coarse-grained when you consider what</div><div>modern hardware is capable of. The Tech Empower benchmarks shwo that an (openresty) nginx on</div><div> a quad-socket host can server more than 800,000 dynamic lua requests per second. We should expect </div><div>that static resources served from ngixn cache to be faster than this.</div><div><br data-mce-bogus="1"></div><div></div><div>Remember:</div><div> - a cache hit means that the resource should also be in the linux page cache - so no physical disk read needed.</div><div>- 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.</div><div>- reading the time (gettimeofday()) will itself take about 30 nanoseconds.</div><div><br data-mce-bogus="1"></div><div>These are al intervals that are too small to be visible to the 1ms granularity of the request_time logging.</div><div><br data-mce-bogus="1"></div><div>My experience has been that very busy webservers running on even five year old hardware</div><div>will consistently log 0ms request time for cache hits. If I saw anything different I'd be wondering</div><div>what was wrong with the environment.</div><div><br data-mce-bogus="1"></div><div></div><div>Peter</div><div><br>On Jun 22, 2017, at 05:53 AM, jindov <nginx-forum@forum.nginx.org> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content">Hi guys,<br><br>I've configured for nginx to cache static like jpeg|png. The problem is if<br>request with MISS status, it will show a non-zero value request_time, but if<br>a HIT request, the request_time value is 0.000.<br>This is an nginx bug and is there anyway to resolve it.<br><br>My log format<br><br>```<br>log_format cache '$remote_addr - [$time_local] $upstream_cache_status<br>$upstream_addr '<br> '"$request" $status $body_bytes_sent $request_time<br>["$upstream_response_time"] "$http_referer" '<br> '"$http_user_agent" "$host" "$server_port"<br>"$connection"';<br>```<br><br>I read a topic about this but this is not informational. I've try to set<br>timer_resolution to 0ms but nothing was changed<br><br>Thanks<br><br>Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,275053,275053#msg-275053" data-mce-href="https://forum.nginx.org/read.php?2,275053,275053#msg-275053">https://forum.nginx.org/read.php?2,275053,275053#msg-275053</a><br><br>_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org" data-mce-href="mailto:nginx@nginx.org">nginx@nginx.org</a><br><a href="http://mailman.nginx.org/mailman/listinfo/nginx" data-mce-href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></span></div></div></blockquote></div></body></html>