# Proxy\_cache\_path question

**URL:** <https://www.ruby-forum.com/t/proxy-cache-path-question/187797>\
**Category:** NGINX\
**Created:** [April 29, 2010, 11:25am UTC](https://www.ruby-forum.com/t/proxy-cache-path-question/187797 "2010-04-29T11:25:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marlon\_de\_Boer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Marlon\_de\_Boer](https://www.ruby-forum.com/u/Marlon_de_Boer)\
**Post date:** [April 29, 2010, 11:25am UTC](https://www.ruby-forum.com/t/proxy-cache-path-question/187797/1 "2010-04-29T11:25:27Z")

</div>

Hi list,

I’m trying to limit the amount of data nginx caches but can’t get it to  
work properly.

I’m using the following line to limit the cache:

proxy\_cache\_path /var/tmp/nginx/cache levels=1:2 keys\_zone=cache:32m  
inactive=1440 max\_size=32m;

Is my assumption correct that this cache cannot grow any bigger than  
32Mb? What I see in my case is /var/tmp/nginx/cache grows well above  
32Mb (in my test I’ve seen 46Mb).

Does anybody has a suggestion to get the cache limit to work?

Regards,

Marlon

---

<div class="post-metadata">

**Author:** ![Marlon\_de\_Boer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Marlon\_de\_Boer](https://www.ruby-forum.com/u/Marlon_de_Boer)\
**Post date:** [April 29, 2010, 1:55pm UTC](https://www.ruby-forum.com/t/proxy-cache-path-question/187797/2 "2010-04-29T13:55:18Z")

</div>

On Thu, Apr 29, 2010 at 11:24:51AM +0200, Marlon de Boer wrote:

> Is my assumption correct that this cache cannot grow any bigger than  
> 32Mb? What I see in my case is /var/tmp/nginx/cache grows well above  
> 32Mb (in my test I’ve seen 46Mb).
> 
> Does anybody has a suggestion to get the cache limit to work?

It may be bigger at least for two reasons:

1. nginx counts only file size rounded to file system block size.  
For example, on UFS it’s fragment size.  
As I understand, “du” counts in 1K blocks.
2. levels=1:2 means that nginx will create at least 8M directory  
hierarchy.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
