-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: transaction performance
PostPosted: Mon Mar 13, 2006 2:43 pm 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
We are using Hibernate 3.0.5 and encoutering performance problems with long transactions.

Exemple :
In one transaction, creation of 10000 objects of same type takes 1250 sec.

Same objets, creation of 100 x 100 objects (with tx.begin/tx.commit) takes 32 sec.

We are using JTA.

May someone can you explain this ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 4:08 pm 
Regular
Regular

Joined: Tue Mar 07, 2006 11:18 am
Posts: 54
Location: Berlin
Hey, what's the sice of your hibernate.jdbc.batch_size
do you use it at all? I guess that your gain a benefit from using the jdbc batch size and flushing your session after commiting your transaction.
The second approach might be less memory consuming as well.

simon


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 3:14 am 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
No, setting jdbc.batch_size doesn't seem to solve my problem, performance is still very very poor.

Commiting the transaction only at the end of the job is a very important point for us ; of course, we don't have 100k objects to create, it is just a performance-test point of view.

But we have more than 1000 objects to be created/updated, and they take more than 10 minutes to be executed. That's why we are looking for performance improvements.

Doing a regularly commit divides by 5 this time, but doing that, we are not able to rollback if a the end an update problem is encountered.

So this is a big problem for us today.

As an exemple, I did a simple JDBC/Postgres test doing 100k insertions. Doing begin/100k inserts/commit or 100x100 begin/inserts/commit takes the same time. So it is not a Postgres problem.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 8:23 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:20 am
Posts: 40
Location: Vienna
Maybe you should try to call only

Code:
session.flush();
session.clear();


instead of committing regularly.
I suppose this should also improve your performance.

best regards,
Stefan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 10:28 am 
Newbie

Joined: Sun Oct 09, 2005 6:36 am
Posts: 19
Do you just create objects or does your test also include queries? Hibernate checks whether any persistent instances need to be flushed to the DB before it runs the query (as the result of the query might depend on the values of some of the modified objects). The larger your session the longer this test takes. So i might be a good idea to flush the objects manually and clear the session from time to time or to use some custom Interceptor to handle the is-dirty checks. Or you could tell hibernate not to flush the session before running a query(Session.setFlushMode) or use StatelessSessions


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 2:07 pm 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
Only for this test, I do just inserts.

flushing/clearing the session doesn't resolve the problem ; the gain is only about 15% of executing time.

In the final application, we are of course doing query/inserts/updates.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 3:06 am 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
I still have the problem ... anybody can help me ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 4:43 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Can you use the stateless session ?
And can you post the code ?

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 4:58 am 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
[quote="steckemetz"]Can you use the stateless session ?
[/quote]
To use stateless session, have I to upgrade to Hibernate 3.1 ? I am currently using Hibernate 3.0.5. I will test with latest Hibernate 3.1.3 version. Hope to test it today.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 10:46 am 
Newbie

Joined: Tue Apr 27, 2004 12:11 pm
Posts: 8
Location: France
No, I can't use StatelessSession because of the lack of interceptors, of Set management, and so on.

Hibernate 3.1.3 seems a few more quicker than 3.0.5.

But a bulk insertion/update in a long or big transaction is still very very slow.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.