proxy_cache max-size and range request
Igor Sysoev
is at rambler-co.ru
Thu Sep 24 18:53:55 MSD 2009
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.
> 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;
> 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?
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.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list