#StackBounty: #nginx Nginx `keys_zone` size, persistence and maximum number of files

Bounty: 50

I’m trying to understand nginx caching better, specifically functionality relating to the keys_zone setting.

The documentation says the following:

Note that the size defined by the keys_zone parameter does not limit the total amount of cached response data. Cached responses themselves are stored with a copy of the metadata in specific files on the filesystem.

Is the number of cached files is limited by the size set in the keys_zone setting? (a one megabyte keys_zone means no more than 8,000 files can be cached?)

I’d also like to understand how the cache is affected by restarting the nginx process. Is the keys_zone data persisted, or does it not need to be persisted (since the relevant information is also stored in the file stored in the cache)?

Does restarting the nginx process effectively clear the cache? (It doesn’t seem like it does but I’d like confirmation)

Is the size specified in the keys_zone setting a size for an in-memory cache of the metadata associated with each cached file (where cache misses are read from the relevant file), or is it an authoritative list of which files are in the cache and which are not?

Any information to help understand the effect of this setting better is appreciated, thanks.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.