[ https://issues.apache.org/jira/browse/OAK-2758?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joel Richard updated OAK-2758: ------------------------------ Attachment: OAK-2758-SegmentNodeState-lastChildNode-cache.patch OAK-2758-SecureNodeBuilder-lastChildNode-cache.patch I have attached two alternative patches which are less intrusive and only cache the last accessed child node (per SecureNodeBuilder/SegmentNodeState). Nevertheless, for my test page it improves the rendering performance by 8.5% and the time which is spent in getChildNode is reduced by 45%. After using JCR-3870 in Sling (see SLING-4585), it will likely look quite different though. > Performance: Consider caches for MutableTree#getTree and > MemoryNodeBuilder#getChildNode > --------------------------------------------------------------------------------------- > > Key: OAK-2758 > URL: https://issues.apache.org/jira/browse/OAK-2758 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: core > Affects Versions: 1.2 > Reporter: Joel Richard > Priority: Critical > Labels: performance > Attachments: OAK-2758-SecureNodeBuilder-lastChildNode-cache.patch, > OAK-2758-SegmentNodeState-lastChildNode-cache.patch, experimental_caches.patch > > > While I was analysing Sling's rendering performance, I noticed that it would > help a lot to implement a cache for the ResourceResolver. For some pages it > almost doubled the rendering performance. This made me wondering whether > Oak's read performance could still be improved. > I noticed that a lot of time is spent in MutableTree#getTree and > MemoryNodeBuilder#getChildNode and have implemented a specific cache for > them. These two caches improve the read performance up to 4 times and do not > break any oak-core tests. > Here the benchmark results for ReadDeepTreeTest: > {code} > Fixtures: Oak-Tar > Admin User: false > Runtime: 5 > Num Items: 1000 > Concurrency: 1,2,4 > Random User: true > Profiling: false > -------------------------------------- > Executing benchmarks as admin: false on Oak-Tar > ----------------------------------------------------------- > # ReadDeepTreeTest , C, min, 10%, 50%, 90%, max, > N > Oak-Tar , 1, 16, 16, 17, 19, 22, > 290 > Oak-Tar , 2, 23, 29, 44, 68, 115, > 216 > Oak-Tar , 4, 24, 43, 97, 154, 232, > 207 > {code} > The same results with my changes: > {code} > # ReadDeepTreeTest , C, min, 10%, 50%, 90%, max, > N > Oak-Tar , 1, 4, 4, 5, 5, 15, > 1038 > Oak-Tar , 2, 10, 14, 16, 20, 60, > 577 > Oak-Tar , 4, 13, 27, 32, 40, 69, > 605 > {code} > I have also implemented another cache for properties, but it didn't really > help and broke some tests. > The experimental patch is attached. It's not meant to be applied, but just to > point out areas with potential for improvement. -- This message was sent by Atlassian JIRA (v6.3.4#6332)