3

We want to use Infinispan as a compute grid. We found the documentation on the Distributed Execution Framework in Infinispan 5.0.

What we want to do is to dedicate some nodes of the cache as dedicated nodes for executing particular tasks, since only these nodes have the necessary hardware.

My idea was to create a distributed cache mapping HardwareDriverKey to HardwareDriver, and execute the task using DistributedExecutorService.submit(task, hardwareDriverKey). For this to work, we need to figure out a way to ensure that the hardwareDriverKey is always located on the particular node of the distributed cache containing the actual hardware.

Do we need to write a custom ConsistentHash that can extract the node address from the hardwareDriverKey? Have you got an example for this? Or is there another way?

Thanks in advance, Geert.

GeertPt
  • 16,398
  • 2
  • 37
  • 61

2 Answers2

2

That basically forces the groups of objects to stay on the same node, but you can't control which node it is. In order to force location to a specific address you can use the KeyAffinityService. Be aware though that objects might be moved around if the topology changes.

  • Thanks, that's exactly what I was looking for. About the topology changes: when can an entry with a key generated by the KeyAffinityService be moved? Only when its own node stops or starts? – GeertPt Jan 13 '12 at 23:04
  • no, it is possible for it to be moved whenever any node joins/leaves. Generally speaking, when a node joins a cluster of N members, 1/N keys will me shifted to the new joiner. Similar for leaves. – mircea.markus Jan 27 '12 at 16:26
1

The grouping API is there to solve this problem. You can read more about it here.

  • Hi Markus, thanks for pointing to the Group API. But that just defers the hashing to the Group object. I still don't see how you can bind the group to one particular node's address? – GeertPt Jan 12 '12 at 19:48