[Opensource] Getting use of the Cache System

Michael Rimov rimovm at centercomp.com
Wed Jun 12 14:07:37 PDT 2002


At 12:19 PM 6/12/2002 +0300, you wrote:
>Hello,
>I have problems with the cache system. I read the developers guide, but 
>maybe the documentation is not updated for the 4.1ea2 release, can you 
>please help me. I want my dbobjects get use of the cache system for faster 
>response.
>
>I am using Expresso 4.1ea2. When I start Tomcat on my server, I get this 
>warning:
>
>WARN [main] cache.CacheManager (CacheManager.java:313) - WARNING: Out of 
>memory & no more caches can be cleared. Avail:7315456.0, Free:527944.0, 
>7.216% free
>
>(Surprisingly, I don't get this warning when I run expresso on my desktop)
>
>I tried to increase the heap size by adding the following to catalina.bat:
>
>if not "%JAVA_OPTS%" == "" goto hasJavaOpts
>set JAVA_OPTS=-Xmx256m -Xms192m
>:hasJavaOpts

Hi Turgay!

I came across that one about 3 months ago and I've been meaning to write an 
article about it ever since.

Here's the deal:

Expresso Cache checks the System available memory before creating a new 
'cache'.  The problem in this lies in the JVM.  If current heap allocation 
is only 92 Mb even though Max is 256 Mb, the API call will only return 
what's left from the current heap allocation, and worse yet, it doesn't 
expose what the max potential is.

I decided to keep that code in there because it helps to prevent crashes 
near a system limit.  However, here's a workaround for that error:

-Xmx256m -Xms256m

By having the minimum allocation = maximum allocation you're going to get 
the best performance and the cache will grow to the maximum that it can.

That should take care of the warning messages.

The other thing to be aware of is that searchAndRetrieveList() does NOT 
cache it's results.  retrieve() DOES however.

HTH!
                                                 -Mike




More information about the Opensource mailing list