-->
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.  [ 5 posts ] 
Author Message
 Post subject: Help! Profiling hibernate application
PostPosted: Tue Apr 26, 2005 7:31 pm 
Newbie

Joined: Wed Jan 05, 2005 4:59 pm
Posts: 15
Hibernate version:2.1.7c

Name and version of the database you are using:Oracle 10g




Code:
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
   <session-factory>
      <!--put this back when using the web application name="java:comp/env/hibernate/SessionFactory"-->   
      
      <!-- ORACLE PROPERTIES -->
      <property name="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</property>
      <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
      <property name="hibernate.connection.username">rgiri</property>
      <property name="hibernate.connection.password">password</property>
      <property name="hibernate.connection.url">jdbc:oracle:thin:rgiri@//dev1:1521/csr</property>      
      <property name="hibernate.jdbc.batch_versioned_data">true</property>
      <property name="hibernate.jdbc.batch_size">20</property>
      <!-- the following only relevant if user supplied jdbc connection -->
      <property name="hibernate.jdbc.use_scrollable_resultset">true</property>
      
      <!-- TO BE USED ONLY WITHIN A APPSERVER -->
      <!--property name="hibernate.connection.datasource">SOME_VAL</property-->
      
      <!-- CONNECTION POOL -->
      <property name="hibernate.dbcp.maxActive">100</property>
      <property name="hibernate.dbcp.whenExhaustedAction">1</property>
      <property name="hibernate.dbcp.maxWait">120000</property>
      <property name="hibernate.dbcp.maxIdle">10</property>
      
      <!-- PREPARED STATEMENT CACHE -->
      <property name="hibernate.dbcp.ps.maxActive">100</property>
      <property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>
      <property name="hibernate.dbcp.ps.maxWait">120000</property>
      <property name="hibernate.dbcp.ps.maxIdle">10</property>
      
      <!-- USE STREAMS WHEN WRITING BINARY TYPES TO/FROM JDBC -->
      <property name="hibernate.jdbc.use_streams_for_binary">true</property>   
      
      <!-- ONLY FOR DEVELOPMENT RUNS -->
      <property name="hibernate.cglib.use_reflection_optimizer">false</property>
      <property name="show_sql">false</property>
      
      <!-- MAPPING FILES -->                  
      <mapping resource="com/hfc/data/db/CSRLineDetail.hbm.xml"/>
      <mapping resource="com/hfc/data/db/CSRLineInfo.hbm.xml"/>
      <mapping resource="com/hfc/data/db/CSRSummaryInfo.hbm.xml"/>
      <mapping resource="com/hfc/data/db/Payer.hbm.xml"/>
      <mapping resource="com/hfc/data/db/ServiceAudit.hbm.xml"/>
      <mapping resource="com/hfc/data/db/ServiceProperty.hbm.xml"/>
      <mapping resource="com/hfc/data/db/X12Transaction.hbm.xml"/>
      <mapping resource="com/hfc/data/db/CategoryMap.hbm.xml"/>
      <mapping resource="com/hfc/data/db/RealTimeDefaults.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


Our deployment engineer is claiming that because I am using hibernate its hogging all the resources while the webapplication is running, as a result the application is crashing. While testing on development machine I never faced the problem. I tested the application using JMETER as well no problem.

I am wondering if my configurations are not proper. Can anyone please take a look at the configuration and point out if that might cause the problem?

I tried memory profiling the application I found too many leaks for the connection pooling code.

Can anyone suggest which connection pooling method to use? I used c3p0 pool, the memory used was even more..

Any help will be much appreciated.

Thanks,
girirx


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 4:35 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
I think I remember reading somewhere that if you use scrollable resultsets with the oracle thin driver, and the resultsets are quite large, it has a tendency to leak memory.

This is a post discussing it on the java forums: Oracle JDBC Thin Driver Memory leak in scrollable result set


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 3:39 pm 
Newbie

Joined: Wed Jan 05, 2005 4:59 pm
Posts: 15
Thanks for the reply. I tried it and ran profiler again.

I tried profiling using enerjy memory profiler.

There were plenty of leaks in the connection pooling classes from dbcp. I tried changing it to c3p0, same happened. There was residual memory after the application finished running.

Then I rewrote the persistence layer using plain JDBC, memory consumption reduced almost immediately.The residual memory was half of when I had hibernate withd dbcp. Also the heap size was .8MB less

There was not a single leak in hibernate code, I don't want to give up hibernate because of pooling leaks.

I want to try another profiling run for the same application with user supplied JDBC connection. Is that possible in hibernate? How do you specify that use a specific class for Datasource and no pooling. Once I nail the fact that its the pooling i want to fix the pooling leaks by swicthing to something else.

Any help will be MUCH appreciated.

Thanks and Regards,
girirx


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 10:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Well, either of two things:
1) use the DriverManagerConnectionProvider
2) simply obtain a connection yourself from the datasource and pass in that connection to SessionFactory.openSession(Connection connection)...


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 01, 2005 5:18 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
girirx,

if you are seeing memory leaking with c3p0 and not with an unpooled DataSource, I'd like to know as much about that as you can tell me. what version of c3p0 did you try? please do try a recent version of c3p0 (preferably the latest c3p0-0.9.0 prerelease) -- older versions (including 0.8.4.5) did have issues with lingering threads, which would hold residual memory, but as far as i know these are all found and fixed. if they're not, any help tracking down leaks would be appreciated.

smiles,
Steve (c3p0 guy)


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