4 Replies Latest reply on Mar 21, 2013 7:45 AM by abhinavshrivastav

    Memory Limit on Infinispan cache

    abhinavshrivastav

      I need to start Infinispan in clustered mode with tomcat. How do I ensure that the cache consumes only a limited amount of the memory allocated on each cluster?

        • 1. Re: Memory Limit on Infinispan cache
          usydrajani

          Hi

           

          I use Jboss 6. There is file infinispan-configs.xml which comes with infinispan. If you are useing entity cache you can change the config  maxEntries. this will tell the eviction thread to leave the  number of entries 'maxEntries'

          in cache after doing pruning to cache. The  maxEntries  should be in power of 2

           

          <eviction wakeUpInterval="0" maxEntries="131072" strategy="LRU"/>

           

          Also these is size function in which you can use

           

          eg

          I have entity cache named  as  "infinispan.infinicache.ReviewEntity"

           

          so what I did

           

          @Resource(name = "CacheManager/entity", mappedName = "java:CacheManager/entity")

                    protected EmbeddedCacheManager cm;

           

          System.out.println("Size of cache ReviewEntity  "+cm.getCache("infinispan.infinicache.ReviewEntity").size());

           

          I hope this helps

           

          Meena

          • 2. Re: Memory Limit on Infinispan cache
            abhinavshrivastav

            Thanks Meena. But if I am using it in clustered mode, can I configure the way keys would be distributed amongst various nodes.

             

            i.e. If have Node 1 and Node 2 in a clustered in distributed mode, then I would want 1 GB from Node 1 to be used and 2GB from Node2.

            • 3. Re: Memory Limit on Infinispan cache
              usydrajani

              I think eviction policy is local policy on each node. So i think it can be   possible, you can try  that. In waht mode are you runing Infinispan? Invalidation or replication. If you are runing in invalidation than it makes sense to have different size of each cache node. While in Replication I do not think it helps to have cache of different size.

              1 of 1 people found this helpful
              • 4. Re: Memory Limit on Infinispan cache
                abhinavshrivastav

                Thanks. I can try that. We are running it in distributed mode.