8 Replies Latest reply on Dec 6, 2007 10:17 AM by Arjan Molenaar

    FileCacheLoader not evicting?

    Arjan Molenaar Newbie

      Hi all,

      I've my TreeCache service running (nice to have one appserver wide cache), but I experience some trouble with the FileCacheLoader.

      I cache generated charts and would like to cache them on disc, instead of keeping them in memory. The simplest option would be to create a file-system cache.

      I have a set of regions declared like this:

       <!-- Name of the eviction policy class. -->
       <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</at
      tribute>
      
       <!-- Specific eviction policy configurations. This is LRU -->
       <attribute name="EvictionPolicyConfig">
       <config>
       <attribute name="wakeUpIntervalSeconds">60</attribute>
      
       <!-- Cache wide default -->
       <region name="/_default_">
       <attribute name="maxNodes">500</attribute>
       <attribute name="timeToLiveSeconds">90</attribute>
       <!-- Maximum time an object is kept in cache regardless of idle time -->
       <attribute name="maxAgeSeconds">90</attribute>
       </region>
      
       <region name="/nl/yirdis/charts/day">
       <attribute name="maxNodes">100</attribute>
       <attribute name="timeToLiveSeconds">60</attribute>
       <attribute name="maxAgeSeconds">60</attribute>
       </region>
      
       <region name="/nl/yirdis/charts/week">
       <attribute name="maxNodes">100</attribute>
       <attribute name="timeToLiveSeconds">7200</attribute>
       <attribute name="maxAgeSeconds">7200</attribute>
       </region>
      
       <region name="/nl/yirdis/charts">
       <attribute name="maxNodes">1000</attribute>
       <attribute name="timeToLiveSeconds">86400</attribute>
       <attribute name="maxAgeSeconds">86400</attribute>
       </region>
      
       </config>
       </attribute>
      


      And a cache-loader configuration:

       <attribute name="CacheLoaderConfiguration">
       <config>
       <passivation>false</passivation>
       <preload></preload>
       <shared>false</shared>
      
       <cacheloader>
       <class>org.jboss.cache.loader.FileCacheLoader</class>
       <properties>
       location=/data2/jboss/cache
       </properties>
       <async>false</async>
       <fetchPersistentState>true</fetchPersistentState>
       <ignoreModifications>false</ignoreModifications>
       </cacheloader>
       </config>
       </attribute>
      


      I can see the entities are stored on the filesystem, only they are not evicted. The eviction interceptor and friends recognise old entries and remove them (according to the log). However, the next time the chart is requested I get the old should-have-been-removed chart.

      Piece of (trace) logging:

      [LRUAlgorithm] Node /nl/yirdis/charts/day/sensor#31/800x500 has been idle for 60001ms
      [LRUAlgorithm] Node /nl/yirdis/charts/day/sensor#31/800x500 should be evicted because of idle time
      [BaseEvictionAlgorithm] Attempting to evict cache node with fqn of /nl/yirdis/charts/day/sensor#31/800x500
      [TxInterceptor] (null) call on method [_evict; id:8(/nl/yirdis/charts/day/sensor#31/800x500)]
      [CacheLoaderInterceptor] invoke _evict; id:8(/nl/yirdis/charts/day/sensor#31/800x500)
      [CacheStoreInterceptor] CacheStoreInterceptor called with meth _evict; id:8(/nl/yirdis/charts/day/sensor#31/800x500)
      [PessimisticLockInterceptor] PessimisticLockInterceptor invoked for method _evict; id:8(/nl/yirdis/charts/day/sensor#31/800x500)
      [PessimisticLockInterceptor] Attempting to lock node /nl/yirdis/charts/day/sensor#31/800x500 for owner Thread[Timer-8,5,jboss]
      [Node] acquiring RL: fqn=/, caller=Thread[Timer-8,5,jboss], lock=<unlocked>
      [...]
      [CallInterceptor] Invoking method _evict; id:8(/nl/yirdis/charts/day/sensor#31/800x500) on cache.
      [TreeCache] _evict(/nl/yirdis/charts/day/sensor#31/800x500)
      [TreeCache] _remove(null, "/nl/yirdis/charts/day/sensor#31/800x500")
      [AbstractNode] removed child 800x500
      [EvictionInterceptor] Invoking EvictionInterceptor
      [EvictionInterceptor] Updating node/element events with no tx
      [EvictionInterceptor] No node modifications
      [EvictionInterceptor] Finished invoking EvictionInterceptor
      [UnlockInterceptor] Attempting to release locks on current thread. Lock table is {Thread[Timer-8,5,jboss]=[read owners=[Thread[Timer-8,5, jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]], read owners=[Thread[Timer-8,5,jboss]]]}
      [UnlockInterceptor] releasing lock for /nl/yirdis/charts/day/sensor#31/800x500: read owners=[Thread[Timer-8,5,jboss]]
      


      What did I miss?

      Thanks,

      Arjan