[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3221) Cascading performance problems when session contains many entities

Yves Galante (JIRA) noreply at atlassian.com
Mon Apr 7 06:28:33 EDT 2008


Cascading performance problems when session contains many entities
------------------------------------------------------------------

                 Key: HHH-3221
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3221
             Project: Hibernate3
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.3.0.CR1, 3.2.6, 3.2.5
            Reporter: Yves Galante
         Attachments: patchCascading.patch, SaveTest.zip

When session contains many entities, performence of cascading become very slow.
For each collection element the whole persistence context is searched (by StatefulPersistenceContext#getIndexInOwner() and StatefulPersistenceContext#getOwnerId) and its even searched twice when the collection is an indexed collection.


This patch optimize cascading operation by caching relation parent-child on a map.

eventSource.getPersistenceContext().addChildParent(child, parent);
action.cascade(eventSource, child, entityName, anything, isCascadeDeleteEnabled);
eventSource.getPersistenceContext().removeChildParent(child);

The test case save and flush 10 * 551 objects.

Before patch save object with cascading is more slow when session size grows.
After patch time of save stay same at each loop.

Output of the test case before the patch :

Save took 449 ms
Save took 669 ms
Save took 1042 ms
Save took 1464 ms
Save took 2481 ms
Save took 2741 ms
Save took 3807 ms
Save took 4344 ms
Save took 4975 ms
Save took 5251 ms
Total took 30906 ms

Output after the patch

Save took 445 ms
Save took 144 ms
Save took 164 ms
Save took 108 ms
Save took 93 ms
Save took 93 ms
Save took 93 ms
Save took 94 ms
Save took 91 ms
Save took 89 ms
Total took 4905 ms

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list