ngx_slab_alloc() failed: no memory in cache keys zone "zone-xyz"

Maxim Dounin mdounin at
Thu Apr 3 11:34:11 UTC 2014


On Wed, Apr 02, 2014 at 07:41:13PM -0400, jakubp wrote:

> > What currently can be used for such a use case is "inactive=" 
> > parameter of the proxy_cache_path directive (see 
> >  It ensures that items not 
> > recently requested are removed from the cache, including ones 
> > created with proxy_cache_min_uses.  Have you tried tuning it?
> Hi Maxim
> Thank you for your response.
> Yes, that is what I do - try to keep balance between inactive time (which I
> obviously want to keep as high as possible) and the keys zone size. But this

In most cases, it doesn't make sense to keep inactive time high.  
If something isn't requested often enough, it may be better to 
remove it from cache.

> is constant/never-ending effort if the traffic pattern is changing (and it
> unfortunately is for me...). It would be great if nginx used keys size as an
> additional trigger to forced_expire resources - to auto-adjust the removal
> aggression when the traffic profile changes.

It does so - if an allocation of a cache node fails, this will 
trigger a forced expiration of a cache node, and then tries to 
allocate a node again.  This is more an emergency mechanism 
though (and not guaranteed to work, as another allocation may 
fail, too), hence alerts are logged in such cases.

Recently, it was made possible to avoid slab allocation failures 
logging, and this is now used by SSL session cache code, as well 
as limit_req module[1].  This mechanism may be used by proxy_cache 
to avoid logging, too, yet I'm not yet convinced it actually 


Maxim Dounin

More information about the nginx mailing list