[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-2553) New LoadContexts Implementation causing possible performance degradation

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Apr 10 14:52:07 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole updated HHH-2553:
--------------------------------

    Attachment: LoadContexts.diff

> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list