[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1157) Performance problem StatelessSession and StatefulPersistenceContext.clear

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:01:03 EDT 2011


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

Steve Ebersole closed HHH-1157.
-------------------------------


Closing stale resolved issues

> Performance problem StatelessSession and StatefulPersistenceContext.clear
> -------------------------------------------------------------------------
>
>                 Key: HHH-1157
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1157
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1 rc2
>         Environment: win2k, db2
>            Reporter: Barthel Steckemetz
>
> The StatelessSession in h3.1 is using the StatefulPersistenceContext,
> which has a lot of maps and sets to keep track of instances loaded etc.
> This is quite useful in the stateful Session, but yields to the following problems.
> When first loading a lot of instances like:
> Query queryA = session.createQuery("from A");
> List listA = queryA.list();
> The instances maps in StatefulPersistenceContext are cleared, i.e.
> HashMap.clear is used like:
>     public void clear() {
>         modCount++;
>         Entry tab[] = table;
>         for (int i = 0; i < tab.length; i++) 
>             tab[i] = null;
>         size = 0;
>     }
> Thus no references to the loaded instances are kept by the session.
> But the HashMap.table array has still the same (possibly large) size.
> Every subsequent load operation will call StatefulPersistenceContext.clear
> too. So that the loop in HashMap.clear is run again.
> This is especially costly when using ScrollableResults where
> this happens for every call of next.
> The solution may be to create a new instance of StatefulPersistenceContext
> instead of calling clear. This may have side effect if references to its
> members are kept elsewhere. We could fix our performance problems
> this way.
> A better solution could be to write an own StatelessPersistenceContext class.

-- 
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