StoreJanitor in Apache Cocoon
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation
Concepts
Overview
Sitemap
Views
Caching
Actions
Matchers and Selectors
Entity Catalogs
MRUMemoryStore
StoreJanitor

Goal

This document describes the usage of the StoreJanitor under Apache Cocoon.


Overview

In the current design of Apache Cocoon there can be different stores for the different pipelines. For example you can choose a weaker store for the event pipelines (weaker=caches not many objects) and a "big" store for the stream pipelines. If you know which ones are more "cacheable", you can fine-tune your stores. This decision was made, because of the two pipeline objects. You can combine a non-caching-stream-pipeline with a caching-event-pipeline etc.


Implementation

The implementation is quit simple! Every store can call the register() method of the actual StoreJanitor component. This checks in a configurable interval if memory is running low. If low, then the StoreJanitor goes through all stores with a Round Robin algorithm and call the free() method of the registered stores (which they have to implement per the Store interface) so long, until memory is normal.


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"/>
  </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%" -Xms100000000 -Xmx200000000 org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
    
    
  • StoreJanitor settings:

The freememory and heapsize paramter always depends on the Xms and 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"/>
    </store-janitor>
    
    

The heapsize _must_ be higher then the -Xms parameter and freememory _between_ those both. If you set the heapsize lower then the -Xms parameter and freememory very thin, then the cleanupthread will work all the time and cause a high system load. If you set the heapsize to close to the Xmx paramter and freememory to broad can cause a OutOfMemoryException. Somewhere in the middle is always the best.

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.



Copyright © 1999-2001 The Apache Software Foundation. All Rights Reserved.