-->
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.  [ 3 posts ] 
Author Message
 Post subject: First within session takes forever
PostPosted: Tue Jul 20, 2004 5:45 am 
Newbie

Joined: Tue Jul 06, 2004 9:56 am
Posts: 14
Hi there,
the first statement in the session takes very long to execute (800-900ms). Subsequent (not-related) find calls (or anything else) after that are fast again.

Code:
hs = HibernateUtils.getSession(loginId);
tx = hs.beginTransaction();

start=System.currentTimeMillis();
Iterator it = hs.find("from DO_Test").iterator();
stop=System.currentTimeMillis();

start=System.currentTimeMillis();
Iterator it2 = hs.find("from DO_Test2").iterator();
stop=System.currentTimeMillis();

tx.commit();


The first find statement takes 800ms(!), the second <10ms. This is repeatable, and it is always the statement that comes first that takes so long (if the statements are exchanged, the statement located right after beginTransaction() is the one which takes just too long). My guess is, that the session is initialized just before executing the first statement. How can this be improved?

Hibernate 2.1.3, JBoss 3.2.2, PostgreSQL 7.4.1

Thanks,
Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 11:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The first call probably fetches a connection and prepares a statement, which are then both subsequently reused.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 8:23 am 
Newbie

Joined: Tue Jul 06, 2004 9:56 am
Posts: 14
Thanks for the answer. My guess would be that the connection fetching is responsible for this, since all other statements also have to be compiled, yet they are executed much faster.

Hibernate uses a JBoss DS as database, and I know that JBoss supports ConnectionPooling. Does anyone know what I forgot to enable so that connection pooling is really used, or how I can verify that conn pooling is enabled?

JBoss 3.2.2, Hibernate 2.1.3, PostgreSQL 7.4.1

Thanks,
Thomas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.