Use primes for hashtable size

Mathew Heard mat999 at gmail.com
Fri Jun 2 00:56:31 UTC 2017


If this actually yields a decrease in start time while not introducing
other effects we would use it. Our start time of a couple minutes is
annoying at times.

On Fri, Jun 2, 2017 at 3:57 AM, Andrew Borodin <borodin at octonica.com> wrote:

> 2017-06-01 22:39 GMT+05:00 Maxim Dounin <mdounin at mdounin.ru>:
> > Thanks, though suggested change will certainly modify current
> > nginx (documented) approach of searching for minimum possible
> > hash sizes.
> >
> > It might be a better solution for large hashes though, as
> > currently optimized by using a larger start size:
> >
> >     if (hinit->max_size > 10000 && nelts && hinit->max_size / nelts <
> 100) {
> >         start = hinit->max_size - 1000;
> >     }
>
> Yeah, maybe put the primes loop under if.
>
> > Not sure it is at all needed though, as I don't remember any
> > "words about startup speed" in the documentation and startup
> > speed of hashes wasn't a practical problem as far as I remember.
>
>
> Here  https://nginx.ru/en/docs/http/server_names.html
> "if nginx’s start time is unacceptably long, try to increase
> server_names_hash_bucket_size" It's about allowing more hash
> collisions.
> But I do not insist, though :) I've done the patch jut for fun
>
> Best regards, Andrey Borodin, Octonica.
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170602/7baaaa51/attachment.html>


More information about the nginx-devel mailing list