Adding isp dev in the reply.
On 3 Jun 2010, at 00:06, Romain Manni-Bucau wrote:
Hi,
I would like to use infinispan (for data griding) with gridgain (for grid computing). My
problem is to use the same "key" to run job where datas are located.
I read your article about affinity but i don't understand 2 things :
how to use it when infinispan is configured with hibernate as L2 cache ?
Galder
might help on this - what we need to know is how do we get a reference to the cache used
as L2 in Hibernate.
how to use it correctly : a) i create a key K (generated) to be sure
to keep my date on a node, b) if i do : put(K, value), i have to keep a map with my own
key (understandable) to use generated key so i have a second "cache"
Your
scenario is a bit out of the scope of KeyAffinityService and will be implemented with
https://jira.jboss.org/browse/ISPN-359
An example use case for KAS is for web sessions: when you create a session id (you
don't have to enforce a certain value on the session) you do want to create it so that
it maps (distribution wise) on the local node. This way next calls from client (which uses
session affinity) are local (at least as long as the cluster doesn't change its
topology, but are optimists :) ).
Now returning to your example, you can use an replicated cache for keeping the mapping
(myMap in your example). This would have the drawback of one additional remote call at
creation time - but all subsequent gets will be local, so if the read/write ratio is high
(many reads on the same key) this will pay off.
More, please be aware that a topology change will cause the existing collocated objects to
be redistributed across nodes - even if you resurrect a failed node still applies.
HTH,
Mircea
ex :
K = service.getKeyForAddress(...);
myMap.put("myHumanKey", K);
cache.put(K, value);
readValue = cache.get(myMap.get("myHumanKey"));
BUT
i have to put myMap in the cache to be able to read it on all nodes ...
So as you can see i don't understand something so if you can help me. I can go on irc
i you prefer, give me an hour (i'm in france).
Regards,
Romain Manni-Bucau