美文网首页程序员Java
记一次druid连接池占满问题排查

记一次druid连接池占满问题排查

作者: pq217 | 来源:发表于2022-04-13 18:18 被阅读0次

现象

1.所有与数据库操作有关的功能停止,超时
2.没有错误日志

开启druid监控

spring:
  datasource:
    url: xxx
    username: xxx
    password: xxx
    druid:
      stat-view-servlet:
        enabled: true #开启
        login-username: admin #账号
        login-password: admin #密码

开启之后,再程序对应的端口号,比如8008

访问

http://localhost:8008/druid

如果配置context-path还要加在路径上

mysql端主要指标

  • 活跃连接数
  • 池中连接数
  • 最大连接数

mysql端查看

查看所有连接数
show status like 'Threads%'
show status like 'Threads%'

Threads_connected是当前数据库连接数
Threads_running这个数值指的是激活的连接数,这个数值一般远低于connected数值

查看所有连接
show full processlist; 
show full processlist
查看最大连接数
show variables like '%max_connections%';
max_connections最大连接数

max_connections为最大连接数

修改最大连接数
set GLOBAL max_connections=1000

相关文章

网友评论

    本文标题:记一次druid连接池占满问题排查

    本文链接:https://www.haomeiwen.com/subject/bgiasrtx.html