ci mysql空闲连接回收_数据库连接池的配置问题-空闲线程的监控和回收

我们系统中目前设置的是jdbc.maxIdleTime=14400000 ,minIdle=20

14400000/3600/1000 = 4小时

我们的数据库目前设置为15分钟即断开。

故客户端连接池设置时间短一点:10分钟,会回收连接直到20.剩下的20个连接即使一直空闲也不回收,符合连接池的意义。但是数据库会把这20个连接关闭。故依旧无法解决

抛错或者超时的问题。

只能查看druid的监控,查看峰值活跃数。不停调整值

{

"url": "jdbc:mysql://xxxx?characterEncoding=UTF-8",

"dbType": "mysql",

"name": "DataSource-4129454",

"activeCount": 0,

"activePeak": 4,

"activePeakTime": "2016-02-16 00:00:03",

"poolingCount": 5,

"poolingPeak": 6,

"poolingPeakTime": "2016-02-15 23:59:25",

"connectCount": 8788,

"closeCount": 8787,

"executeCount": 9757,

"commitCount": 485,

"pstmtCacheHitCount": 9753,

"pstmtCacheMissCount": 4,

"startTransactionCount": 485,

"transactionHistogram": [

0,

485

],

"connectionHoldTimeHistogram": [

8274,

513

],

]

}

{

"url": "jdbc:mysql://xxx?characterEncoding=UTF-8",

"dbType": "mysql",

"name": "DataSource-4129454",

"activeCount": 0,

"activePeak": 4,

"activePeakTime": "2016-02-15 22:00:10",

"poolingCount": 4,

"poolingPeak": 4,

"poolingPeakTime": "2016-02-15 21:59:13",

"connectCount": 9354,

"closeCount": 9354,

"executeCount": 9962,

"errorCount": 1,

"commitCount": 305,

"pstmtCacheHitCount": 9956,

"pstmtCacheMissCount": 6,

"startTransactionCount": 305,

"transactionHistogram": [

0,

305

],

"connectionHoldTimeHistogram": [

8999,

353,

2

]

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值