3 Replies Latest reply on Jun 16, 2008 6:26 PM by manik

    jboss cache 1.4.1.GA + Eviction Policy problems

    andre.rigon

      Hi everyone,

      I'm using jboss cache 1.4.1.GA with jboss 4.0.5.GA.
      I'm trying to use an eviction policy.
      Here is part of my tree-service.xml file:


       <attribute name="EvictionPolicyClass">
       org.jboss.cache.eviction.LFUPolicy
       </attribute>
       <attribute name="EvictionPolicyConfig">
       <config>
       <attribute name="wakeUpIntervalSeconds">5</attribute>
      
       <region name="/_default_">
       <attribute name="maxNodes">5000</attribute>
       <attribute name="timeToLiveSeconds">5000000</attribute>
       </region>
       <region name="/domainenumsubscriber"
       policyClass="org.jboss.cache.eviction.LFUPolicy">
       <attribute name="maxNodes">5697</attribute>
       </region>
      
       <region name="/company"
       policyClass="org.jboss.cache.eviction.LFUPolicy">
       <attribute name="maxNodes">2</attribute>
       </region>
      
       </config>
       </attribute>
      


      It seams that is a concept issue for me here.
      When I set timeToLiveSeconds=0, the cache is not filled, or its cleaned up to fast.
      The expected behaviour of this configuration, for me is:

      timeToLiveSeconds=0 --> the cache will 'never' be cleaned up.
      maxNodes=5 -> when the cache fqn "/company" have 2 objects and a third one is going to be put in the cache, the eviction policy is applied and one of the previous objects is removed.

      am I understanding the behavior of the eviction policy?
      or there is something that I'm missing?

      thanks for help.

      andre




        • 1. Re: jboss cache 1.4.1.GA + Eviction Policy problems
          manik

          According to the docs, your expectation is correct in that setting time to live to 0 means that there is no time to live. And hence the JIRA to enhance this such that we are able to specify a ttl of 0 such that elements are evicted pretty much immediately.

          I suspect that the reason you see your nodes being removed so quickly has to do with something else. Have you got log messages showing that elements are being evicted almost as soon as they are put into the cache?

          • 2. Re: jboss cache 1.4.1.GA + Eviction Policy problems
            andre.rigon

            thanks for the quick reply.

            I tested the cache behavior by setting a very high ttl value and them inspecting the cache in the jboss jmx console.
            I didnt find how to setup log or debug messages for the cayenne version of jboss cache. Do you or someone know how to do that?

            and about this quote:


            maxNodes=5 -> when the cache fqn "/company" have 2 objects and a third one is going to be put in the cache, the eviction policy is applied and one of the previous objects is removed.


            is that the correct behavior?

            thanks,

            andre

            • 3. Re: jboss cache 1.4.1.GA + Eviction Policy problems
              manik

              You can get more detailed logs by :

              1) Adding log4j jars to your classpath
              2) Adding a log4j.xml file to your classpath, or point to it using -Dlog4j.configuration=/path/to/log4j.xml
              3) Edit your log4j.xml file to print out TRACE or DEBUG level messages for org.jboss.cache.

              Not sure as to why you have an issue with maxNodes, logging will tell you more.