[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-2175) L2 Cache performance is very very bad when writing other kinds of objects in the same transaction

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Tue Oct 24 16:59:05 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2175?page=all ]
     
Max Rydahl Andersen closed HHH-2175:
------------------------------------

    Fix Version: 3.2.2
     Resolution: Rejected

query|session.setCacheMode(..)

use forum.hibernate.org for usage questions.

> L2 Cache performance is very very bad when writing other kinds of objects in the same transaction
> -------------------------------------------------------------------------------------------------
>
>          Key: HHH-2175
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2175
>      Project: Hibernate3
>         Type: Improvement

>   Components: core
>     Versions: 3.2.0.ga
>  Environment: Hibernate Entity Manager 3.2.0 + Annotations + Core 
>     Reporter: Sami Dalouche
>      Fix For: 3.2.2

>
>
> Hibernate L2 Cache performance is very slow when writing objects in the same transaction.
> For instance. Let's say we have 2 completly unrelated classes A and B
> let's say A never changes, and we write tons of instances of B to the database. Both A and B are managed by the cache, but into differet cache  regions (with different Ehcache configurations).
> So, let's consider a simple example like :
> loop 1:
> for(int i = 0 ; i < 10000 ; i++){
> 			new A();
> }
> and loop2:
> for(int i = 0 ; i < 10000 ; i++){
> 			aDao.findAByKey("key");
> }
> Since the L2 cache + Query cache is activatedon a + findAByKey, loop2's performance is comparable to loop's 1 one. It's pretty much the same, so everything is fine, so far. Let's call X the time taken by loop1 or loop2, that we consider equal.
> Now, let's consider loop3 and loop4:
> loop 3:
> for(int i = 0 ; i < 10000 ; i++){
> 			new A();
>                         bDao.save(new B());
> }
> and loop4:
> for(int i = 0 ; i < 10000 ; i++){
> 			aDao.findAByKey("key");
>                         bDao.save(new B());
> }
> So, now, let's consider that saving bDao.save(new B()) takes Y seconds for 10,000 iterations. 
> You would expect loop3 and loop4 to have the same performance, roughly , X + Y, right ?
> Well, actually, loop3 takes X + Y. 
> But loop4 takes around 20 * (X + Y) !!!!!!!  (on my machine, so it can be slighly different).  But you see the point : there is a HUGE difference of performance.
> I am sure there are design reasons for this, that's why I set this bug as an enhancement.. So, 2 things :
> * either it is possible to solve this issue, and it would be nice to correct it
> * either it is not possible to solve this issue, and it would be nice to add a section in the reference manual, explaining why hibernate behaves that way.
> Regards,
> Sami Dalouche

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