Memory usage in nginx proxy setup and use of min_uses
Lucas Rolff
lucas at lucasrolff.com
Sun May 16 16:46:17 UTC 2021
Hi everyone,
I have a few questions regarding proxy_cache and the use of proxy_cache_min_uses in nginx:
Let’s assume you have an nginx server with proxy_cache enabled, and you’ve set proxy_cache_min_uses to 5;
Q1: How does nginx internally keep track of the count for min_uses? Is it using SHM to do it (and counts towards the key_zone limit?), or something else?
Q2: How long time does nginx keep this information for the number of accesses. Let’s say the file gets visited once in a 24 hour period; Would nginx keep the counter at 1 for that whole period, or are there some set timeout where it’s “flushed”.
Q3: If you have a user who decides to access files with a random query string on it; We want to prevent caching this to fill up the storage (The main reason for setting the proxy_cache_min_uses in the first place) – but are we gonna fill up the memory (and keys_zone limit) regardless; If yes – is there a way to prevent this?
Basically the goal is to understand even just broadly how min_uses are counted, and possibly how to prevent memory from being eaten up in case someone decides to access the same URL once with millions of requests – if there’s any way to flush out the memory for example, for anything that haven’t yet reached the proxy_cache_min_uses if it indeed uses up memory.
Best Regards,
Lucas Rolff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210516/6c6a7a52/attachment.htm>
More information about the nginx
mailing list