]
Steve Ebersole closed HHH-3860.
-------------------------------
Resolution: Fixed
Cascading performance problems when session contains many entities
------------------------------------------------------------------
Key: HHH-3860
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3860
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.3.1, 3.3.2
Reporter: Yves Galante
Assignee: Steve Ebersole
Fix For: 3.5, 3.3.x
Attachments: patchCascading.patch, SaveTest.zip, SaveTest_v2.zip
Time Spent: 1 hour, 42 minutes
Remaining Estimate: 0 minutes
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: