April 1, 2020
Estimated Post Reading Time ~

Performance Tuning AEM 6 Deployments on MongoDB

The performance of the AEM 6 “author” on MongoDB can be improved with additional configuration.

1) Put the Data Store on the server’s local filesystem, not MongoDB
NOTE: Don’t do this in a cluster.

2) If the JVM heap is 8 GB or more, set the in-heap cache to 1 GB or more

For example, if you have a 24 GB heap, set this to 12288, but ONLY if you set the JVM to init argument NewRatio=6

This cache is based on Google’s Guava Cache (com.google.common.cache). You can get its JMX stats at /system/console/jmx/org.apache.jackrabbit.oak%3Aid%3D8%2Cname%3D%22Document-Documents%22%2Ctype%3D%22CacheStats%22

In org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.cfg in the /crx-quickstart/install folder


cache=1024

3) Set memory cache of the File Data Store contents to 4 GB

In org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.cfg

in /crx-quickstart/install folder

cacheSizeInMB=4096

4) Set maximum size of a cacheable Data Store file to 10 MB

In org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.cfg in /crx-quickstart/install folder

maxCachedBinarySize=10485760

5) Enable CopyOnRead on the LuceneIndexProvider

You need to do this ONLY if you’re running oak 1.0.12 or older.

6) Enable Oak’s “persistent cache” on the server’s local filesystem

NOTE : In Oak v1.0.15 or newer, you don’t need to do this.

a) Build and deploy the H2 MVStore

i) Download H2 (v1.4.85 or newer) from here.

ii) Assuming you installed it to C:\Programs\H2 (and that you have a JDK configued), change folder to C:\Programs\H2\h2 and then build MVStore with

build jarMVStore

If this worked, you’ll get this:

Target: jarMVStore
Deleting temp
Deleting docs
Compiling 27 classes
Jar bin/h2-mvstore-1.4.187.jar (199 KB)
Done in 2449 ms

iii) Get the OSGi bundle jar from C:\Programs\H2\h2\bin (e.g. h2-mvstore-1.4.187.jar) and deploy it to AEM using the Apach Felix web console

iv) Stop AEM

v) Set that Oak “persistent cache” to 10 GB in org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.cfg in the /crx-quickstart/install folder

persistentCache=/opt/aem/author/crx-quickstart/cache,size=10240,-compact,-compress

If you don’t deploy H2 MVStore but enable the “persistent cache”, you’ll get this error:

org.apache.jackrabbit.oak.plugins.document.DocumentMK Persistent cache not available; please disable the configuration
java.lang.NoClassDefFoundError: org/h2/mvstore/MVMap$MapBuilder

Caused by: java.lang.ClassNotFoundException: org.h2.mvstore.MVMap$MapBuilder not found by org.apache.jackrabbit.oak-core [85]

Sample config files can be downloaded here:
1) org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.cfg
2) org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.cfg

Note: Also see the MongoDB production check list here.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.