1 Reply Latest reply on Apr 10, 2017 9:59 AM by Paul Ferraro

    Can infinispan caching is used in multiple non-clustered & balanced, standalone JBoss7 instances ?

    reply2mm Newbie

      I've a stateless service webapp (used hibernate ORM) deployed in JBoss7.1.1 and has MySQL replication in DB Layer.

      We are not interested in JBoss AS Clustering as we have a stateless application but we want to balance the load, as we are expecting heavy peak load.

      So the application is deployed in multiple standalone JBoss intsnaces, in a non-clustered and balanced fashion.

       

      I want to cache database queries (or entities) and want that local L2 caches in every JBoss instance to be automatically synced.

      I'm trying to evaluate infinispan and investigated that JBoss7 provides its inbuilt support. However, I'm new to infinispan and unable to configure and activate the infinispan correctly for the abobe mentioned scenario. I've configured the infinispan local-cache in "standalone.xml" but it doesn't work for the non-clustered independent JBoss instances.

       

      As per my understanding, infinispan supports 3 other caching modes apart from local-cache, they are distribuited, invalidattion and replicated cache, but I believe they are only work for clustered JBoss nodes.

       

      PLEASE let me know if there is any way I can activate infinispan to function as DB L2 caching in balanced non-clustered environment.

       

      -MM

        • 1. Re: Can infinispan caching is used in multiple non-clustered & balanced, standalone JBoss7 instances ?
          Paul Ferraro Master

          reply2mm wrote:

          We are not interested in JBoss AS Clustering as we have a stateless application but we want to balance the load, as we are expecting heavy peak load.

          So the application is deployed in multiple standalone JBoss intsnaces, in a non-clustered and balanced fashion.

           

          I want to cache database queries (or entities) and want that local L2 caches in every JBoss instance to be automatically synced.

          "JBoss AS Clustering" is not a monolithic feature.  You can replicate any part of your server-side state without having to replicate everything.

          Automatically syncing your L2 cache *is* a clustering feature - and you can enable it, on a per-entity/collection/query basis without having to replicate everything.  The cost of group communication is negligible - the real limiting factor is the amount of state coordination between nodes.

           

          Given that performance is a concern, I would strongly encourage you to leverage JPA with an 2nd-level invalidation cache.  With an invalidation-cache, entity state is not replicated between nodes, but is local only.  However, any database write affecting cached entities will result in the broadcast of invalidation messages (which only contain the primary key, not the entity state itself) to your other nodes - to inform caches on other nodes that they need to refresh any corresponding cached entities from the database.  Be conservative about which entities/queries you want to cache - since this kind of caching only scales well when the number of writes for a given entity is small compared to the number of reads.