[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2553?page=c...
]
Shawn Clowater commented on HHH-2553:
-------------------------------------
Yeah, that idea crossed my mind, it's a bit of a pain keeping track of the cross
reference but the massive iteration was killing me.
As for the patch, I'll give it a go right away, I should know pretty quick whether or
not performance is on par with previous implementation.
New LoadContexts Implementation causing possible performance
degradation
-------------------------------------------------------------------------
Key: HHH-2553
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2553
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Reporter: Shawn Clowater
Assignee: Steve Ebersole
Fix For: 3.2.4
Attachments: LoadContexts.diff
Noticed that some of our unit tests began to suffer a 300% decrease in performance with
the latest 3.2.3 release.
Fetches that were taking in the order of 20s were now up around a minute.
Stuck a profiler on the test run including the Hibernate classes in the profile and the
CollectionLoadContext immediately filtered to the top getting tens of millions of hits in
the locateLoadingCollectionEntry chain of methods. Looked at one of the offending tests
and it ends up loading ~ 1000 entities and the collectionLoadContexts property of the
LoadContexts class peaks at about 9500.
I'm thinking the iteration of the contents of the collectionLoadContexts collection
is going to cause grief for anyone loading a substantial amount of entities at a given
time. I believe the implementation before was there used to be 1 lookup of a Map key to
find a collection where now you may end up with n number of key lookups where n is the
number of CollectionLoadContexts that you have. (in my case 9500ish)
The specific piece of code from LoadContexts I am referring to is:
LoadingCollectionEntry locateLoadingCollectionEntry(CollectionKey key,
CollectionLoadContext caller) {
if ( collectionLoadContexts == null ) {
return null;
}
if ( log.isTraceEnabled() ) {
log.trace( "attempting to locate loading collection entry [" + key + "]
in any result-set context" );
}
LoadingCollectionEntry rtn = null;
Iterator itr = collectionLoadContexts.values().iterator();
while ( itr.hasNext() ) {
final CollectionLoadContext collectionLoadContext = ( CollectionLoadContext )
itr.next();
if ( collectionLoadContext == caller ) {
continue;
}
rtn = collectionLoadContext.getLocalLoadingCollectionEntry( key );
if ( rtn != null ) {
if ( log.isTraceEnabled() ) {
log.trace( "collection [" + key + "] located in load context ["
+ collectionLoadContext + "]" );
}
break;
}
}
return rtn;
}
I'm not quite clear as to the purpose of the underlying change but just wanted to at
least let you guys know that it might cause less than optimal performance using the 3.2.2
release as a baseline.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira