proxy_cache max-size and range request

leki75 nginx-forum at nginx.us
Thu Sep 24 18:26:11 MSD 2009


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;
        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: http://forum.nginx.org/read.php?2,8958,8958#msg-8958






More information about the nginx mailing list