5 Replies Latest reply on Oct 18, 2011 6:38 AM by galder.zamarreno

    Consistent Hashing and replication mode

    renzos

      Hi to everyone,

      I set up the replication async mode and I'm stepping the source code when I declare:

      Cache cache = manager.getCache("cacheName");

      At some point it calls the hashing algoritm (Wang/jenkins) and I do not understand why, I'm in replication mode ... I thought the consistent hashing algoritm would be called in distribution mode only, and especially to store keys.

      Maybe someone can explain me that?

      Thanks a lot.

        • 1. Re: Consistent Hashing and replication mode
          galder.zamarreno

          I'm not sure what Infinispan version your using, but in recent Infinispan 5.1, state transfer and rehashing have been merged.

          • 2. Re: Consistent Hashing and replication mode
            renzos

            I'm using 4.2.1 final so it's supposed to be not merged.

            • 3. Re: Consistent Hashing and replication mode
              galder.zamarreno

              Hmmm, dunno tbh then. Maybe if you give more clues we can help you further? i.e. configuration, call stack trace...

              • 4. Re: Consistent Hashing and replication mode
                renzos

                Thanks for your help, I'm just debugging the code stepping it statement by statement (F7 with Netbeans), it's for my thesis, and I'm using the following configuration:

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <infinispan

                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                      xsi:schemaLocation="urn:infinispan:config:4.2 http://www.infinispan.org/schemas/infinispan-config-4.2.xsd"

                      xmlns="urn:infinispan:config:4.2">

                 

                       <global> <!--contains System wide local settings-->

                           <transport clusterName="infinispan-cluster" transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">

                               <properties>

                                   <property name="configurationFile" value="jgroups-udp.xml" />

                               </properties>

                           </transport>

                   </global>

                 

                   <default> <!--refers to configuration which is used by all Infinispan caches-->

                           <deadlockDetection enabled="false"/>

                        <transaction

                            transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"

                            syncRollbackPhase="false"

                            syncCommitPhase="false"

                            useEagerLocking="false"/>

                        <locking isolationLevel="REPEATABLE_READ"

                                 writeSkewCheck="false"

                                 concurrencyLevel="500"

                                 useLockStriping="false"

                                 lockAcquisitionTimeout="1000" />

                        <clustering mode="replication">

                               <sync/>

                              <stateRetrieval fetchInMemoryState="true"/> <!--updates the cache state on the current node (REPLICATION only) -->

                        </clustering>

                   </default>

                </infinispan>

                 

                When I get the cache with the following statement:

                 

                Cache cache = manager.getCache("cacheName");

                 

                I step into the manager.getCache method that calls many other classes and at some point I get the hashing algoritm (Wang/Jenkins), the same you can see here:

                http://www.goworkday.com/2010/03/19/single-word-wangjenkins-hash-concurrenthashmap/

                 

                As I'm in replication mode I'm surprised but maybe it is used for getting the position of the node on the ring.

                 


                • 5. Re: Consistent Hashing and replication mode
                  galder.zamarreno

                  Ah ok, you mean the hash function for a ConcurrentHashMap. That's probably due to the internal data container structure which uses something like data structure similar to a CHM, or maybe due to some internals that use a CHM.

                  1 of 1 people found this helpful