Appendix D. Scaling for Many Child Nodes


The hierarchical database efficiently handles situations in which a single node has a large number (>100K) of child nodes. It does this by segmenting the parent's list of child references into multiple blocks, where each block is small enough to manage.
The hierarchical database actually performs this optimization in the background rather than do it during the Session's save() operation. As a consequence, the actual number of child references stored in any block might vary significantly from the "optimal" value. While the hierarchical database is capable of handling blocks of any size, performance when dealing with very large numbers of child nodes will be improved when the block sizes are optimized.
Accessing by Path
Navigating to a node by using its path is perhaps one of the most common access patterns in JCR. This uses the Node.getNode(String) method that takes a relative path, finding a particular child node with the supplied name and same-name-sibling index. The hierarchical database internally indexes the children in each block by both names, so finding nodes by name (and SNS) are as fast as possible, even if multiple blocks need to be accessed.
Iterating
Another common access pattern is to iterate over some or all of a parent node's children, using the Node.getNodes() and Node.getNodes(String) methods. The resulting NodeIterator will transparently access the children one block at a time, and will continue with all blocks until the last child reference is found or until the caller halts the iteration.
Accessing by Identifier
Another common access pattern is to find a node by identifier, using the Session.getNodeByIdentifier(String) method. The hierarchical database handles this request by directly finding the node by its identifier, and only needs to access the parent's (or ancestors') child references only when the node's name or path is requested by the caller (via the Node.getName() or Node.getPath() methods).
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top