[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1258) startup time improvements

Tyler Van Gorder (JIRA) noreply at atlassian.com
Fri Sep 29 12:36:25 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258?page=comments#action_24670 ] 

Tyler Van Gorder commented on HHH-1258:
---------------------------------------

Hi Max, thanks for you work in this area, as it has been a long standing problem for us.

I recently posted to the news group about loading the configuration "on-demand" and in fact someone has created a patch to the 2.x code base to do just that. Is there any way this functionality could be included in the 3.x code base as well? I attempted to hack this project to move it to 3.2 but I am just not familar enough with the hibernate code. Here is my attached post from the forum to give you a better background on our startup time "woes". 8-)


We have 355 persistent classes (using a class per table approach on a legacy database schema). No, we can't change the schema unfortunately.

Some of the tables are large (150+ columns) with upwards of 30 FKs.

The startup time (To create and initialize the factory) is 20 Seconds on a P4 2.8Ghz machine. Some of the other machines in our development group take substantially longer (1 minute).

So for some really silly cost-benefit analysis: 

6 developers X 30 seconds (on average) X 20 Unit test runs a day = 1 hour a day
1 hour * $29.00 == $29.00 a day.
29 * 52 weeks * 5 days == $7540 a year waiting for startup.

Yeah...I know really silly and probably a bit high. 

=============================================================

We have been able to reduce our startup time by roughly half by (yeah! its now ~3K per year. 8-)

1) Moving all mapping to a singe XML file. Surprisingly, this improved startup by 25%.
2) Moving to the latest 3.2 release (Another 25%) Thanks!


We would really see great benefit from dynamically loading the configuration (as it is needed). This is strictly a developement time optimization to help  speed the unit testing.

We have played with serializing the XML configuration and it gives us no benefit in startup times.
We found this plugin which does exactly what we want but it is for the 2.x release of hibernate. (Thanks Peter!)

http://sourceforge.net/projects/hbn-dyn-mod/

Is there any way that we could:

a) Have someone that is familar with the hibernate source to contribute a 3.x version of this module. (I am willing to contribute my attempt at this) and normally I would do this myself, but I have tight deadlines.
b) Possibly have this code integrated with the hibernate distribution as an "option"

Thanks.

Tyler Van Gorder
tkv at landacorp.com

> startup time improvements
> -------------------------
>
>          Key: HHH-1258
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258
>      Project: Hibernate3
>         Type: Improvement

>   Components: core
>     Versions: 3.1 rc3
>     Reporter: Max Rydahl Andersen
>     Assignee: Max Rydahl Andersen

>
>
> while doing some basic startup perf testing the following were found - this issue is mainly to track what I find, and then fix it:
> Initial tests where 100 classes, 30 sec for buildSessionFactory
> setting hibernate.cglib.use_reflection_optimizer false and it is 10 sec for buildSessionFactory.
> (maybe we should autodetect which jdk we are running on and disable it per default for 1.4/1.5 - needs to validate runtime impact)
> Another (22%) time stealer is the discovery of getter/setters - in worst case it iterates over all declared methods per property.
> (alternatively we could cache/sort this list or make a more efficient implementation if a class only contain default property accessors)
> Other 20% of the time is done in net.sf.cglib related classes for build time enhancement.
> The rest of the time is Configuration creation (can be cached) and other iteration code.
> (p.s. don't take the % numbers as hard values - these are definitly affected by how many methods/classes you have; this underlying tests
> is done on pojos with a "high" method count (approx 100)

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