Meaning of server_names_hash_bucket_size

Igor Sysoev is at
Thu May 17 00:57:59 MSD 2007

On Mon, May 14, 2007 at 10:09:56PM -0700, Liang Jin wrote:

> So, my understanding now is that _hash_max_size will control the
> number of virtual host entries, while _hash_bucket_size will control
> the maximum length of single entries, right?

Also there may be several entries inside one bucket if they fill.

> If I have a lot of virtual host entries, i should increase
> _hash_max_size, while I should increase _hash_bucket_size if some
> domain names are too long.


> Anyway, thanks again for the answer.
> -Liang
> On 5/14/07, Igor Sysoev <is at> wrote:
> >On Mon, May 14, 2007 at 12:31:51AM -0700, Liang Jin wrote:
> >
> >> I have seen the following error in nginx log on my server:
> >>
> >> could not build the server_names_hash, you should increase
> >> server_names_hash_bucket_size: 32
> >>
> >> The problem was solved after I changed the setting to 128.
> >>
> >> However, I am curious to know what the setting will actually do. If I
> >> have many virtual hosts, I will need a larger number for the bucket
> >> size, but how can I determine what would be a good number to set this
> >> parameter?
> >
> >The hashes have two parameters: ..._hash_bucket_size and ..._hash_max_size.
> >First you should increase hash_max_size. But if single entry can not fill
> >inside bucket, then nginx says that you should increase 
> >..._hash_bucket_size.
> >In this case try 64 and 96 before 128. the single entry may not fill inside
> >server name bucket if you have at least one long server name (in your case
> >there is name more than 27 characters).

Igor Sysoev

More information about the nginx mailing list