Welcome! Log In Create A New Profile


Nginx's hash tables

Thibault Koechlin
April 11, 2011 05:24AM
Hello everyone,

I'm currently working on a module for Nginx, and I use a ngx_hash_t
where the actual keyname is an URI. Even with very few elements,(11) I
got the error message "could not build the xxx hash, you should
increase ...". So, I am looking for some information about nginx's hash
init, to understand what is going wrong.

Hash init structure goes as follow in my case, directly taken from

hash_init.hash = [pointer to a previously allocated hash_t]
hash_init.key = &ngx_hash_key_lc; //Function used to create keys
hash_init.max_size = 1024*10; //(1) This is the thing I don't get
hash_init.bucket_size = 64; //(2) Number of entries in one bucket or
bucket size in bytes ?
hash_init.name = "hash_name";
hash_init.pool = cf->pool; //Pool used for hash's allocations
hash_init.temp_pool = NULL; //(3) ?

My question are about (1) and (2), and how to eval the needed size
properly. The hash_init function receives an array (ngx_array_t) of
ngx_hash_key_t, so the "real" data is already allocated, and the hash
table only contains pointers to the real data. So, what does max_size
(1) exactly corresponds to ? Regarding (2), I'd like to know if it is
really the size of one bucket in bytes ?


nginx-devel mailing list
Subject Author Views Posted

Nginx's hash tables

Thibault Koechlin 2262 April 11, 2011 05:24AM

Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready