Chapter 28. High Availability Using Server Hinting
siteIdin the transport configuration will trigger the use of
TopologyAwareConsistentHashFactory, which is the equivalent of the
DefaultConsistentHashFactorywith Server Hinting enabled.
DefaultConsistentHashFactory- keeps segments balanced evenly across all the nodes, however the key mapping is not guaranteed to be same across caches,as this depends on the history of each cache. If no consistentHashFactory is specified this is the class that will be used.
SyncConsistentHashFactory- guarantees that the key mapping is the same for each cache, provided the current membership is the same. This has a drawback in that a node joining the cache can cause the existing nodes to also exchange segments, resulting in either additional state transfer traffic, the distribution of the data becoming less even, or both.
TopologyAwareConsistentHashFactory- equivalent of
DefaultConsistentHashFactory, but automatically selected when the configuration includes server hinting.
TopologyAwareSyncConsistentHashFactory- equivalent of
SyncConsistentHashFactory, but automatically selected when the configuration includes server hinting.
siteIdattributes are specified in the transport configuration it also spreads backup copies across physical machines/racks/data centers.
TopologyAwareSyncConsistentHashFactoryboth tend to reduce overhead in clustered environments, as neither of these calculate the hash based on the order that nodes have joined the cluster. In addition, both of these classes are typically faster than the default algorithms as both of these classes allow larger differences in the number of segments allocated to each node.
28.1.1. Implementing a ConsistentHashFactory
ConsistentHashFactorymust implement the
org.infinispan.distribution.ch.ConsistenHashFactoryinterface with the following methods (all of which return an implementation of
Example 28.1. ConsistentHashFactory Methods
create(Hash hashFunction, int numOwners, int numSegments, List<Address> members,Map<Address, Float> capacityFactors) updateMembers(ConsistentHash baseCH, List<Address> newMembers, Map<Address, Float> capacityFactors) rebalance(ConsistentHash baseCH) union(ConsistentHash ch1, ConsistentHash ch2)