6 Replies Latest reply on May 27, 2011 11:25 AM by galder.zamarreno

    Clustering use-case questions.

    gurvindernarula

      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:

       

           http://community.jboss.org/wiki/SettingUpAnInfinispanCluster

       

      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):

       

      <infinispan>

        <global>

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

          <transport />

        </global>

        <default>

          <clustering mode="replication" />

        </default>

      </infinispan>

       

      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,

      Gurvinder

        • 1. Clustering use-case questions.
          ckulenk

          Did you check the JGroups configuration options?

          http://community.jboss.org/wiki/ClusteredConfigurationQuickStart

          http://community.jboss.org/wiki/SystemProps

          Can you isolate the issue to JGroups?

          • 2. Clustering use-case questions.
            gurvindernarula

            Thanks for your input - Sorry for not getting back earlier. I did go to the above links and tried out a few options. But this started taking up more time that I could devote just to get it working.

             

            So we're not looking at Hazelcast (www.hazelcast.com). Initial tests have proved that it works very well right out of the box (no need to play with any  configuration etc) and it surely seems to meet our projects requirements.... And it's really very simple to use - just drop in a jar in the class path and start using the objects provided by the project..... Really that's what I needed. Something simple and easy to use.

            • 3. Re: Clustering use-case questions.
              ckulenk

              It seems to me that customization (e.g. of the distribution behavior) in hazelcast is not as easy as in infinispan. A ConsistentHash-like interface is crucial to my use case... Anyway, good luck to you, sir

              • 4. Clustering use-case questions.
                shane_dev

                It sounds to me like you may have an issue at the transport/JGroups level if a node is starting and failing to discover the existing cluster.

                 

                You may want to adjust some of the discovery properties here.

                 

                http://jgroups.org/manual/html/protlist.html#d0e5162

                 

                Things we adjusted included: num_initial_members, num_ping_requests, and timeout.

                 

                If you set the JGroups logs to trace, it shouldn't be too difficult to find what step is the process is failing and/or not taking place.

                • 5. Clustering use-case questions.
                  gurvindernarula

                  I totally agree that infinspan is more flexible and customizable. My main concern is that out of the box jvm's that crash, they don't rejoin the cluster. In my initial tests I did not customize any settings. And even after trying a few customized settings, it did not seem to be very reliable. And I tried it with a simple hello word type of program. With hazelcast it just worked out of the box. I really don't need that level of customization. So far it looks like hazelcast seems to be meeting my requirement. I will surely re-evaluate infinispan to see I can get it to work, now that I know I have a plan 'b' in case i can't get infinispan going for my use case.

                  • 6. Re: Clustering use-case questions.
                    galder.zamarreno

                    The reason why when the node was restarted you could not see any contents was because state transfer was not configured. This should work:

                     

                    <infinispan>

                      <global>

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

                        <transport />

                      </global>

                      <default>

                        <clustering mode="replication">

                             <stateRetrieval fetchInMemoryState="true"/>

                        </clustering>

                      </default>

                    </infinispan>