1 Reply Latest reply on Dec 7, 2012 9:36 AM by mircea.markus

    Netty with infinispan - synchronous vs asynchronous

    tomas.tunkl

      Hi,

       

      I would like to use infinispan cache as session store. At first I am going to have max 5 nodes across the world, but when user connects to one node he will most likely stay there. But It can happen that he can switch to another. So ideal solution would be to have one replica of data on node where user communicates, but other nodes know that such key exists and where to find data. I understand that distribution mode is ideal for this with benefit that data can be backed up by another node. I have a question about this:

       

      • I am not sure about the consistent hash. Does it mean that data are going to stay local and also they are going to be replicated to num_copies of nodes?

       

      Now about the implementation of retrieve from cache. I am using netty framework and I need to be able to decided whether retrieve of value is going to take some time, or whether value is placed in local memory. Because I have to decide whether I need to run retrieve and the whole logic in separate thread or in worker thread, but this thread cannot be blocked by loading. I was trying to find method which could tell me such thing but I havent found anything. For example ehCache has method isElementInMemory which I can use to decide. Also method to get information if value exists at all which would be cheep to use would be nice.

       

      Thank you for your help.

        • 1. Re: Netty with infinispan - synchronous vs asynchronous
          mircea.markus

          I would like to use infinispan cache as session store. At first I am going to have max 5 nodes across the world, but when user connects to one node he will most likely stay there

          If you're thinking about a geographically distributed cluster, starting with 5.2 we've added functionality to handle this exact scenario: https://docs.jboss.org/author/display/ISPN/Cross+site+replication

           

          I am not sure about the consistent hash. Does it mean that data are going to stay local and also they are going to be replicated to num_copies of nodes?

          You don't have the guarantee that the key will stay local, but that it will stay on some node and that there will be (numOwner-1) copies of the data on some other nodes. If you want to enforce the data to stay on the local node, you might want to consider the KeyAffinityService: https://docs.jboss.org/author/display/ISPN/Key+affinity+service

          Also method to get information if value exists at all which would be cheep to use would be nice.

          cache.getAdvancedCache().getDataContainer().contains(key);