[infinispan-dev] KeyAffinityService

Mircea Markus mmarkus at redhat.com
Fri Jun 14 13:21:42 EDT 2013


Sent from my iPhone

On 14 Jun 2013, at 13:43, cotton-ben <ben.cotton at ALUMNI.RUTGERS.EDU> wrote:

> Thanks for this reply, Mircea.
> 
> Very interesting approach.  By dispatching a distributed executor back to
> the node (node 0) that produced the pinned key affinity for the object's
> natural key, we could indeed do an iterative search (from node 2) to find
> the original 'myObject' in the pinned cache (on node 0).  As you point out,
> however, this approach is prohibitively costly -- we are effectively doing
> an iterative search across nodes.
> 
> Again, we see the best approach as being to use the enhancement to the Key
> Affinity Service API suggested in https://issues.jboss.org/browse/ISPN-3112.  
My solution only makes sense if the vast majority of requests are processed by the node that is aware of the key. Another thing you can do is have a replicated Cache holding the mapping between the actual keys and the affinity keys. Whenever you need to lookup an obj based on the actual key, you'd do a lookup in this cache(local) and then use this key for getting the object you're after. This cache shoul be pretty small as well.

> Once 
> 
> *K getKeyForAddress(Address pinnedNodeAddress, K objectNaturalKey);*
> 
> is provided, we will be able to proceed as simply as follows:
> 
> //given that all nodes "know" that all birthday Entry(s) are pinned to Node
> 0
> 
> @t=0, from node=0, pin Entry to cache at Node 0
> 
>      Object pinnedKey = getKeyForAddress(getAddress("Node0"),
> "1962-08-10");
>      cache.put(pinnedKey,"Ben D. Cotton III birthday");
> 
> 
> Later @t=1, from node =2, we can use the improved API (suggested in the
> JIRA) from a 'foreign' node without any need to do a distributed, iterative
> search, i.e.
> 
>      Object pinnedKey = getKeyForAddress(getAddress("Node0"),
> "1962-08-10");
>      Object birthdayCelebrant = cache.get(pinnedKey);  //return "Ben D.
> Cotton III birthday"
> 
> 
> Of course, for us to be able to do this, the ISPN team would have to deliver
> to us the API recommended in the JIRA 
> https://issues.jboss.org/browse/ISPN-3112.  Don't you agree such an API
> enhancement would be an awesome capability improvement for ISPN users
> wishing to operate in a distributed fashion on pinned Caches? :-)
I understand your requirements and also the usefulness of such a service :-)
I don't think it is possible to implement this without a severe limitation: if the topology changes between the moment the key was created and the moment the method is invoked, it would return an incorrect value(i'm not even sure that this woul work but i have an idea at least). Whilst this might be enough for your application, it's not sure it is a general purpose functionality for a fwk. 
> 
> As always, thanks to you and this forum for its fine support,
> Ben
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://infinispan-developer-list.980875.n3.nabble.com/KeyAffinityService-nice-2-recommendations-tp4027152p4027401.html
> Sent from the Infinispan Developer List mailing list archive at Nabble.com.
> _______________________________________________
> 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