想请教下老师,一般线上服务服务过高是需要立即处理的(比如重启服务),这就有两个问题:
如果按jstack pid 导出线程信息和top -p pid -H得到对应的top 线程,其实是需要一定的时间的,这块有没有好的建议(比如写一个脚本自动导出)
一般负载过高时, 是无法直接通过 jstack pid 导出的,使用 jstack -F pid 在线导出一般也比较费时,不知道老师在定位真实线上问题是如何处理的
另外的通过导出的日志发现 可能是连接池 连接数据库有问题,但给的日志不足让我定位最终问题,麻烦帮忙看一下,日志如下(这个如果超出课堂内容请忽略)
"Druid-ConnectionPool-Destory-111334340" #68 daemon prio=5 os_prio=0 tid=0x00007f9d44033800 nid=0x561f waiting on condition [0x00007f9e7d74a000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:1724)
"Druid-ConnectionPool-Create-111334340" #67 daemon prio=5 os_prio=0 tid=0x00007f9d44032000 nid=0x561e waiting on condition [0x00007f9e7d84b000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000081efe6f8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1629)
"Druid-ConnectionPool-Destory-1729433994" #66 daemon prio=5 os_prio=0 tid=0x00007f9d44030000 nid=0x561d waiting on condition [0x00007f9e7d94c000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:1724)
"Druid-ConnectionPool-Create-1729433994" #65 daemon prio=5 os_prio=0 tid=0x00007f9d44017000 nid=0x561c waiting on condition [0x00007f9e7da4d000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000082176820> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1629)