-
1. Re: Can I determine jboss server instance against cache key value
rvansa Feb 4, 2015 3:37 AM (in response to ptarnows)In embedded mode, see Distributed Executors http://infinispan.org/docs/7.0.x/user_guide/user_guide.html#_distributed_execution_framework
In client-server mode not yet, but it's planned.
-
2. Re: Can I determine jboss server instance against cache key value
ptarnows Feb 4, 2015 10:56 AM (in response to rvansa)It is not exactly what I want. Lets imagine for a while I have kind of router before my jboss eap farm. I know that one of the server have particular entity in its cache, becouse it previulsy handle similar request.
So if I could only trough the key of the entity determinate on which of jboss node it was processed... i could route the next request there.
Your answer is about sending a task to that node in limited to emebeded case. And even if I implement this DistributedCallable the response of it would be serialized which I want to avoid.
I need to know the algorithm responsible for choosing infinispan node (jboss eap node) against cache key.
Infinispan does it just when puting a value, geting value or invoking this callable stuf.
The real question how can I get IP:PORT of the node?
-
3. Re: Can I determine jboss server instance against cache key value
nadirx Feb 4, 2015 11:34 AM (in response to ptarnows)- Unless you're using the same interface, the clustering and web subsystems might be using different addresses. Assuming you're using a servlet, you can retrieve the "web" address using the servlet request port. You could then match that with the address returned by the CacheManager.
- The fact that one node has created an entry in a distributed cache does not mean it will be the owner of that key. You need to use the KeyAffinityService for this.
-
4. Re: Can I determine jboss server instance against cache key value
ptarnows Feb 5, 2015 11:32 AM (in response to nadirx)Maybe I don't uderstand something.
- Tanks to CacheManager I can match server address against embeded infinispan node address. That is something but I still don't know on which node become an owner of particular key.
- KeyAffinityService doesn't help me either, yes, of course thanks to that I can point on which node i.e. local I want to put my values but... stils I cannot determinate where the key was previously put.
The best thnig I can think of is binding all these stuff together with some database support which keeps mapping key --> node_address....
But each function of infinispan API have to use some alorithm to define list owners for a key, so this mapping is already there I think.
My dream is method like: List<Address> CacheContainer.getOwnersForKey(key) or Address CacheContainer.getRandomlySelectedOwnerForKey(key).
Maybe I'm not pricise. Let take a look at some use case:
REQUEST_1 (KEY) --> ROUTER? --> WEB_SERVER_X --> SOME_OBJECT --> INFINISPAN_NODE_Z
REQUEST_2 (KEY) --> ROUTER? --> ??? how can I discover addres of INFINISPAN_NODE_Z the owner of <KEY,SOME_OBJECT> entry?Can I achieve this using inifinispan API?
-
5. Re: Can I determine jboss server instance against cache key value
nadirx Feb 5, 2015 11:38 AM (in response to ptarnows)DistributionManager distributionManager = cache.getAdvancedCache().getDistributionManager();
Address address = distributionManager.getPrimaryLocation(key);