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
|