6 Replies Latest reply on May 27, 2011 11:25 AM by Galder Zamarreño

    Clustering use-case questions.

    Gurvinderpal Narula Newbie

      Hello all,


      I'm trying to determine if Infinispan is suitable for the following use case :



      I need to share about 20-25 relatively static objects between 3 instances of a web application running in tomcat. the size of each object is going to be about 10 mb in size. The value of any one of the objects' is not expected to change more than once or twice a day (if that). However, once it changes on any one instance of the application (the application itself will modify it), the other instances should immediately get the updated as well (the object values cannot be out of sync for more than a second or so).


      I'm hoping that I can implement the use case above fairly easily using infinispan's clustering capabilties. I can understand that it's an overkill, but I believe that the requirements will grow and that having a decent data grid already in production by that time will help meet growing needs. Based on that assumption, I started testing Infinispan's CacheManager is a clustering configuration using a simple JVM based example following this article:




      The code I'm using is as simple executing the following code in 'main' method of my java application :


      static EmbeddedCacheManager cacheManager = null;


          public static void main(String[] args) throws IOException {


              System.out.print("Initialzing shared session......");

              cacheManager = new DefaultCacheManager("cfg.xml");

              Cache defaultCache = cacheManager.getCache();


      Where cfg.xml constains the following XML (shamless copied verbatim from the article above):




          <!-- not specifying details here will force default transport -->

          <transport />



          <clustering mode="replication" />




      Now, when I start up my java applications, I get different behavior based on which instance is started. If I start the two instances one after the other, the cache that I created seems to share properly. However, if I stop one of the JVMs and restart the applications, it does not see to 'join' the cluster. The new application starts it's own instance of the cache. So when I try to iterate over the objects that were in the clustered cache using 'keyset()', I don't get any iterator. Also if I try to reterive a value, I don't get anything back either. (however the same operations work just fine on the application instance that was not restarted). Also, if I add new values to the cache on the instance that's restarted, it is not visibile on the instance that was not restarted.


      Can someone please guide me on what I could be missing here. I'm under a little pressure to decide between Infinispan and Terracota. I've heard some real horror stores with Terracota and don't want to avoid that path if I can.


      Thanks in advance,