当前位置:网站首页>【help】JVM的CPU资源占用过高问题的排查
【help】JVM的CPU资源占用过高问题的排查
2022-06-27 17:58:00 【掘金者说】
JVM的CPU资源占用过高问题的排查
jstack命令格式:
jstack [ option ] pid
参数说明:
-F jstack [-l] pid无法响应时,强制打印堆栈
-l l长列表. 打印关于锁的附加信息,例如属于java.util.concurrent的ownable synchronizers列表.
-m 混合模式输出(包括java和本地c/c++片段)堆栈。
pid: java应用程序的进程号
参数是互斥的,不能联合使用。
jstack生成的Thread Dump日志结构解析
jstack -l 25440 > c:/25440.stack
2021-02-01 10:14:10
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.231-b11 mixed mode):
"MySQL Statement Cancellation Timer" #513 daemon prio=5 os_prio=0 tid=0x0000000020de0800 nid=0x2e74 in Object.wait() [0x0000000069e0f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at java.util.TimerThread.mainLoop(Timer.java:526)
- locked <0x00000006e18d6598> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:505)
Locked ownable synchronizers:
- None
"Druid-ConnectionPool-Destroy-968174377" #459 daemon prio=5 os_prio=0 tid=0x0000000020de0000 nid=0x32e8 waiting on condition [0x000000006311f000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2824)
Locked ownable synchronizers:
- None
"Druid-ConnectionPool-Create-968174377" #458 daemon prio=5 os_prio=0 tid=0x0000000020dd9000 nid=0x16e4 waiting on condition [0x000000006301f000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c3ee6cd8> (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:2728)
Locked ownable synchronizers:
- None
jstack -F PID > c:/jstack.25440.txt 查询IN_VM
进行查找相关类方法排查
Attaching to process ID 25440, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.231-b11
Deadlock Detection:
No deadlocks found.
Thread 133: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
- java.lang.Object.wait() @bci=2, line=502 (Compiled frame)
- java.util.TimerThread.mainLoop() @bci=28, line=526 (Interpreted frame)
- java.util.TimerThread.run() @bci=1, line=505 (Interpreted frame)
Thread 95: (state = BLOCKED)
- com.****.patrol.util.PatrolHelper.getRuleByTime(com.****patrol..entity.StatRule, java.time.LocalDateTime) @bci=430, line=304 (Compiled frame; information may be imprecise)
- com.****.patrol.util.PatrolHelper.getStatRule(java.util.List, java.time.LocalDateTime) @bci=51, line=226 (Compiled frame)
- com.****.service.impl.InspectServiceImpl.getCalendarData(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.time.LocalDateTime, java.time.LocalDateTime) @bci=252, line=226 (Compiled frame)
- com.****.patrol.controller.InspectController.getCalendarData(java.lang.String, java.lang.String, java.lang.String, java.time.LocalDateTime, java.time.LocalDateTime) @bci=78, line=127 (Interpreted frame)
Thread 93: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2039 (Compiled frame)
- java.util.concurrent.LinkedBlockingQueue.take() @bci=29, line=442 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=149, line=1074 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=26, line=1134 (Interpreted frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=624 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=748 (Interpreted frame)
Thread 92: (state = IN_VM)
- com.****.patrol.util.PatrolHelper.getRuleByTime(com.****.patrol.entity.StatRule, java.time.LocalDateTime) @bci=430, line=304 (Compiled frame; information may be imprecise)
- com.****.patrol.util.PatrolHelper.getStatRule(java.util.List, java.time.LocalDateTime) @bci=51, line=226 (Compiled frame)
- com.****.patrol.service.impl.InspectServiceImpl.getCalendarData(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.time.LocalDateTime, java.time.LocalDateTime) @bci=252, line=226 (Compiled frame)
- com.****.patrol.controller.InspectController.getCalendarData(java.lang.String, java.lang.String, java.lang.String, java.time.LocalDateTime, java.time.LocalDateTime) @bci=78, line=127 (Interpreted frame)
查找com.****.patrol.service.impl.InspectServiceImpl.getCalendarData
方法进行排查…
附件参考
参考 Java内存泄漏分析系列之二:jstack生成的Thread Dump日志结构解析
参考 JVM故障分析及性能优化系列
参考 ThreadDump: How to see the condition of waiting / or any other condition?
参考 JVM的CPU资源占用过高问题的排查
参考 Java CPU占用过高问题排查,windows和Linux
边栏推荐
- 什么是SSR/SSG/ISR?如何在AWS上托管它们?
- 谈谈线程安全
- 基于STM32F103ZET6库函数蜂鸣器实验
- 你知道 log4j2 各项配置的全部含义吗?带你了解 log4j2 的全部组件
- 驾驭一切的垃圾收集器 -- G1
- International School of Digital Economics, South China Institute of technology 𞓜 unified Bert for few shot natural language understanding
- Leetcode 1381. 设计一个支持增量操作的栈
- 工作流自动化 低代码是关键
- 使用MySqlBulkLoader批量插入数据
- 1023 Have Fun with Numbers
猜你喜欢
《第五项修炼》(The Fifth Discipline):学习型组织的艺术与实践
crontab的学习随笔
数仓的字符截取三胞胎:substrb、substr、substring
如何利用 RPA 实现自动化获客?
GIS遥感R语言学习看这里
Bit. Store: long bear market, stable stacking products may become the main theme
C# 二维码生成、识别,去除白边、任意颜色
Don't worry. This is the truth about wages in all industries in China
基于STM32F103ZET6库函数按键输入实验
MySQL初学者福利
随机推荐
1025 PAT Ranking
如何利用 RPA 实现自动化获客?
工作流自动化 低代码是关键
How to encapsulate and call a library
惊呆!原来 markdown 的画图功能如此强大!
ABAP-CL_OBJECT_COLLECTION工具类
海底电缆探测技术总结
Function key input experiment based on stm32f103zet6 Library
基于STM32F103ZET6库函数蜂鸣器实验
ABAP随笔-EXCEL-3-批量导入(突破标准函数的9999行)
华大单片机KEIL报错_WEAK的解决方案
“我让这个世界更酷”2022华清远见研发产品发布会圆满成功
ABAP随笔-通过api获取新冠数据
教你打印自己的日志 -- 如何自定义 log4j2 各组件
云笔记到底哪家强 -- 教你搭建自己的网盘服务器
Gartner聚焦中国低代码发展 UniPro如何践行“差异化”
网络传输是怎么工作的 -- 详解 OSI 模型
刷题笔记-树(Easy)-更新中
Is it safe to buy stocks and open an account on the account opening link of the securities manager? Ask the great God for help
華大單片機KEIL報錯_WEAK的解决方案