cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Froehlich" <g-froehl...@gmx.de>
Subject RE: C2 Memory Settings - Xms, Xmx, freememory, and heapsize
Date Thu, 24 Jan 2002 19:31:23 GMT
Hi Peter,

>From: Peter Hargreaves [mailto:pdh@totalise.co.uk]
>
>Hi Folks,
>
>I've completed my application and am investigating massive memory 
>demands (100M - 300M). The following are some of my conclusions, which 
>may be of use to others. I'm definitely not an expert so comments please 
>>from those that know better. Some of the following does seems to 
>contradict other posting about memory configuration.

Kool, mate. Keep up sending feedback!

>The java heap is the area of RAM reserved for use by the java virtual 
>machine. At any time only part of the heap will be in use. The size of 
>the part in use will vary over time as classes and instances are loaded 
>and released. If the size in use approaches the size of the heap, then 
>more memory will be allocated to the heap. If the amount in use falls to 
>a small percentage of the heap size for a relatively long period the 
>size of the heap will be reduced by the jvm, to free memory for the 
>operating system.
>
>Xms and Xmx are set when the jvm is started. If using Tomcat-4.0.1 set 
>the environment parameter CATALINA_OPTS=-Xms<value> -Xmx<value> before 
>starting Tomcat.
>
>Xms - sets initial java heap size
>---------------------------------
>With cocoon there seems to be little point setting this as start-up 
>times are dominated by other factors.

Ok.

>Xmx - sets maximum java heap size
>---------------------------------
>This is the maximum amount of memory available to Tomcat and Cocoon. If 
>there is demand for more than is available, then a 
>java.lang.outofmemory() exception will occur - to be avoided at all 
>costs!!! I've found it best to set this to a size which leaves some RAM 
>for the operating system. If there is virtual memory configured on the 
>operating system (hard disk pretending to be RAM) then set the maximum 
>jvm heap low enough to avoid using it.

Yes I do the same.

>Store Janitor
>-------------
>In the cocoon.xconf file there are setting for the store-janitor. The 
>store, I think, is a file cache run by cocoon which therefore places 
>demands on the jvm heap. These setting control the size of the file 
>cache to stop it using up all of the heap and thereby causing a 
>java.lang.outofmemory() error.

It's both. It's a memory store which hold the generated pages. When this
cache is full or the JVM is running low on memory some objects are freed
and swapped to the filesystem.

But your're right the StoreJanitor is the component which controls this!

>   <store-janitor 
>class="org.apache.cocoon.components.store.StoreJanitorImpl" 
>logger="root.store">
>      <parameter name="freememory" value="1000000"/>
>      <parameter name="heapsize" value="60000000"/>
>      <parameter name="cleanupthreadinterval" value="10"/>
>      <parameter name="threadpriority" value="5"/>
>   </store-janitor>
>
>parameter 'heapsize' - the size of jvm heap below which the file cache 
>is allowed to grow. When actual heap size (not heap in use) exceeds this

Exact!

>size then the store-janitor will take steps to reduce it, assuming the 
>amount of actual free memory is below the parameter 'freememory' limit.

The current alghorithm is like this:

memory is low if:
JVM total Memory consumption > configured heap && JVM free Memory < configured
free Memory

>Parameter 'heapsize' must be less than Xmx otherwise the store would be 
>allowed to fill the heap. The difference between Xmx and 'heapsize' must 
>be sufficient memory for cocoon during a 'cleanupthreadinterval'.

Correct.

>parameter 'freememory' - is the difference between heap size and heap in 
>use which the store-janitor must achieve (by giving up memory) if the 
>actual heap size has exceeded the parameter 'heapsize'. This is the 
>amount of free memory which must be available to cocoon during the 
>'cleanupthreadinterval' assuming the heapsize might no longer be able to 
>increase. If 'freememory' is set too large, then the store-janitor will 
>give up more of its cache than it needs to, or might not be able to free 
>sufficient by emptying the file cache.
>
>parameter 'cleanupthreadinterval' - the period in seconds between 
>store-janitor's attempts to monitor memory and adjust the store. Also 
>triggers finalization and the garbage collector.

Correct.

>
>My suggested settings for different ram sizes in Megabytes:
>
>            (default)64    128    256    384
>                     --    ---    ---    ---
>Xms                  0      0      0      0
>Xmx                 64    100    228    356
>heapsize            60     80    208    236
>freememory           1     20     20    20
>
>Note:
>----
>The difference between Xmx and heapsize is needed to ensure sufficient 
>free memory for cocoon during the first cleanupthreadinterval in which 
>the actual heap size exceeds 'heapsize'. Similarly the parameter 
>'freememory' tells the store-janitor to attempt to clear sufficient 
>memory for the next interval. So I've suggested the difference between 
>Xms and heapsize be the same as the size of freememory. It might need to 
>be bigger on a fast machine, or the interval reduced.
>
>
>Would the experts please comment on the above. Please let me know if I'm 
>on the right lines or if there is anything else I should know about.

You got it so far. You have to play with the parameters.
Take this formel:
JVM total Memory consumption > configured heap && JVM free Memory < configured
free Memory

if this is true the StoreJanitor kicks in and removes Objects from the Cache!

I will do (again) some changes in the store/cache implementation. I hope
it's ok when I take parts of that mail into the documentation!

  Gerhard

"Horngren's Observation (generalized): The real world is a special case."


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message