Cache calculating erroneous size
giovani.rinaldi at azion.com
Tue Jul 5 19:44:07 UTC 2016
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:
- reported by cache manager: 76009.340M disk space used, 19458391 disk
blocks (4K) used, 2583292 unique files in cache.
- 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).
So, in resume, Nginx is counting files correctly, but not their
sizes/blocks used (it is my understanding that it count blocks, not bytes).
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.
Here's the configuration of my proxy cache:
proxy_cache_path /xfs/http levels=1:2 keys_zone=smallfiles:800m
> max_size=100g inactive=90d;
First I thought this could be related to allocsize in XFS (
https://trac.nginx.org/nginx/ticket/157), but the problem persists even
when utilizing 4K instead of the default (64K).
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.
Restarting Nginx (or upgrading it) solves temporarily the problem, as the
cache loader correctly calculates the total cache size.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx