Goal
This document describes the usage of the StoreJanitor under
Apache Cocoon.
Description
The implementation is quit simple! Every implementation of a Store can register in the
StoreJanitor. He checks in a configurable interval if memory is running low. If low,
he greps via Round Robin a victim (Store) and frees xx% of all emlements in this Store.
After that the StoreJanitor sleeps and waits for the next iteration.
Configuration
| | |
|
<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"/>
<parameter name="percent_to_free" value="10"/>
</store-janitor>
| |
| | |
The right configuration is very important, because wrong settings can cause a high system load.
Example configuration
-
Tomcat settings in tomcat.sh or tomcat.bat:
| | |
|
%_RUNJAVA% %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%" \
-Xmx200000000 org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
| |
| | |
The freememory and heapsize paramter always depends on the Xmx
parameter.
| | |
|
<store-janitor
class="org.apache.cocoon.components.store.StoreJanitorImpl"
logger="root.store">
<parameter name="freememory" value="50000000"/>
<parameter name="heapsize" value="150000000"/>
<parameter name="cleanupthreadinterval" value="10"/>
<parameter name="threadpriority" value="5"/>
<parameter name="percent_to_free" value="10"/>
</store-janitor>
| |
| | |
It is recommended to have heapsize equal to -Xmx, especially
on Sun's JVM which are unable to shrink its heap once it grows above minimum.
freememory should be greater than amount of memory necessary for normal
application operation.
The cleanupthreadinterval defines the interval of the background
thread which checks memory in seconds. Also this paramter should configured wisely.
A to short interval can cause also a high system load. The
threadpriority defines the priority of the background thread.
1 is lowest level and 10 the highest.
The percent_to_free parameter describes, how much percent of the
elements of each registered Store shall be removed when low on memory.
|