我们使用Hibernate和c3p0连接池。到目前为止,这种组合工作得很好,直到最近我们决定将maxPoolSize增加到1000,并对我们的应用程序进行大量的压力测试。我们的应用程序的峰值负载导致DB响应非常慢,因此c3p0的死锁检测器一次又一次地发出明显的死锁警告。
基于c3p0文档,我们将maxAdministrativeTaskTime更改为10分钟,假设死锁检测每30分钟发生一次(代码表明死锁检测频率是maxAdministrativeTaskTime的三倍)。
但是,根据对c3p0日志的分析,死锁检测线程的运行频率超过30分钟。已附上日志的相关部分。令人惊讶的是,频率并不是均匀的。
Line 573745: [Timer-2] 2013-06-26 04:47:52,492 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 573746: [Timer-2] 2013-06-26 04:47:52,512 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 574292: [Timer-2] 2013-06-26 04:49:12,493 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 574293: [Timer-2] 2013-06-26 04:49:12,513 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 575004: [Timer-2] 2013-06-26 04:50:32,494 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 575005: [Timer-2] 2013-06-26 04:50:32,511 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 576062: [Timer-2] 2013-06-26 04:51:52,495 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 576063: [Timer-2] 2013-06-26 04:51:52,536 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 576720: [Timer-2] 2013-06-26 04:53:12,496 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 576721: [Timer-2] 2013-06-26 04:53:12,516 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 594087: [Timer-2] 2013-06-26 04:55:52,550 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 594088: [Timer-2] 2013-06-26 04:55:52,569 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 594753: [Timer-2] 2013-06-26 04:57:12,550 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 594754: [Timer-2] 2013-06-26 04:57:12,572 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 595624: [Timer-2] 2013-06-26 04:58:32,552 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 595625: [Timer-2] 2013-06-26 04:58:32,570 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 596416: [Timer-2] 2013-06-26 04:59:52,552 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 596417: [Timer-2] 2013-06-26 04:59:52,572 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 611011: [Timer-2] 2013-06-26 05:02:22,556 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 611012: [Timer-2] 2013-06-26 05:02:22,577 WARN [null] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@662cee3b -- APPARENT DEADLOCK!!! Complete Status: 谁能解释一下这种反常现象?
发布于 2013-06-27 02:59:58
我不能解释,但是1000个连接是相当多的,你的c3p0配置是否反映了这么高的连接数量?我的经验是,默认设置对于连接数量较少的情况很好。我建议阅读c3po documentation,特别是"Other DataSource Configuration“中的部分。
https://stackoverflow.com/questions/17327753
复制相似问题