5 Replies Latest reply on Nov 12, 2014 8:25 AM by rvansa

    Infinispan Purging

    amit.hora

      Hi,

       

      Is there a way by which  i can force Infinispan to purge entries while running

      Please find below code used to get the cache

        ConfigurationBuilder b = new ConfigurationBuilder();

                b.versioning().disable();//.validate();

                b.persistence()

                 .addStore(LevelDBStoreConfigurationBuilder.class).location("/home/tmpstore200").expiredLocation("/home/tmpexpiredlocation200").expiryQueueSize(100).purgeOnStartup(false).async().threadPoolSize(10);

                 b.eviction().strategy(EvictionStrategy.LIRS).maxEntries(8).expiration().wakeUpInterval(1000l).reaperEnabled(true);

                

              b.jmxStatistics().enabled(true);

              

      Running the below loop multiple times leads to increase in size of cache store although i am writing the same key,value again and again

       

      for(int i=0;i<100;i++)

      c.put("key"+i ,"vlue"+i,1,TimeUnit.SECONDS);

        • 1. Re: Infinispan Purging
          wdfink

          I'm not sure about the LevelDB implementation as it is a third-party. But as it is file based it will append new entries at the end.

          The SingleFileStore implementation re-use the space within the file if possible if the entry size is not larger than the old entry.

           

          The only possiblility I'm aware of is to purge on startup if the cluster is running and it will be restored from the cluster.

          • 2. Re: Infinispan Purging
            rvansa

            Infinispan can purge only those entries which are expired (based on the lifespan or idle time). How LevelDB stores the entries internally is out of the range for Infinispan, and org.iq80.leveldb.DB does not have any API to enforce this - there are only methods for suspending and resuming the compaction (which should run in background), and LevelDBStore does not use them.

            The period of purging expired entries is controlled by <expiration interval="..." />. You could trigger that manually by calling cache.getAdvancedCache().getComponentRegistry().getLocalComponent(PersistenceManager.class).purgeExpired(), though you're touching internals a bit this way.

            • 3. Re: Infinispan Purging
              amit.hora

              I am thinking to use  HBase as cache store but can not find enough documentation ,Can anyone share example of using HBase as cache store with Infinispan?

              • 4. Re: Infinispan Purging
                amit.hora

                HI All,

                 

                I am able to use HBase as a cache store for infinispan but facing an issue

                when entry gets expired Infinispan moves them to expire table but is not deleting them from entry table as a result i have entries both in entry as well as expired tables

                 

                even after calling cacheStrore.purgeExpired(); //entries are not getting deleted from entry table

                 

                Any pointer will be of a great help

                • 5. Re: Infinispan Purging
                  rvansa

                  HBase cache store is not very actively updated. Contributions and fixes are welcomed.