Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

Lucas Rolff lucas at lucasrolff.com
Sat May 12 16:29:43 UTC 2018


It can be as simple as doing a curl to your “origin” url (the one you proxy_pass to) for the files you see that gets a lot of MISS’s – if there’s odd headers such as cookies etc, then you’ll most likely experience a bad cache if your nginx is configured to not ignore those headers.

From: nginx <nginx-bounces at nginx.org> on behalf of Quintin Par <quintinpar at gmail.com>
Reply-To: "nginx at nginx.org" <nginx at nginx.org>
Date: Saturday, 12 May 2018 at 18.26
To: "nginx at nginx.org" <nginx at nginx.org>
Subject: Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

[https://mailtrack.io/trace/mail/86a613eb1ce46a4e7fa6f9eb96989cddae639800.png?u=74734]
My proxy cache path is set to a very high size

proxy_cache_path  /var/lib/nginx/cache  levels=1:2   keys_zone=staticfilecache:180m  max_size=700m;
and the size used is only

sudo du -sh *
14M cache
4.0K    proxy
Proxy cache valid is set to

proxy_cache_valid 200 120d;
I track HIT and MISS via

add_header X-Cache-Status $upstream_cache_status;
Despite these settings I am seeing a lot of MISSes. And this is for pages I intentionally ran a cache warmer an hour ago.

How do I debug why these MISSes are happening? How do I find out if the miss was due to eviction, expiration, some rogue header etc? Does Nginx provide commands for this?

- Quintin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180512/4f838fb7/attachment.html>


More information about the nginx mailing list