본문으로 건너뛰기
cccskills
무료GitHub에 공개

arthas-cpu-high

Investigate high CPU usage in Java applications with Arthas. Identify busy threads, inspect method call paths, and produce an evidence-based diagnosis with specific methods to examine next.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

排查 JVM / 应用 CPU 飙高(线程定位 + 代码路径分析)

설치 방법 보기

이럴 때 유용합니다

  • Investigating sudden CPU spikes in Java applications
  • Finding busy threads behind slow application responses
  • Narrowing down methods for further tracing
  • Preparing a diagnosis with supporting evidence

포함된 파일(1)

  • SKILL.md1.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

JVM CPU 飙高排查指南(Arthas)

适用场景:机器 CPU 飙高、应用响应变慢、负载异常升高。

原则:先用低风险工具定位「哪个线程在忙」,再逐步缩小到「哪个方法/代码路径」。

1) 先确认当前 JVM 整体状态(低风险)

  • 使用 dashboard 查看 CPU/线程/GC 概况(建议设置有限次数):
    • 关注:CPU、线程数、GC 次数/耗时是否异常。

2) 定位最忙线程(关键步骤)

  • 使用 thread 找出最忙的前 N 个线程并打印堆栈:
    • 例如:topN=3 或 topN=5
  • 记录每个热点线程的 threadId 与堆栈关键方法名(可用 take_notes 记录证据)。

判断方向:

  • 如果堆栈显示在 java.util.regex、JSON 序列化、日志格式化等:可能是 CPU 密集计算。
  • 如果堆栈显示在锁竞争:继续看是否有大量 BLOCKED,并考虑用 thread(blocking=true) 找出阻塞源头线程。

3) 进一步确认热点方法的调用路径(按需、有限制)

当热点线程堆栈指向某个「可疑方法」时:

  • 优先使用 stack / trace 针对该方法做路径确认(避免宽泛匹配)。
  • 如果需要观测入参/返回值,再考虑 watch 或 tt,并设置合理的执行次数与超时,避免对线上造成压力。

4) 输出诊断结论

报告至少包含:

  • 现象与证据:dashboard 摘要 + topN 线程堆栈关键片段
  • 初步结论:CPU 主要消耗在什么类型的逻辑(计算/锁/GC/日志等)
  • 下一步:建议进一步 trace/watch 的目标方法(给出类名+方法名的精确范围),或建议用户提供主包名/关键接口信息以继续收敛

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

arthas

무료

Diagnose running Java applications with Arthas. Follow guides for high CPU usage, retrieving EagleEye request tracking IDs, and inspecting Spring configuration and managed objects, then summarize evidence and next steps.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Diagnosing high CPU usage in Java applications
  • Retrieving EagleEye traceId values to find related logs
  • Checking Spring configuration values and their sources
alibaba/arthas3.8만2026년 10월 9일 업데이트

Retrieve an EagleEye traceId, an identifier linking a request across logs, using Arthas without changing application code. Observe request-handling methods, capture parameters when needed, and inspect method calls and timings to investigate problems.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Retrieving a request's traceId without code changes
  • Matching request parameters with related logs
  • Inspecting method calls and execution times
alibaba/arthas3.8만2026년 10월 9일 업데이트

Investigate Spring configuration and Beans, the objects Spring manages, using Arthas. Check configuration sources, find registered objects by name or type, and inspect registration details while prioritizing read-only queries.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking configuration values and where they came from
  • Investigating a Bean that appears to be missing
  • Finding candidate implementations for dependency injection
alibaba/arthas3.8만2026년 10월 9일 업데이트

alibaba의 스킬 모두 보기

이 스킬의 문제 신고