Nginx: 'no memory in cache keys zone', despite plenty of space
Solution 1:
You need to increase the size of shared memory on keys_zone
instead of max_size
.
Stealing answer from this thread
keys_zone=api-data-cache:8m was defining shared memory zone named
api-data-cache
with maximum size 8 MB. It holds all active keys and metadata of the cache. So, whenever nginx checks if a page was cached, it consults the shared memory zone first, then seek the location of actual cache in/usr/local/cache/nginx
if cache exist.
From the official documentation, it says one megabyte zone can store about 8 thousand keys. So, depending on your application you need to increase it as needed.