Our J2SE webapp using iBatis with SimpleDataSource running in Apache Tomcat
occasionally starts to hang. It hits the roof of max. Nr. of threads and
looking at the thread dump, there are many threads that seem blocked trying to
get and return(!) connections from and to the pool:
"TP-Processor406" daemon prio=10 tid=0x005fbc00 nid=0xda4 waiting for monitor
entry [0x7ce7f000..0x7ce81788]
java.lang.Thread.State: BLOCKED (on object monitor)
at
com.ibatis.common.jdbc.SimpleDataSource.pushConnection(SimpleDataSource.java:521)
- waiting to lock <0x9e9d37f0> (a java.lang.Object)
at com.ibatis.common.jdbc.SimpleDataSource.access$100(SimpleDataSource.java:52)
at
com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:954)
at $Proxy21.close(Unknown Source)
[...]
It almost looks to me as if SimpleDataSource blocks threads from returning
connections to the pool, while other threads are trying to get connections from
it - some kind of deadlock scenario?
Assuming that my observation is wrong, I wonder if our configuration is good.
We currently have:
iBatis settings
maxRequests="128"
maxSessions="64"
maxTransactions="64"
and datasource settings
maxActive=50
maxIdle=15
Isn't maxTransactions too high? Besides the rules pointed out in the
documentation, are there rules on how these settings should relate to the
datasource settings? Something like maxActive should be at least maxSessions or
something like that?
Would these settings be any good?
maxRequests="320"
maxSessions="64"
maxTransactions="32"
Torsten