# Proxy\_cache max-size and range request

**URL:** <https://www.ruby-forum.com/t/proxy-cache-max-size-and-range-request/176091>\
**Category:** NGINX\
**Created:** [September 24, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/proxy-cache-max-size-and-range-request/176091 "2009-09-24T16:43:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leki75](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e47c2d/32.png) [@leki75](https://www.ruby-forum.com/u/leki75)\
**Post date:** [September 24, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/proxy-cache-max-size-and-range-request/176091/1 "2009-09-24T16:43:54Z")

</div>

Hi all,

We would like to use nginx (0.8.15) as a proxy/cache for downloading big  
files. Wihtout configuring proxy\_cache we got ‘206 Partial Content’ for  
range requests. With proxy\_cache the first range request (which is not  
in cache) will be a ‘200 OK’ and all subsequent range requests (served  
by cache) are normal ‘206 Partial Content’ responses. Is it possible to  
have all requests (proxied or not) would be ‘206 Partial Content’  
responses?

The wiki documentation says that “Special process cache manager controls  
on-disk cache size, defined by parameter max\_size, and when size exceed  
least used data deleted.” How does this “least used data” selection work  
in reality? We tested with the following config:

1. nginx.conf  
proxy\_cache\_path /nginx-storage/cache levels=1:2 keys\_zone=test:10m  
inactive=1d max\_size=17m;  
server {  
location / {  
proxy\_pass [http://test](http://test);  
proxy\_cache test;  
proxy\_cache\_min\_uses 1;  
proxy\_cache\_valid 1d;  
proxy\_cache\_methods GET HEAD;  
proxy\_cache\_use\_stale error timeout;  
}

2. test files

# ls -lh 4m\_\*.bin

-rw-r–r-- 1 root root 4.0M 2009-09-24 14:29 4m\_1.bin  
-rw-r–r-- 1 root root 4.0M 2009-09-24 14:29 4m\_2.bin  
-rw-r–r-- 1 root root 4.0M 2009-09-24 14:29 4m\_3.bin  
-rw-r–r-- 1 root root 4.0M 2009-09-24 14:29 4m\_4.bin  
-rw-r–r-- 1 root root 4.0M 2009-09-24 14:29 4m\_5.bin

After some test we realized that the oldest object purged and request  
count not matters. Is it the normal behaviour?

Posted at Nginx Forum:

> **[proxy\_cache max-size and range request](https://forum.nginx.org/read.php?2,8958,8958#msg-8958)**
>
> Hi all, We would like to use nginx (0.8.15) as a proxy/cache for downloading big files. Wihtout configuring proxy\_cache we got '206 Partial Content' for range requests. With proxy\_cache the first range request (which is not in cache) will be a '200...

---

<div class="post-metadata">

**Author:** ![leki75](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e47c2d/32.png) [@leki75](https://www.ruby-forum.com/u/leki75)\
**Post date:** [September 24, 2009, 5:04pm UTC](https://www.ruby-forum.com/t/proxy-cache-max-size-and-range-request/176091/2 "2009-09-24T17:04:23Z")

</div>

On Thu, Sep 24, 2009 at 10:26:11AM -0400, leki75 wrote:

> Hi all,
> 
> We would like to use nginx (0.8.15) as a proxy/cache for downloading big files. Wihtout configuring proxy\_cache we got ‘206 Partial Content’ for range requests. With proxy\_cache the first range request (which is not in cache) will be a ‘200 OK’ and all subsequent range requests (served by cache) are normal ‘206 Partial Content’ responses. Is it possible to have all requests (proxied or not) would be ‘206 Partial Content’ responses?

No, nginx needs to get whole response in cache for the first time.

> ```
> proxy_cache_methods GET HEAD;
> 
> ```
> 
> After some test we realized that the oldest object purged and request count not matters. Is it the normal behaviour?

All cached responses are linked into activity queue. Every time when  
a response is requested, it’s moved in the head of the queue. The cache  
manager deletes responses from the tail of the queue.

---

<div class="post-metadata">

**Author:** ![leki75](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e47c2d/32.png) [@leki75](https://www.ruby-forum.com/u/leki75)\
**Post date:** [September 25, 2009, 9:56am UTC](https://www.ruby-forum.com/t/proxy-cache-max-size-and-range-request/176091/3 "2009-09-25T09:56:03Z")

</div>

Dear Igor,

Thanks for your rapid response.

Posted at Nginx Forum:

> **[Re: proxy\_cache max-size and range request](https://forum.nginx.org/read.php?2,8958,9143#msg-9143)**
>
> Hi all, We would like to use nginx (0.8.15) as a proxy/cache for downloading big files. Wihtout configuring proxy\_cache we got '206 Partial Content' for range requests. With proxy\_cache the first range request (which is not in cache) will be a '200...
