在某个时刻,服务开始耗尽池中的连接。我启用了 Hikari = DEBUG 的日志记录级别。我得到以下统计数据:
(~50 个连接 - “正常”级别。150 - 最大池大小)
[2024-10-14 10:44:18,983] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=53, active=37, idle=16, waiting=0)
[2024-10-14 10:44:18,984] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=50, active=37, idle=13, waiting=0)
[2024-10-14 10:44:48,984] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=50, active=42, idle=8, waiting=0)
[2024-10-14 10:44:48,984] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=50, active=42, idle=8, waiting=0)
[2024-10-14 10:45:18,986] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=54, active=44, idle=10, waiting=0)
[2024-10-14 10:45:18,986] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=54, active=44, idle=10, waiting=0)
[2024-10-14 10:45:48,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=55, active=45, idle=10, waiting=0)
[2024-10-14 10:45:48,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=55, active=45, idle=10, waiting=0)
[2024-10-14 10:46:18,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=55, active=48, idle=7, waiting=0)
[2024-10-14 10:46:18,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=55, active=48, idle=7, waiting=0)
[2024-10-14 10:46:48,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=60, active=50, idle=10, waiting=0)
[2024-10-14 10:46:48,989] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=60, active=50, idle=10, waiting=0)
[2024-10-14 10:47:18,990] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=63, active=53, idle=10, waiting=0)
[2024-10-14 10:47:18,990] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=63, active=53, idle=10, waiting=0)
[2024-10-14 10:47:48,990] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=65, active=57, idle=8, waiting=0)
[2024-10-14 10:47:48,990] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=65, active=57, idle=8, waiting=0)
[2024-10-14 10:48:18,991] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=68, active=56, idle=12, waiting=0)
[2024-10-14 10:48:18,991] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=66, active=56, idle=10, waiting=0)
[2024-10-14 10:48:48,992] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=69, active=60, idle=9, waiting=0)
[2024-10-14 10:48:48,992] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=69, active=60, idle=9, waiting=0)
[2024-10-14 10:49:18,992] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=71, active=64, idle=7, waiting=0)
[2024-10-14 10:49:18,992] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=71, active=64, idle=7, waiting=0)
[2024-10-14 10:49:48,993] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=74, active=70, idle=4, waiting=0)
[2024-10-14 10:49:48,993] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=74, active=70, idle=4, waiting=0)
[2024-10-14 10:50:18,993] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=80, active=71, idle=9, waiting=0)
[2024-10-14 10:50:18,993] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=80, active=71, idle=9, waiting=0)
[2024-10-14 10:50:48,994] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=81, active=70, idle=11, waiting=0)
[2024-10-14 10:50:48,995] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=80, active=70, idle=10, waiting=0)
[2024-10-14 10:51:18,995] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=81, active=73, idle=8, waiting=0)
[2024-10-14 10:51:18,995] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=81, active=73, idle=8, waiting=0)
[2024-10-14 10:51:48,996] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=83, active=76, idle=7, waiting=0)
[2024-10-14 10:51:48,996] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=83, active=76, idle=7, waiting=0)
[2024-10-14 10:52:18,997] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=87, active=79, idle=8, waiting=0)
[2024-10-14 10:52:18,997] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=87, active=79, idle=8, waiting=0)
[2024-10-14 10:52:48,998] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=89, active=81, idle=8, waiting=0)
[2024-10-14 10:52:48,998] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=89, active=81, idle=8, waiting=0)
[2024-10-14 10:53:49,004] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=93, active=81, idle=12, waiting=0)
[2024-10-14 10:53:49,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=91, active=81, idle=10, waiting=0)
[2024-10-14 10:54:19,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=96, active=86, idle=10, waiting=0)
[2024-10-14 10:54:19,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=96, active=86, idle=10, waiting=0)
[2024-10-14 10:54:49,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=97, active=88, idle=9, waiting=0)
[2024-10-14 10:54:49,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=97, active=88, idle=9, waiting=0)
[2024-10-14 10:55:19,005] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=102, active=93, idle=9, waiting=0)
[2024-10-14 10:55:19,006] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=102, active=93, idle=9, waiting=0)
[2024-10-14 10:55:49,006] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=103, active=94, idle=9, waiting=0)
[2024-10-14 10:55:49,006] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=103, active=94, idle=9, waiting=0)
[2024-10-14 10:56:19,007] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=108, active=107, idle=1, waiting=0)
[2024-10-14 10:56:19,007] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=108, active=107, idle=1, waiting=0)
[2024-10-14 10:56:49,007] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=117, active=112, idle=5, waiting=0)
[2024-10-14 10:56:49,007] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=117, active=112, idle=5, waiting=0)
[2024-10-14 10:57:19,028] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=123, active=115, idle=8, waiting=0)
[2024-10-14 10:57:19,029] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=123, active=115, idle=8, waiting=0)
[2024-10-14 10:57:49,029] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=126, active=117, idle=9, waiting=0)
[2024-10-14 10:57:49,029] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=126, active=117, idle=9, waiting=0)
[2024-10-14 10:58:19,030] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=129, active=127, idle=2, waiting=0)
[2024-10-14 10:58:19,030] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=129, active=127, idle=2, waiting=0)
[2024-10-14 10:58:49,030] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=136, active=133, idle=3, waiting=0)
[2024-10-14 10:58:49,030] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=136, active=133, idle=3, waiting=0)
[2024-10-14 10:59:19,031] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=150, active=149, idle=1, waiting=0)
[2024-10-14 10:59:19,031] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=150, active=149, idle=1, waiting=0)
[2024-10-14 10:59:49,031] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=150, active=150, idle=0, waiting=22)
[2024-10-14 10:59:49,031] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=150, active=150, idle=0, waiting=22)
[2024-10-14 11:00:19,032] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - Before cleanup stats (total=150, active=150, idle=0, waiting=55)
[2024-10-14 11:00:19,032] [DEBUG] [com.zaxxer.hikari.pool.HikariPool] [DatasourceHikariPool housekeeper] DatasourceHikariPool - After cleanup stats (total=150, active=150, idle=0, waiting=55)
生长发生超过 15 分钟。但这并没有告诉我泄漏是从哪里来的。有没有办法找出哪个特定的 SQL 查询需要新连接?
应用程序负载很高,请求很多。我使用Hibernate,很多方法都是
@Transactional
,但是Hibernate事务和池连接之间没有直接的对应关系,很多都是在Hibernate的底层完成的。
你能包装你的“获取连接”和“返回连接”逻辑吗?
ScheduledFuture.cancel()
这应该突出显示问题的原因