Map_hash_bucket_size, map_hash_max_size, and memory usage

I was hoping someone could clarify how exactly map_hash_bucket_size and
map_hash_max_size should be set and the impact it has on memory.

For map_hash_bucket_size, it says it should be a multiple of the
processor’s
line cache size. Under what circumstances does it make sense or would it
be
necessary to move away from the default cache size?

For map_hash_max_size, is this just the maximum size of the hash? If so,
what is the metric: bytes? potential options? something else? Is it
viewed
as the maximum size of all maps or just each specific map directive?

Also, do either of these values impact the memory that nginx uses? For
example, if I have 200 maps will ones with a higher map_hash_bucket_size
use
more memory than one with a lower map_hash_bucket_size? Or a higher
map_hash_max_size?

Thanks!

Posted at Nginx Forum:

Hello!

On Tue, Nov 04, 2014 at 12:27:51PM -0500, abstein2 wrote:

Also, do either of these values impact the memory that nginx uses? For
example, if I have 200 maps will ones with a higher map_hash_bucket_size use
more memory than one with a lower map_hash_bucket_size? Or a higher
map_hash_max_size?

Some details about configuring of hashes can be found here:

http://nginx.org/en/docs/hash.html


Maxim D.
http://nginx.org/

Thanks Maxim – that’s actually the page that has led me to ask these
questions.

Since the content of that page is a bit general, I was hoping to get
some
more specific detail about how all the pieces are connected so that I
could
optimize my NGINX hash map setup as much as possible.

Thanks for any additional information you can provide!

Posted at Nginx Forum: