Configure the BundleCache
Overview
This page explains how to configure the workspace and versioning bundle caches to improve content repository read performance in Bloomreach Content.
When to Use
Adjust the bundle cache settings to optimize database read operations and reduce latency, especially in production environments where the default cache size is insufficient.
How BundleCache Works
The repository retrieves content from the database in bundles. Each bundle contains structural details about a node, including parent and child IDs, property names and values, and metadata such as node type. The repository caches these bundles to minimize database reads and improve performance.
There are two separate bundle caches:
- Workspace bundle cache: Caches bundles for the default workspace.
- Versioning bundle cache: Caches bundles for version history.
By default, both caches are set to 8 MB. This size is typically too small for production systems.
Configure the Bundle Caches
You configure the bundle caches in repository.xml. If your application is already bootstrapped, update workspace.xml instead. After making changes, restart the application to apply the new settings.
Sizing Guidelines
- There is no universal bundle cache size. Increase the cache size as needed, but do not exceed the total size of your data.
- Bundle caches use Java heap space. If you increase the cache size, also increase the JVM's maximum heap space accordingly.
- Specify the cache size in megabytes.
Workspace and Versioning Cache Configuration
Configure the workspace and versioning bundle cache sizes independently.
- For brXM 12.5 and earlier, the versioning bundle cache could be omitted or set to a low value (for example, 16 MB).
- Starting with version 12.6, versioning operations require more reads. Set the versioning bundle cache to at least 16 MB, and generally to one quarter of the workspace bundle cache size.
- For example, if the workspace bundle cache is 256 MB, set the versioning bundle cache to 64 MB.
Note: For brXM 12.6 and later, set the
<Versioning>bundle cache size to one quarter of the<Workspace>bundle cache size.
Example Configuration
In 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>
Enable Bundle Cache Statistics Logging
To log bundle cache statistics, add the following logger configuration to log4j2.xml:
<Logger name="org.apache.jackrabbit.core.persistence.bundle" level="info" additivity="false"> <AppenderRef ref="root"/> </Logger>
Verification
After updating the configuration and restarting the application:
- Monitor JVM heap usage to ensure sufficient memory is available for the increased cache size.
- Review application logs for bundle cache statistics if logging is enabled.
- Confirm improved read performance by measuring repository response times.