[
https://issues.apache.org/jira/browse/JCR-3537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13609768#comment-13609768
]
Todd Pagni commented on JCR-3537:
---------------------------------
I am adding a single file with a resource node that contains the file content
and a few properties. There is only one file in the parent folder. When the
version is created on file check in, 100's of select statements are executed
while storing the parent / child version. The patch is attempting to reduce
the # of queries being executed, but I am not why 100's of queries are being
executed when adding an single file to a folder. There are not that many
actual child nodes, so am not sure what the childNodeEntries represent in the
version code that is causing the select queries (see below).
NodeSateEx.store(NodeState) around line 739 you will find the following:
// now store all child node entries
for (ChildNodeEntry entry : state.getChildNodeEntries()) { //this collection
has 100's of items, not sure why.
NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
//causing select queries
Any help you can provide on this topic is appreciated. If we cannot improve
performance on saving versions, it does not bode well for the future of
jackrabbit in our product.
> Large number of SQL queries when adding nodes with version history
> ------------------------------------------------------------------
>
> Key: JCR-3537
> URL: https://issues.apache.org/jira/browse/JCR-3537
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: versioning
> Affects Versions: 2.5
> Environment: Windows 2008, tomcat application server, SQL Server 2008
> database server
> Reporter: Todd Pagni
> Labels: newbie, patch
> Attachments: jackrabbit-core-2.5.0-version-history.patch
>
>
> We are adding a large number of documents to a jackrabbit 2.5 database
> repository. We are using the bundle.MSSqlPersistenceManager and we are
> seeing a large number of SQL queries (300+) when adding a single folder,
> file, and file content. This appears to create a significant performance
> bottleneck when adding documents when the repository size is over 300k
> documents/nodes. The repository structure is a hierarchy with less than 1000k
> child nodes per parent. The following is an example structure of the repo
> with the (New child folder) representing the new content being added.
> -- Root node
> -- Parent node
> --New child folder (mix:versionable,mix:lockable)
> --new file (mix:versionable,mix:lockable)
> --new document content
> --Existing Child Folder
> -- Parent node
> The vast majority of the 200-300+ queries that execute when adding a node
> look like the following:
> exec sp_execute 2,0x5740D9A36F2E4032BFF0BA652D89FFB8
> exec sp_execute 2,0xBBFE059BF7E44947A8B0858F3CE33DB8
> exec sp_execute 2,0xC2AD22DBE1DB43A083BCA1B2C94E07CC
> The majority of the queries that are executed appear to be related to
> versioning. When a node is added the version history for the node
> stored/saved, the parent node is saved, which ultimately cascades and saves
> all children of the parent, so adding a child node saves the parent and all
> other children.
> We have created a patch for jackrabbit-core 2.5.0 to prevent the cascade to
> store all other child nodes when saving/storing the version history of a new
> node. This cuts the number of queries that are executed in half. Does
> anyone see a problem with this technique? All unit tests are still passing.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira