<div dir="ltr"><div><div>Hello,<br><br></div>I've been experiencing a rather strange
situation regarding the cache size occupation (calculated by nginx's
cache manager and reported in debug logs) versus the real occupied size
as reported by `df`. Just exemplifying:<br><br></div><div>- reported by cache manager: 76009.340M disk space used, 19458391 disk blocks (4K) used, 2583292 unique files in cache.<br></div><div>-
reported by df: 64203.512M of disk space used, 16436099 disk blocks
(4K) used, 2583861 unique files in cache (this number is an
approximation, due to find command taking more time to return).<br><br></div><div>So,
in resume, Nginx is counting files correctly, but not their
sizes/blocks used (it is my understanding that it count blocks, not
bytes).<br><br></div><div>As a consequence, when the calculated cache
size reaches the max_size defined in proxy_cache_path, forced evictions
start occurring. I must point out that these evictions are due to
max_size reached and not inactive time (I differentiate both of these
cases in debug log messages) or file count watermark (related to keyzone
capacity) being reached.<br><br></div><div>Here's the configuration of my proxy cache:<br></div><div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">proxy_cache_path /xfs/http levels=1:2 keys_zone=smallfiles:800m max_size=100g inactive=90d;<br></blockquote><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">proxy_temp_path /tmp;<br></blockquote> <br></div><div>First I thought this could be related to allocsize in XFS (<a href="https://trac.nginx.org/nginx/ticket/157" target="_blank">https://trac.nginx.org/nginx/ticket/157</a>), but the problem persists even when utilizing 4K instead of the default (64K).<br><br></div><div>Also
I must point out that there's another cache zone being utilized (also
with XFS but in another disk) by the same nginx servers, though it is
utilized for caching larger files (more than 1Mb in size in average),
and it does not suffer from this cache size discrepancy.<br></div><br></div>Restarting
Nginx (or upgrading it) solves temporarily the problem, as the cache
loader correctly calculates the total cache size.<br><br><br clear="all">Thanks,<br><br>--<br><span style="font-family:arial,helvetica,sans-serif">Giovani Rinaldi</span></div>