proxy_cache_path levels

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

proxy_cache_path levels

vedranf
Hi,

I'm trying to understand how proxy_cache_path  levels works, but any changes I made to levels=1:2 will not be accepted bu nginx.
What are levels for and how can I use it??
Are the values 1:2 the only ones that can be used?

Thanks

N.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,2450,2450#msg-2450


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: proxy_cache_path levels

Igor Sysoev
On Thu, May 28, 2009 at 06:21:01AM -0400, nfn wrote:

> Hi,
>
> I'm trying to understand how proxy_cache_path  levels works, but any changes I made to levels=1:2 will not be accepted bu nginx.
> What are levels for and how can I use it??
> Are the values 1:2 the only ones that can be used?

You may use any combination of 1 and 2 in these formats: X, X:X, and X:X:X,
e.g.: "2", "2:2", "1:1:2".


--
Igor Sysoev
http://sysoev.ru/en/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: proxy_cache_path levels

vedranf
In reply to this post by vedranf
Thanks for you explanation Igor

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,2450,2464#msg-2464


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: proxy_cache_path levels

S.A.N
In reply to this post by vedranf
Results of queries for the same URL using different settings for
proxy_cache_path "levels"

# levels not specified, so all cache files reside in a single directory
proxy_cache_path  /data/nginx/cache;
    /data/nginx/cache/d7b6e5978e3f042f52e875005925e51b

# a lot of config examples use levels=1:2 - this provides 16 x 256 = 4096
directories in 2 levels
proxy_cache_path  /data/nginx/cache levels=1:2;  
    /data/nginx/cache/b/51/d7b6e5978e3f042f52e875005925e51b

# levels=1:1:1 also provides 16^3 = 4096 directories, but in 3 levels
proxy_cache_path  /data/nginx/cache levels=1:1:1;  
    /data/nginx/cache/b/1/5/d7b6e5978e3f042f52e87500592

# levels=2:2:2 provides the maximum possible number of directories 256^3 =
~16 million
proxy_cache_path  /data/nginx/cache levels=2:2:2;  
    /data/nginx/cache/1b/e5/25/d7b6e5978e3f042f52e875005925e51b


# levels=2
proxy_cache_path  /data/nginx/cache levels=2;  
    /data/nginx/cache/1b/d7b6e5978e3f042f52e875005925e51b


levels= instructs Nginx to create subdirectories within proxy_cache_path
You can specify up to 3 colon-separated digits to create up to 3 levels of
subdirectory.
The colon-separated digits can be either "1" or "2" to define if that level
should contain 16 (0-f) or 256 (00-ff) subdirectories.
These directory names are a single- double-place hexidecimal value (0-f or
00-ff).

Cache files reside in directories that correspond to the last few hex values
of the file name.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,2450,273132#msg-273132

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: proxy_cache_path levels

S.A.N
Correction of a minor error in the previous message:

# levels=1:1:1 also provides 16^3 = 4096 directories, but in 3 levels
proxy_cache_path /data/nginx/cache levels=1:1:1;
/data/nginx/cache/b/1/5/d7b6e5978e3f042f52e875005925e51b

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,2450,273133#msg-273133

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...