Welcome! Log In Create A New Profile

Advanced

Re: IP Upstream Hash

August 04, 2011 07:12AM
On Thu, Aug 04, 2011 at 09:47:46AM +0800, chateau Xiao wrote:
> do you mean, in the next version, murmur2 hash function will be used in
> nginx?

Yes.

> and do you show the benchmark between the orignial algorithm and the new
> one?

On tens bytes the difference will be negligible and I believe you
actually can not even test it in a real world because benchmark
itself overhead is more than testee. Note, that million of loops are
not real world test.

> On Thu, Jul 21, 2011 at 5:43 PM, Igor Sysoev <igor@sysoev.ru> wrote:
>
> > On Wed, Jul 20, 2011 at 02:18:52PM -0700, Matthieu Tourne wrote:
> > > Hi all,
> > >
> > > I was looking at the code in ngx_http_upstream_ip_hash_module.c
> > > And I'm not sure where the hashing algorithm for IPs is coming from,
> > > especially those lines :
> > >
> > > iphp->hash = 89;
> > >
> > > hash = (hash * 113 + iphp->addr[i]) % 6271;
> > >
> > > Just wondering if those constants are arbitrary chosen, or if there is
> > > something there to guarantee a good distribution ?
> > >
> > > If you have some links explaining this algorithm, it would be greatly
> > > appreciated!
> > > Also, how would you get a good distribution on IPv6. Maybe it would make
> > > sense to use murmur ?
> >
> > This algorithm came from FastMail.fm. Murmur2 may be better, I'm going
> > to use it in upcoming upstream hash module which allows to hash any
> > expression.


--
Igor Sysoev

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

IP Upstream Hash

Matthieu Tourne 2952 July 20, 2011 05:20PM

Re: IP Upstream Hash

chateau Xiao 999 July 20, 2011 11:14PM

Re: IP Upstream Hash

Igor Sysoev 1699 July 21, 2011 05:44AM

Re: IP Upstream Hash

chateau Xiao 941 August 03, 2011 09:48PM

Re: IP Upstream Hash

Oscar Fernandez 931 August 04, 2011 03:10AM

Re: IP Upstream Hash

Igor Sysoev 1338 August 04, 2011 07:12AM



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

Online Users

Guests: 304
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