[infinispan-dev] Hash calculation in DefaultConsistentHash

Alex Kluge java_kluge at yahoo.com
Fri Sep 18 11:20:56 EDT 2009


>   Any chance of sharing this work with the rest of Infinispan community 
>  at some point?

  My apologies, The embedded link in the original message did not
 propagate through the mailing list. The doc is at
    http://www.vizitsolutions.com/ConsistentHashingCaching.html.

  There an an implementation of an AddressHash at the bottom, which should
 be very close in functionality to the current DefaultConsistentHash. If
 it looks correct it can be used directly, or I can tweak it if need be.
 The doc will get more interesting when the section on adding a new server
 is finished, as you will need it if you go with the virtual nodes.

                                                     Alex

--- On Wed, 9/16/09, Galder Zamarreno <galder.zamarreno at redhat.com> wrote:

From: Galder Zamarreno <galder.zamarreno at redhat.com>
Subject: Re: [infinispan-dev] Hash calculation in DefaultConsistentHash
To: infinispan-dev at lists.jboss.org
Date: Wednesday, September 16, 2009, 2:57 AM

Hey Alex,

On 09/14/2009 10:05 PM, Alex Kluge wrote:
> Hi,
>
>    I would even make the case that the abs and the remainder operator are unnecessary.  I  have an version of a consistent hash which is similar to this, and made a few modifications so that my code delivers the same functionality as the current infinispan DefaultConsistentHash. The consistent hash is much more natural if you directly use the hash values. I had meant to contribute this code a while back, but I was simply too busy getting the full project of which this is a part to a testable state to make the infinispan modifications to the code.
>
>    These classes are under the examples section in a Consistent hashing and Caching doc I am working on.
>
>     This code also supports virtual nodes, but with the settings in the example do not produce any. The builder is there to facilitate the creation of the hash through an XML parser, while keeping the hash itself immutable. These things can all be tuned or changed for infinispan's specific needs.

Any chance of sharing this work with the rest of Infinispan community at 
some point?

Regards,

>
>                                                      Alex
>
>
> --- On Mon, 9/14/09, Krzysztof Sobolewski<Krzysztof.Sobolewski at atm.com.pl>  wrote:
>
> From: Krzysztof Sobolewski<Krzysztof.Sobolewski at atm.com.pl>
> Subject: [infinispan-dev] Hash calculation in DefaultConsistentHash
> To: "infinispan-dev at lists.jboss.org"<infinispan-dev at lists.jboss.org>
> Date: Monday, September 14, 2009, 4:25 AM
>
> I took a look at the implementation of DefaultConsistentHash and I was
> wondering: does the key hash value have to be positive? As in:
>
>        int hash = Math.abs(key.hashCode());
>
> I can see that the resulting hash is used to pull a tail map of the hash
> space, but there's no reason the SortedMap key has to be positive. I'm
> actually most concerned about the fact that Math.abs(Integer.MIN_VALUE) ==
> Integer.MIN_VALUE so you have at least one negative key anyway :)
> -KS
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

-- 
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache
_______________________________________________
infinispan-dev mailing list
infinispan-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev



      




More information about the infinispan-dev mailing list