-
1. Re: JGroupsConsistentHash,etc vs. KeyAffinityService: need tactics,samples
belaban May 8, 2013 12:07 PM (in response to cotton.ben)I'll try to address this in generic terms, for details (e.g. which classes to use etc) contact the Infinispan team.
To distribute set A (more or less) evenly across a cluster, use mode=DIST.
To ping set B to a single node, also use DIST, but set numOwners=1 and plug in your own consistent hashing function which pins all keys to a given node. E.g. if you have view {M,N,O,P}, the consistent hash could pin all keys to the first member of the list, M. This works because every member in a cluster has the same view (unless there's a split).
However, this *will* lead to uneven distribution, so if set B is large, node M will bear more of the work than other nodes.
Also, numOwners=1 is usually only advisable if you can fetch the data from somewhere, e.g. a DB, and use the cluster only as a front-end cache to a DB, for example.
You could fix this by setting numOwners=2, and coming up with a consistent hash function which always pins the first of the 2 return values, e.g. [M->N], [M->O], [M->P], [M->N] etc.
Once key set B is pinned to M, all access (using DIST) on other nodes will be routed to M. Note that you *could* use an L1 cache, which caches locally, but you stated you don't want to do that.
-
2. Re: JGroupsConsistentHash,etc vs. KeyAffinityService: need tactics,samples
cotton.ben May 8, 2013 12:34 PM (in response to belaban)As always, Bela, your responses are amazingly helpful. Thank you -- we will reach out to infinispan-dev team re: Infinispan API specifics to build this solution.