Welcome! Log In Create A New Profile

Advanced

Re: Question about key_zone in proxy_cache_path

Maxim Dounin
July 02, 2011 09:40AM
Hello!

On Sat, Jul 02, 2011 at 12:32:15PM +0200, Sven 'Darkman' Michels wrote:

> The wiki (1) states:
> "Zone size should be set proportional to number of pages to cache. The size of the
> metadata for one page (file) depends on the OS; currently it is 64 bytes for
> FreeBSD/i386, and 128 bytes for FreeBSD/amd64."
>
> So for 10.000 files i would need roundabout 1,3meg of key_zone, and for example
> 1mio files would need 122meg, is it that easy?

Yes, except it's not always trivial to calculate number of files
you'll have in cache. Aproach which is expected to work is to set
maximum cache size and use max_size / (average file size) as a
reference point.

Note also that using proxy_cache_min_uses will consume extra keys
in keys_zone for counting uses, even if actual files won't be
cached.

> Another question would be, if i set it to big, will it hurt performance?

It will consume extra memory, and hence may hurt performance.
It's unlikely will be noticeable though, unless you are
memory-bound.

> I already had the key_zone set to small so nginx complained
> about and it looked like it stopped serving new data.

It will try to drop oldest file from cache and continue, though this
may fail as well. So yes, working with full keys_zone isn't good.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Question about key_zone in proxy_cache_path

Sven 'Darkman' Michels July 02, 2011 06:34AM

Re: Question about key_zone in proxy_cache_path

Maxim Dounin July 02, 2011 09:40AM

Re: Question about key_zone in proxy_cache_path

Sven 'Darkman' Michels July 02, 2011 05:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready