cocoon-users-fr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastien BARATHIEU" <>
Subject Réf. : Gestion de Memoire Cocoon
Date Mon, 16 May 2005 06:36:22 GMT

Voici le résultat de mes recherches, perso j'ai réussi à ne pas faire
tomber le service Tomcat avec une config du type freememory 20m,  heapsize
512m et option Xmx au start de Tomcat - Xmx512000000.


      <-- Thread -->
      <-- Date -->

RE: C2 Memory Settings - Xms, Xmx, freememory, and heapsize

Gerhard Froehlich
Thu, 24 Jan 2002 11:15:15 -0800

Hi Peter,

>From: Peter Hargreaves [mailto:[EMAIL PROTECTED]]
>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.


>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
>      <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


>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

>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'.


>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.


>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
>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

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

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!


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

|   (Embedded  | Sébastien BARATHIEU             | (Embedded image moved to file:   |
|  image moved | EDI CFE                         | pic04827.gif)                    |
|   to file:   | Etudes                          |    |
| pic11942.jpg)| CIPAM Marseille                 | (Embedded image moved to file:   |
|              |                                 | pic14604.gif)                    |
|              |                                 | Groupe CFE :  04 91 74.96.12     |
|              |                                 | Personnel :       |

View raw message