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.  [ 2 posts ] 
Author Message
 Post subject: Explanation of Statistics re sessions opened/closed and Txs
PostPosted: Thu Jun 15, 2006 9:10 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
We have enabled Hibernate Statistics in our webapplication and are looking for an explanation of the relationship between Sessions opened, closed, and the number of transactions.

Our app uses Session Beans with CMT, and all Hibernate activity occurs in DAOs used by the Session Beans.

We have some architecture factory code that developers use to create and decorate their instances of their business logic classes which are using the DAOs which closes the session on completion of the business method call (this was written prior to the auto session close and flush facility that was added in Hibernate 3.x). In one or two known cases we know where developers are not using this code we have Sessions that are being opened and never closed, but this is in a very limited number of areas.

The figures that we need an explanation of are the relationship between sessions opened, sessions closed and transactions.

We are seeing more Sessions opened than closed and transactions (these figures are from a couple of hours of system usage):
sessions opened=2600,
sessions closed=2585,
transactions=2585,
successful transactions=2563

Are there any cases where Sessions can be opened that are not part of a Transaction, and where the Sessions are not closed? Do these figures look normal?

The number closed matches the number of transactions, but there are 15 Sessions unaccounted for. Some of these may be due to developers bugs in their code that I already mentioned where they are not using the cleanup code, but in that case the number opened (and not closed) should match number of transactions, but this is not the case.

Any thoughts?

Here are the remainder of the stats output:
flushes=1676,connections obtained=2590,statements prepared=26218,statements closed=26218,second level cache puts=533,second level cache hits=1629,second level cache misses=200,entities loaded=16052,entities updated=869,entities inserted=1859,entities deleted=34,entities fetched=1610,collections loaded=9559,collections updated=424,collections removed=135,collections recreated=2556,collections fetched=9242,queries executed to database=9859,query cache puts=0,query cache hits=0,query cache misses=0,max query time=6494

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using: DB2 8.2.3

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 11:21 am 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
The second part of this question that I should have asked: there is a mismatch between number of sessions opened and connection obtained.

Since a Session is a wrapper for a database connection, when would you expect a Session to be opened but to not open a connection at the same time?


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