Configure the BundleCache
Introduction
The repository fetches its content from the database in bundles. Each bundle consists of the structural information of the node such as the ids of its parent and children, the names and values of its properties, and some meta information such as the node type of node. The repository can cache these bundles in order to reduce the amount of database reads that are needed. This greatly improves the read performance. There are two bundle caches: one for the version history and one for the default workspace. The default size of the bundle caches is 8 MB, which usually is too low for real life production systems.
Configure the bundle caches
The bundle caches are configured in the repository.xml. Note that if you want to change an already bootstrapped application, the workspace.xml has to be changed. After changing the settings the application needs to be restarted.
There is no correct size for the bundle cache. Usually the bigger the better, although it makes no sense to make it bigger than the size of your data. The bundle cache caches the bundles in the java heap space. When increasing the bundle cache, the max heap space of the JVM should also be increased. There is very little value in giving the version storage bundle cache a lot of memory. The size of the bundle cache is specified in megabytes.
repository.xml:
<Workspace ...> <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager"> <param name="driver" value="javax.naming.InitialContext"/> <param name="url" value="java:comp/env/jdbc/repositoryDS"/> <param name="schemaObjectPrefix" value="${wsp.name}_"/> <param name="externalBLOBs" value="true"/> <param name="consistencyCheck" value="false"/> <param name="consistencyFix" value="false"/> <param name="bundleCacheSize" value="512"/> </PersistenceManager> <.../> </Workspace> <Versioning ...> <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager"> <param name="driver" value="javax.naming.InitialContext"/> <param name="url" value="java:comp/env/jdbc/repositoryDS"/> <param name="schemaObjectPrefix" value="version_"/> <param name="externalBLOBs" value="true"/> <param name="consistencyCheck" value="false"/> <param name="consistencyFix" value="false"/> <param name="bundleCacheSize" value="16"/> </PersistenceManager> <.../> </Versioning>
The bundle cache can log some statistics information. To enable this, add the following appender section to the log4j.xml:
<category additivity="false" name="org.apache.jackrabbit.core.persistence.bundle"> <level value="info"/> <appender-ref ref="root"/> </category>