-->
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.  [ 4 posts ] 
Author Message
 Post subject: Very poor performance with hibernate and c3p0.0.9.1.2
PostPosted: Tue Oct 16, 2007 8:24 am 
Newbie

Joined: Thu Jan 25, 2007 4:57 am
Posts: 5
Hi,

I am using hibernate 3.2.1 with c3p0.0.9.1.2 over
tomcat 5.5.

Following are my config files.

hibernate.connection.url = jdbc:derby:C:<mydb>
hibernate.connection.driver_class =
org.apache.derby.jdbc.EmbeddedDriver
hibernate.connection.username = <mylogin>
hibernate.connection.password = <mypwd>
hibernate.c3p0.min_size = 5
hibernate.c3p0.max_size = 50
hibernate.c3p0.timeout = 1800
hibernate.c3p0.acquire_increment = 5
hibernate.c3p0.max_statements = 0
hibernate.show_sql = false
hibernate.cache.provider_class =
org.hibernate.cache.EhCacheProvider
hibernate.dialect = org.hibernate.dialect.DerbyDialect
hibernate.current_session_context_class = thread



com.mchange.v2.log.MLog =
com.mchange.v2.log.FallbackMLog
com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL =
DEBUG
c3p0.numHelperThreads = 3
c3p0.maxAdministrativeTaskTime = 6
com.mchange.v2.resourcepool.experimental.useScatteredAcquireTask
= true
c3p0.debugUnreturnedConnectionStackTraces = true


After a trial run of my program, these are the
statistics I get from hibernate (using
HibernateUtil.getSessionFactory.getStatistics())

- getCloseStatementCount() 1439
- getConnectCount() 21
- getFlushCount() 145
- getPrepareStatementCount() 1439
- getSessionOpenCount() 21
- getSessionCloseCount() 20
- getSuccessfulTransactionCount() 20
- getTransactionCount() 20

The above operations span a few minutes. When I
analyse the root cause of slowness from using JProbe,
I find that close to 60% of the time is spend in
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run()

If I increase c3p0.numHelperThreads from 3 to 50,
the above threads consume an even larger percentage
(90%) of the total running time.

Following are my questions. Would greatly appreciate
any insight into the issue.

1. From the hibernate statistics there does not seem
to be any obvious connections leaks ? Why are 50
helper
threads still used up then.
2. Are there any other properties I could change
or fine tune to improve performance ?
3. What could be the root cause of the long wait in
the c3p0 libraries ?
4. I did notice the DEADLOCK exception a few times
though not consistently.

[WARNING]
com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1ca
8b8d -- APPARENT DEADLOCK!!! Creating emergency
threads for unassigned pending t
asks!
[WARNING]
com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1ca
8b8d -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5771f3

(com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@fa1501

(com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@78ff69

(com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
Pending Tasks:

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1c85e5
5

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1a9237
7
Pool thread stack traces:

Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5
,main]
java.lang.Thread.sleep(Native Method)

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba
sicResourcePool.java:1805)

com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run
(ThreadPoolAsynchronousRunner.java:547)

Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5
,main]
java.lang.Thread.sleep(Native Method)

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba
sicResourcePool.java:1805)

com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run
(ThreadPoolAsynchronousRunner.java:547)

Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5
,main]
java.lang.Thread.sleep(Native Method)

com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba
sicResourcePool.java:1805)

com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run
(ThreadPoolAsynchronousRunner.java:547)

Thanks in advance.

_________________
RgDs
~Nitu


Top
 Profile  
 
 Post subject: Re: Very poor performance with hibernate and c3p0.0.9.1.2
PostPosted: Tue Jun 02, 2009 9:43 am 
Newbie

Joined: Tue Jun 02, 2009 7:08 am
Posts: 2
We too face a similar problem, any updates on this issue.


Top
 Profile  
 
 Post subject: Re: Very poor performance with hibernate and c3p0.0.9.1.2
PostPosted: Mon Jun 15, 2009 5:18 am 
Newbie

Joined: Mon Jun 15, 2009 5:02 am
Posts: 1
We are experiencing exactly the same problem. We have tried various different configurations, with and without statement pooling, and with various numbers of helper threads, pool sizes, etc.

On profiling the code, we also found most of the time spent by the c3p0 threads spent in com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(). We found that the cpu utilized by these helper threads is excessively high.

The performance of c3p0 is so bad that on removing connection pooling completely the performance of our system improved considerably. When we used the Apache connection pool DBCP our performance nearly doubled while the CPU usage decreased considerably.

Our system is heavily thread-based, with every request to the system invoked in an individual thread taken from a thread pool. What is ironic about this is that DBCP is still many times faster even though all access to the connection pool are synchronized, whereas C3P0 which is completely asynchronous is hogging our system.

I would appreciate any help or pointers,

Thanks,

Andrew


Top
 Profile  
 
 Post subject: Re: Very poor performance with hibernate and c3p0.0.9.1.2
PostPosted: Wed Oct 23, 2013 10:25 am 
Newbie

Joined: Tue Oct 22, 2013 4:44 pm
Posts: 2
I am seeing the same problem, drastic performance decline when using c3po. Does anyone know why c3p0 kills performance?

Thanks,
Patrick


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