Cache Volume utilized at around 50 % with proxy_cache_min_uses

Maxim Dounin mdounin at mdounin.ru
Tue Aug 25 16:50:00 UTC 2020


Hello!

On Tue, Aug 25, 2020 at 07:41:43AM -0400, anish10dec wrote:

> With use of proxy_cache_min_uses volume of cache is getting settled up at
> around 50% utilization. 
> No matter what is the volume allocated in max_size its not filling up
> further beyond 50%.
> If the proxy_cache_min_uses is removed the cache gets filled up with
> max_size allocated volume.
> 
> No of files in cache directory is far less beyond the size allocated in key
> zone. Its getting capped up near 20 Lakhs whereas allocated key zone could
> have accommodate around 80 L files with below configuration  

It is important to understand that number of files in the cache 
directory is not directly related to the keys zone size when using 
proxy_cache_min_uses.  Instead, when using proxy_cache_min_uses, 
keys zone needs to keep information about all resources requested, 
to correctly trac usage numbers, and this usually much higher than 
the number of files saved to disk.  This is what 
proxy_cache_min_uses does: it saves disk space and disk bandwidth 
by tracking information only in the keys zone.

Given the above, I see two possible reasons why the cache volume 
is only filled at 50%:

1. You've run out of keys_zone size.

2. You've run out of resources requested frequent enough to be 
cached with proxy_cache_min_uses set to 2.

It should be easy enough to find out what happens in your case.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list