5 Replies Latest reply on Sep 12, 2002 4:21 PM by dsundstrom

    Instance Cache/ Pool Configuration - JBoss3.0.0

    udaydg

      Iam using JBoss 3.0.0 Embedded tomcat 4.0.3
      My current settings in standardjboss.xml are default :
      <min-capacity>50</min-capacity>
      <max-capacity>1000000</max-capacity>
      <overager-period>300</overager-period>
      <max-bean-age>600</max-bean-age>
      <resizer-period>400</resizer-period>
      <max-cache-miss-period>60</max-cache-miss-period>
      <min-cache-miss-period>1</min-cache-miss-period>
      <cache-load-factor>0.75</cache-load-factor>

      My application uses CMP 2.0. We have about 60 entity beans and 20 session beans, approx 100 concurrent clients.
      What should be the ideal cache and pool settings? We are running it on a 512MB Win2K machine 1Gig.
      Commit options are all default.

      At times when we are doing large imports, abt 20,000 - 30,000 records, using CMP create, we see a spike in memory usage and an Out of Memory Exception.From the bug report 588241, we guess its an instance cache problem, so can you suggest an optimum cache setting for the above mentioned scenario.

      If the load increases too high, shouldnt the caaching strategy handle it without giving Out of Memory Exception? and we shouldnt be manipulating memory on a case to case basis?

      We reduced the cache- capacity to 3000 from 1million, and the Out of Memory problem didnt occur, however what if the size of beans exceed the memory allocated even with 3000 max capacity?

        • 1. Re: Instance Cache/ Pool Configuration - JBoss3.0.0
          dsundstrom

          BTW, this is a question for the EJB/JBoss forum.

          The current cache implementation uses hard references to objects. In the future I would like to have an optional cache that uses softreferences. Until then, you will have to test (size) you application by hand as the optimal cache size is very dependent on the size of you objects and size of the heap allocated to Java. You can estimate this by hand by counting the size of fields in the class and dividing that into the portion of the heap you want to use for thie entity's cache.

          • 2. Re: Instance Cache/ Pool Configuration - JBoss3.0.0
            integ

            Does this mean that if my default cache size is 1million (as is in standardjboss.xml), my entity beans will keep piling up till it goes out of memory? (say the beans are large and reaches my JVM mem setting before 1 million) If my uderstanding is correct, then there is no correlation between physical memory and the instance cache size/max capacity of beans?


            • 3. Re: Instance Cache/ Pool Configuration - JBoss3.0.0
              dsundstrom

              You are correct. In most applications on most servers you run into 1 million (or have less then 1 million rows) before you run out of memory.

              • 4. Re: Instance Cache/ Pool Configuration - JBoss3.0.0
                integ

                Can you explain what do you mean by 'optional cache' or hard references v/s soft references to objects?
                Thanks.

                • 5. Re: Instance Cache/ Pool Configuration - JBoss3.0.0
                  dsundstrom

                  The cache implementation is pluggable in JBoss so by 'optional cache' I ment another implementation that is not the default. Hard references are normal Java references soft references are instances of java.lang.ref.SoftReference, which is a special JVM object the the JVM will clear before an OutOfMemoryException is thrown. Read the javadocs for more info.