Structuring your JCR workspace
This article is meant to help you avoid issues with JCR workspaces in PaaS.
JCR is designed to store hierarchical structured data and it doesn’t do so well with flat hierarchies (for example many hundreds or thousands of child subnodes under a single parent node). Though there is technically no limit to the number of subnodes under a parent node, practically speaking, you’ll encounter problems over a certain number.
What are some issues I may encounter?
If you have a poorly structured JCR workspace, you may encounter things like:
- Poor app performance (e.g., slow load time, slow to fetch data)
- Lucene indexing issues
- Publishing problems
Best practices
To avoid the aforementioned issues, you should consider the following best practices when structuring your JCR workspace.
Limit child nodes
Any workspace with more than 500 child nodes should be restructured to keep it under 500 child nodes for any parent node.
Time-related content
If your JCR content is time related, consider using a folder structure like /<year>/<month>/<day of month>/<hour>/<minute>/<second>/<child> to distribute child nodes across a deeper structure and limit the number of child nodes in a single folder.
Naming conventions
If your JCR content has a name, consider using a folder structure like /<letter range>/<initial letter>/<children>, e.g. /a-d/a/<child with name beginning in a>. But, be sure you keep it under the 500 limit for child nodes in a folder.
Workaround
If you’re still having issues navigating through a tree view in the AdminCentral app, try increasing the size of the Jackrabbit caches to avoid retrieving many nodes from the JCR repository database.
Set with java properties
org.apache.jackrabbit.maxCacheMemory: default 16777216 <1>
org.apache.jackrabbit.minMemoryPerCache: default 131072 <1>
org.apache.jackrabbit.maxMemoryPerCache: default 4194304 <1>
Value listed in bytes.
Set with JVM command line
-Dorg.apache.jackrabbit.maxCacheMemory=268435456 <1>
-Dorg.apache.jackrabbit.minMemoryPerCache=1048576 <1>
-Dorg.apache.jackrabbit.maxMemoryPerCache=67108864 <1>
Value listed in bytes.