Created

Jul 09, 2012

Determine the right CRX bundle cache size for your application

Posted by Ankush Kumar

CRX Bundle Cache caches bundles, consisting of a node with all its properties. It is used by all bundle based Persistence Managers. The default size of this cache is set to 8 MB which is a part of allocated JVM heap. If an item is not found in the cache, it is read from the persistence layer.

However, default bundle cache size may not be optimized for performance in some scenarios. Hence, few tests should always be done to find out bundle cache size which suits your application. This can be analysed from miss to access ratio of the bundle cache which is captured in the error.log file as follows

org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager

cachename=crx.defaultBundleCache[ConcurrentCache@4b48638], elements=1987, usedmemorykb=4141, maxmemorykb=8192, access=27940, miss=19870

The above example shows an entry that indicates that cache was hit 27940 times. Out of this, for 19870 times, items were not found (missed) in cache and had to be fetched from the persistence layer. This is an example of high miss to access ratio of 0.71. Normally, lower the miss to access ratio, better is the performance. Hence, in such cases where ratio is high, one should increase cache size from 8 MB. However, one should NOT assign huge memory to bundle cache size either as this would impact the over all application performance. In internal tests, we found this bundle cache size value, somewhere near to 1/10th of JVM max heap size, gives best results. But this could differ for various scenarios (Read Heavy vs Write Heavy).


In CQ 5.5, apart from error.log, bundle cache can also be monitored from JMX MBeans. In order to do so, one can access following URL:

http://<server>:<port>/system/console/jmx

There are a number of MBeans of type TimeSeries which can provide information on cache usage, access, miss etc. This data can be utilized in determining usage trend of bundle cache.

Bundle cache size can be changed from repository.xml and workspace.xml using following tags:

<PersistenceManager class="com.day.crx.persistence.tar.TarPersistenceManager">

      <param name="bundleCacheSize" value="256"/>

</PersistenceManager>