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. 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.
If you have more than a few hundred child nodes under a single parent node, you may encounter problems and should consider restructuring the workspace.
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 under500
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 the500
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.
org.apache.jackrabbit.maxCacheMemory: default 16777216 (1)
org.apache.jackrabbit.minMemoryPerCache: default 131072 (1)
org.apache.jackrabbit.maxMemoryPerCache: default 4194304 (1)
1 | Value listed in bytes. |
-Dorg.apache.jackrabbit.maxCacheMemory=268435456 (1)
-Dorg.apache.jackrabbit.minMemoryPerCache=1048576 (1)
-Dorg.apache.jackrabbit.maxMemoryPerCache=67108864 (1)
1 | Value listed in bytes. |