# Nginx cache - could not allocate node in cache keys zone

**URL:** <https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248>\
**Category:** NGINX\
**Created:** [March 10, 2016, 6:13pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248 "2016-03-10T18:13:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [March 10, 2016, 6:13pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/1 "2016-03-10T18:13:29Z")

</div>

I have four servers in a pool running nginx with proxy\_cache. One of the  
nodes started spewing “could not allocate node in cache keys zone”  
errors  
for every request (which gave 500 status). I did a restart and it  
started  
working again.

What conditions cause that error in general?

If it happens again is there anything I can do to try and determine the  
root cause?

---

<div class="post-metadata">

**Author:** ![CJ\_Ess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CJ\_Ess](https://www.ruby-forum.com/u/CJ_Ess)\
**Post date:** [March 10, 2016, 8:06pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/2 "2016-03-10T20:06:49Z")

</div>

Same condition on two more of the servers in the same pool. Reload  
doesn’t  
resolve the issue, but restart does. No limit being hit on disk space,  
inodes, open files, or memory.

---

<div class="post-metadata">

**Author:** ![CJ\_Ess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CJ\_Ess](https://www.ruby-forum.com/u/CJ_Ess)\
**Post date:** [March 10, 2016, 8:07pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/3 "2016-03-10T20:07:59Z")

</div>

This is nginx/1.9.0 BTW

---

<div class="post-metadata">

**Author:** ![CJ\_Ess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CJ\_Ess](https://www.ruby-forum.com/u/CJ_Ess)\
**Post date:** [March 10, 2016, 8:39pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/4 "2016-03-10T20:39:32Z")

</div>

At a guess I would say your key zone is full. Try increasing the size of  
it.

---

<div class="post-metadata">

**Author:** ![CJ\_Ess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CJ\_Ess](https://www.ruby-forum.com/u/CJ_Ess)\
**Post date:** [March 10, 2016, 11:07pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/5 "2016-03-10T23:07:19Z")

</div>

One other question - is the key zone shared between the worker  
processes?  
Or will each worker allocate its own copy?

---

<div class="post-metadata">

**Author:** ![CJ\_Ess](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CJ\_Ess](https://www.ruby-forum.com/u/CJ_Ess)\
**Post date:** [March 10, 2016, 10:19pm UTC](https://www.ruby-forum.com/t/nginx-cache-could-not-allocate-node-in-cache-keys-zone/244248/6 "2016-03-10T22:19:25Z")

</div>

I will try that now - but shouldn’t it be evicting a key if it can’t fit  
a  
new one?

On Thu, Mar 10, 2016 at 2:38 PM, Richard S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
