5 Replies Latest reply on Jul 12, 2012 10:20 AM by mgencur

    Infinispan Cache Updates + State Transfer Not Happening !

    bramalingam81

      Hi..

       

      Let me brief the scenario with an example.

       

      Class ValueBean{

      private Object valueObject;

       

      ...

       

      }

       

      class GlobalSession {

       

      private String attr1;

      private String attr2;

      private String attr3;

       

      GlobalSession(String attr1)

      {

      this.attr1 = attr1l

      }

      ...

      ...

       

      }

      GlobalSession gs = new GlobalSession("attr1")

      ValueBean bean = new ValueBean(gs);

       

      I have added an object ValueBean to cache using put operation using a key - globalsessionk1 --> During the put, I have configured an Externalizer, which serializes the object to other nodes in the cluster. I have setup a cluster of 3 machines.

       

      After the object is added to cache, I changed the GlobalSession object as follows :

      gs.setAttr2("attr2"); --> Changing the state of object that is already in cache !

       

      Now, I retrieved the object from cache using get operation for key globalsessionk1 and found that object's state was updated. However,  I see that stateTransfer did not happen for this change is state of object. So, this updated state of object was available only in the node, where it got updated and NOT available to other 2 nodes in the cluster.

       

       

      Please let me know If I am missing something !

       

       

      Thanks

      Balaji

       

      Added infinispan configuration file.

        • 1. Re: Infinispan Cache Updates + State Transfer Not Happening !
          mgencur

          Hmm, based on your description, I would say that Infinispan does not know about your change and this is IMO expected. If you would like to replicate the changes, you would have to use cache.replace() and pass the new changed object. When you just update the object like you did, it's just changed on the local heap but Ispn does not now that it should replicate it. That's my opinion, maybe others can argue.

          • 2. Re: Infinispan Cache Updates + State Transfer Not Happening !
            bramalingam81

            Thanks Martin. I just wanted to confirm this behavior, so that I can be sure that I have not missed out any feature of Infinispan in accomplishing the same. Is this feature eligible to be a road-map item for Infinispan ?  Bcoz, I see this as a very much required feature in any distributred deployments. Please let me know your thoughts on the same.

            • 3. Re: Infinispan Cache Updates + State Transfer Not Happening !
              mgencur

              Hi Balaji,

              I don't know if this is doable at all. Tracking changes in Java objects would be perhaps very resource and time consuming task. This would be a nice feature but do you think there are cases when the application cannot call cache.replace() which does this job?

              • 4. Re: Infinispan Cache Updates + State Transfer Not Happening !
                bramalingam81

                Hi Martin,

                 

                We have solved this by maintaining a list for each request that stores each of the accessed keys. We have safely assumed that all those keys that are accessed using get are modified. So, at the end of request, we are replacing the keys with the latest value available in that local heap. When a replace is invoked, the Externalizer associated with the object replicates this changes to the other nodes of the cluster.

                 

                Just a thought : Is there a way that Infinispan can maintain a Shared Memory across nodes in a cluster ? Not sure if this is feasible !

                 

                Thanks !

                • 5. Re: Infinispan Cache Updates + State Transfer Not Happening !
                  mgencur

                  I'm glad you got it to work

                  What do you mean by Shared Memory? What is the exact use case you want to address with that? Maybe start a different thread ;-)