Configure the BundleCache
Introduction
Goal
Optimize content repository read performance by configuring the workspace and versioning bundle caches.
Background
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 repository.xml. Note that if you want to change an already bootstrapped application, the workspace.xml must be changed. After changing the settings, the application must 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. The size of the bundle cache is specified in megabytes.
The workspace bundle cache size is configured independently of the the versioning bundle cache size. Up to Bloomreach Experience Manager 12.5, the versioning bundle cache could be left out or set to a low size such as 16. As of Bloomreach Experience Manager 12.6, signigicantly more read operations are performed on versioning, therefore it is strongly recommend to configure a proper versioning bundle cache size. As a rule of thumb, in production environments, we recommend to set the versioning bundle cache size to a minimum of 16, and in general 1/4 of the size of the workspace bundle cache size. For example, with a workspace bundle cache size of 256, a versioning bundle cache size of 64 would be recommended.
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="256"/> </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="64"/> </PersistenceManager> <.../> </Versioning>
The bundle cache can log some statistics information. To enable this, add the following appender section to log4j2.xml:
<Logger name="org.apache.jackrabbit.core.persistence.bundle" level="info" additivity="false"> <AppenderRef ref="root"/> </Logger>