IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> PHP知识库 -> JVM监控及诊断工具GUI篇之Arthas(二):jvm相关指令 -> 正文阅读

[PHP知识库]JVM监控及诊断工具GUI篇之Arthas(二):jvm相关指令

目录

一、Arthas jvm相关指令之dashboard

二、Arthas jvm相关指令之thread

三、Arthas jvm相关指令之jvm

四、Arthas jvm相关指令之sysprop

五、Arthas jvm相关指令之sysenv

六、Arthas jvm相关指令之vmoption

七、Arthas jvm相关指令之其他指令


一、Arthas jvm相关指令之dashboard

  • dashboard :展示当前系统的实时数据面板,按 ctrl+c 退出。当运行在Ali-tomcat时,会显示当前tomcat的实时信息,如HTTP请求的qps, rt, 错误数, 线程池信息等等。

参数说明:

参数名称

参数说明

[i:]

刷新实时数据的时间间隔 (ms),默认5000ms

[n:]

刷新实时数据的次数

使用参考:

[arthas@14476]$ dashboard
ID   NAME                          GROUP          PRIORITY  STATE    %CPU      DELTA_TIM TIME      INTERRUPT DAEMON
-1   C1 CompilerThread3            -              -1        -        0.0       0.000     0:0.953   false     true
-1   C2 CompilerThread1            -              -1        -        0.0       0.000     0:0.781   false     true
-1   C2 CompilerThread2            -              -1        -        0.0       0.000     0:0.484   false     true
-1   C2 CompilerThread0            -              -1        -        0.0       0.000     0:0.406   false     true
1    main                          main           5         TIMED_WA 0.0       0.000     0:0.359   false     false
23   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.296   false     true
5    Attach Listener               system         5         RUNNABLE 0.0       0.000     0:0.078   false     true
16   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.062   false     true
-1   GC task thread#0 (ParallelGC) -              -1        -        0.0       0.000     0:0.062   false     true
-1   VM Thread                     -              -1        -        0.0       0.000     0:0.062   false     true
-1   GC task thread#3 (ParallelGC) -              -1        -        0.0       0.000     0:0.062   false     true
Memory                    used    total    max     usage    GC
heap                      39M     95M      95M     40.92%   gc.ps_scavenge.count          5
ps_eden_space             7M      24M      25M     29.12%   gc.ps_scavenge.time(ms)       40
ps_survivor_space         0K      4096K    4096K   0.00%    gc.ps_marksweep.count         1
ps_old_gen                31M     67M      67M     47.45%   gc.ps_marksweep.time(ms)      51
nonheap                   28M     29M      -1      97.37%
code_cache                5M      5M       240M    2.31%
metaspace                 20M     21M      -1      97.53%
compressed_class_space    2M      2M       1024M   0.25%
Runtime
os.name                                                     Windows 10
os.version                                                  10.0
java.version                                                1.8.0_291
java.home                                                   C:\Program Files\Java\jdk1.8.0_291\jre
systemload.average                                          -1.00
processors                                                  12
timestamp/uptime                                            Fri Sep 17 20:58:42 CST 2021/97s

-i:指定刷新实时数据的时间间隔

数据说明:

  • ID: Java级别的线程ID,注意这个ID不能跟jstack中的nativeID一一对应;
  • NAME: 线程名;
  • GROUP: 线程组名;
  • PRIORITY: 线程优先级, 1~10之间的数字,越大表示优先级越高;
  • STATE: 线程的状态;
  • CPU%: 线程的cpu使用率。比如采样间隔1000ms,某个线程的增量cpu时间为100ms,则cpu使用率=100/1000=10%;
  • DELTA_TIME: 上次采样之后线程运行增量CPU时间,数据格式为秒;
  • TIME: 线程运行总CPU时间,数据格式为分:秒;
  • INTERRUPTED: 线程当前的中断位状态;
  • DAEMON:是否是daemon线程;

二、Arthas jvm相关指令之thread

thread指令:查看当前线程信息,查看线程的堆栈

参数说明:

参数名称

参数说明

id

线程id

[n:]

指定最忙的前N个线程并打印堆栈

[b]

找出当前阻塞其他线程的线程

[i?<value>]

指定cpu使用率统计的采样间隔,单位为毫秒,默认值为200

[--all]

显示所有匹配的线程

使用参考:

thread:当没有参数时,显示第一页线程的信息,默认按照CPU增量时间降序排列,只显示第一页数据。

[arthas@18544]$ thread
Threads Total: 32, NEW: 0, RUNNABLE: 8, BLOCKED: 0, WAITING: 4, TIMED_WAITING: 3, TERMINATED: 0, Internal threads: 17
ID   NAME                          GROUP          PRIORITY  STATE    %CPU      DELTA_TIM TIME      INTERRUPT DAEMON
2    Reference Handler             system         10        WAITING  0.0       0.000     0:0.000   false     true
3    Finalizer                     system         8         WAITING  0.0       0.000     0:0.000   false     true
4    Signal Dispatcher             system         9         RUNNABLE 0.0       0.000     0:0.000   false     true
5    Attach Listener               system         5         RUNNABLE 0.0       0.000     0:0.078   false     true
13   arthas-timer                  system         5         WAITING  0.0       0.000     0:0.000   false     true
16   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.031   false     true
17   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.015   false     true
18   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.000   false     true
19   arthas-shell-server           system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
20   arthas-session-manager        system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
21   arthas-UserStat               system         5         WAITING  0.0       0.000     0:0.000   false     true
23   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.156   false     true
24   arthas-command-execute        system         5         RUNNABLE 0.0       0.000     0:0.031   false     true
1    main                          main           5         TIMED_WA 0.0       0.000     0:0.437   false     false
6    Monitor Ctrl-Break            main           5         RUNNABLE 0.0       0.000     0:0.062   false     true
-1   C2 CompilerThread2            -              -1        -        0.0       0.000     0:0.421   false     true
-1   GC task thread#8 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#7 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#6 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   VM Periodic Task Thread       -              -1        -        0.0       0.000     0:0.000   false     true
-1   GC task thread#0 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   C2 CompilerThread0            -              -1        -        0.0       0.000     0:0.468   false     true
-1   Service Thread                -              -1        -        0.0       0.000     0:0.000   false     true
-1   C2 CompilerThread1            -              -1        -        0.0       0.000     0:0.546   false     true
-1   GC task thread#9 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#1 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   C1 CompilerThread3            -              -1        -        0.0       0.000     0:0.937   false     true

?thread –all:显示所有匹配的线程,显示所有匹配线程信息,有时需要获取全部JVM的线程数据进行分析。?

[arthas@18544]$ thread -all
Threads Total: 32, NEW: 0, RUNNABLE: 8, BLOCKED: 0, WAITING: 4, TIMED_WAITING: 3, TERMINATED: 0, Internal threads: 17
ID   NAME                          GROUP          PRIORITY  STATE    %CPU      DELTA_TIM TIME      INTERRUPT DAEMON
2    Reference Handler             system         10        WAITING  0.0       0.000     0:0.000   false     true
3    Finalizer                     system         8         WAITING  0.0       0.000     0:0.000   false     true
4    Signal Dispatcher             system         9         RUNNABLE 0.0       0.000     0:0.000   false     true
5    Attach Listener               system         5         RUNNABLE 0.0       0.000     0:0.078   false     true
13   arthas-timer                  system         5         WAITING  0.0       0.000     0:0.000   false     true
16   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.031   false     true
17   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.015   false     true
18   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.000   false     true
19   arthas-shell-server           system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
20   arthas-session-manager        system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
21   arthas-UserStat               system         5         WAITING  0.0       0.000     0:0.000   false     true
23   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.234   false     true
24   arthas-command-execute        system         5         RUNNABLE 0.0       0.000     0:0.062   false     true
1    main                          main           5         TIMED_WA 0.0       0.000     0:0.437   false     false
6    Monitor Ctrl-Break            main           5         RUNNABLE 0.0       0.000     0:0.062   false     true
-1   C2 CompilerThread2            -              -1        -        0.0       0.000     0:0.437   false     true
-1   GC task thread#8 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#7 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#6 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   VM Periodic Task Thread       -              -1        -        0.0       0.000     0:0.000   false     true
-1   GC task thread#0 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   C2 CompilerThread0            -              -1        -        0.0       0.000     0:0.468   false     true
-1   Service Thread                -              -1        -        0.0       0.000     0:0.000   false     true
-1   C2 CompilerThread1            -              -1        -        0.0       0.000     0:0.546   false     true
-1   GC task thread#9 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#1 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   C1 CompilerThread3            -              -1        -        0.0       0.000     0:1.062   false     true
-1   VM Thread                     -              -1        -        0.0       0.000     0:0.046   false     true
-1   GC task thread#2 (ParallelGC) -              -1        -        0.0       0.000     0:0.031   false     true
-1   GC task thread#3 (ParallelGC) -              -1        -        0.0       0.000     0:0.031   false     true
-1   GC task thread#5 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#4 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true

thread id:显示指定线程的运行堆栈

[arthas@18544]$ thread 2
"Reference Handler" Id=2 WAITING on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Native Method)
    -  waiting on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Object.java:502)
    at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

thread -b:找出当前阻塞其他线程的线程

有时候我们发现应用卡住了, 通常是由于某个线程拿住了某个锁, 并且其他线程都在等待这把锁造成的。 为了排查这类问题, arthas提供了thread -b, 一键找出那个罪魁祸首。

使用示例:

[arthas@13048]$ thread -b
"Thread-A" Id=12 BLOCKED on java.lang.Object@60533fa9 owned by "Thread-B" Id=13
    at com.wsh.DeadLockTest.lambda$main$0(DeadLockTest.java:16)
    -  blocked on java.lang.Object@60533fa9
    -  locked java.lang.Object@3e26b034 <---- but blocks 1 other threads!
    at com.wsh.DeadLockTest$$Lambda$1/1066516207.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:748)

注意, 目前只支持找出synchronized关键字阻塞住的线程, 如果是java.util.concurrent.Lock, 目前还不支持。(本文使用的Arthad版本:3.5.4)

thread -n xx:展示当前最忙(CPU占用率前N位)的前N个线程并打印堆栈

[arthas@18544]$ thread -n 3
"Reference Handler" Id=2 cpuUsage=0.0% deltaTime=0ms time=15ms WAITING on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Native Method)
    -  waiting on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Object.java:502)
    at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)


"Finalizer" Id=3 cpuUsage=0.0% deltaTime=0ms time=15ms WAITING on java.lang.ref.ReferenceQueue$Lock@7dadc120
    at java.lang.Object.wait(Native Method)
    -  waiting on java.lang.ref.ReferenceQueue$Lock@7dadc120
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)


"Signal Dispatcher" Id=4 cpuUsage=0.0% deltaTime=0ms time=0ms RUNNABLE

?字段说明:

  • 没有线程ID,包含[Internal]表示为JVM内部线程,参考dashboard命令的介绍。
  • cpuUsage为采样间隔时间内线程的CPU使用率,与dashboard命令的数据一致。
  • deltaTime为采样间隔时间内线程的增量CPU时间,小于1ms时被取整显示为0ms。
  • time?线程运行总CPU时间。

thread -i:指定采样时间间隔

  • thread -i 1000?: 统计最近1000ms内的线程CPU时间。
  • thread -n 3 -i 1000?: 列出1000ms内最忙的3个线程栈。
[arthas@18544]$ thread -n 3
"Reference Handler" Id=2 cpuUsage=0.0% deltaTime=0ms time=15ms WAITING on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Native Method)

[arthas@18544]$ thread -i 1000
Threads Total: 32, NEW: 0, RUNNABLE: 8, BLOCKED: 0, WAITING: 4, TIMED_WAITING: 3, TERMINATED: 0, Internal threads: 17
ID   NAME                          GROUP          PRIORITY  STATE    %CPU      DELTA_TIM TIME      INTERRUPT DAEMON
2    Reference Handler             system         10        WAITING  0.0       0.000     0:0.015   false     true
3    Finalizer                     system         8         WAITING  0.0       0.000     0:0.015   false     true
4    Signal Dispatcher             system         9         RUNNABLE 0.0       0.000     0:0.000   false     true
5    Attach Listener               system         5         RUNNABLE 0.0       0.000     0:0.078   false     true
13   arthas-timer                  system         5         WAITING  0.0       0.000     0:0.000   false     true
16   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.031   false     true
17   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.015   false     true
18   arthas-NettyWebsocketTtyBoots system         5         RUNNABLE 0.0       0.000     0:0.000   false     true
19   arthas-shell-server           system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
20   arthas-session-manager        system         5         TIMED_WA 0.0       0.000     0:0.000   false     true
21   arthas-UserStat               system         5         WAITING  0.0       0.000     0:0.000   false     true
23   arthas-NettyHttpTelnetBootstr system         5         RUNNABLE 0.0       0.000     0:0.375   false     true
24   arthas-command-execute        system         5         RUNNABLE 0.0       0.000     0:0.109   false     true
1    main                          main           5         TIMED_WA 0.0       0.000     0:0.437   false     false
6    Monitor Ctrl-Break            main           5         RUNNABLE 0.0       0.000     0:0.062   false     true
-1   C2 CompilerThread2            -              -1        -        0.0       0.000     0:0.437   false     true
-1   GC task thread#8 (ParallelGC) -              -1        -        0.0       0.000     0:0.046   false     true
-1   GC task thread#7 (ParallelGC) -              -1        -        0.0       0.000     0:0.031   false     true
-1   GC task thread#6 (ParallelGC) -              -1        -        0.0       0.000     0:0.046   false     true
-1   VM Periodic Task Thread       -              -1        -        0.0       0.000     0:0.000   false     true
-1   GC task thread#0 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   C2 CompilerThread0            -              -1        -        0.0       0.000     0:0.484   false     true
-1   Service Thread                -              -1        -        0.0       0.000     0:0.000   false     true
-1   C2 CompilerThread1            -              -1        -        0.0       0.000     0:0.546   false     true
-1   GC task thread#9 (ParallelGC) -              -1        -        0.0       0.000     0:0.015   false     true
-1   GC task thread#1 (ParallelGC) -              -1        -        0.0       0.000     0:0.031   false     true
-1   C1 CompilerThread3            -              -1        -        0.0       0.000     0:1.171   false     true
[arthas@18544]$ thread -n 3 -i 1000
"Reference Handler" Id=2 cpuUsage=0.0% deltaTime=0ms time=15ms WAITING on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Native Method)
    -  waiting on java.lang.ref.Reference$Lock@1e129935
    at java.lang.Object.wait(Object.java:502)
    at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)


"Finalizer" Id=3 cpuUsage=0.0% deltaTime=0ms time=15ms WAITING on java.lang.ref.ReferenceQueue$Lock@7dadc120
    at java.lang.Object.wait(Native Method)
    -  waiting on java.lang.ref.ReferenceQueue$Lock@7dadc120
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)


"Signal Dispatcher" Id=4 cpuUsage=0.0% deltaTime=0ms time=0ms RUNNABLE

thread --state :查看指定状态的线程

[arthas@13048]$ thread --state BLOCKED
Threads Total: 17, NEW: 0, RUNNABLE: 9, BLOCKED: 2, WAITING: 4, TIMED_WAITING: 2, TERMINATED: 0
ID   NAME                          GROUP          PRIORITY  STATE    %CPU      DELTA_TIM TIME      INTERRUPT DAEMON
12   Thread-A                      main           5         BLOCKED  0.0       0.000     0:0.000   false     false
13   Thread-B                      main           5         BLOCKED  0.0       0.000     0:0.000   false     false

三、Arthas jvm相关指令之jvm

jvm :查看当前JVM的信息

四、Arthas jvm相关指令之sysprop

sysprop:查看当前JVM的系统属性(System Property)

[arthas@19956]$ sysprop
 KEY                                   VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 sun.desktop                           windows
 awt.toolkit                           sun.awt.windows.WToolkit
 file.encoding.pkg                     sun.io
 java.specification.version            1.8
 sun.cpu.isalist                       amd64
 sun.jnu.encoding                      GBK
 java.class.path                       C:\Program Files\Java\jdk1.8.0_291\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_291\jre
                                       \lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\dnsns.jar;C
                                       :\Program Files\Java\jdk1.8.0_291\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_29
                                       1\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\sunec.jar;C:\
                                       Program Files\Java\jdk1.8.0_291\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\j
                                       dk1.8.0_291\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\javaws.jar
                                       ;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jf
                                       xswt.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\management-agent.jar;C:\Program Files\Java\j
                                       dk1.8.0_291\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\rt.jar;D:\workspa
                                       ce\rocketmq-demo\target\classes;D:\mvn\repository\org\springframework\boot\spring-boot-starter-web\2.3.11.RELEASE\spring-boot-starter-web-2.3.11.REL
                                       EASE.jar;D:\mvn\repository\org\springframework\boot\spring-boot-starter\2.3.11.RELEASE\spring-boot-starter-2.3.11.RELEASE.jar;D:\mvn\repository\org\
                                       springframework\boot\spring-boot\2.3.11.RELEASE\spring-boot-2.3.11.RELEASE.jar;D:\mvn\repository\org\springframework\boot\spring-boot-autoconfigure\
                                       2.3.11.RELEASE\spring-boot-autoconfigure-2.3.11.RELEASE.jar;D:\mvn\repository\org\springframework\boot\spring-boot-starter-logging\2.3.11.RELEASE\sp
                                       ring-boot-starter-logging-2.3.11.RELEASE.jar;D:\mvn\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\mvn\repository\ch\q
                                       os\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\mvn\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\m
                                       vn\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\mvn\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar
                                       ;D:\mvn\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\mvn\repository\org\yaml\snakeyaml\1.26\snakey
                                       aml-1.26.jar;D:\mvn\repository\org\springframework\boot\spring-boot-starter-json\2.3.11.RELEASE\spring-boot-starter-json-2.3.11.RELEASE.jar;D:\mvn\r
                                       epository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;D:\mvn\repository\com\fasterxml\jackson\core\jackson-annota
                                       tions\2.11.4\jackson-annotations-2.11.4.jar;D:\mvn\repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;D:\mvn\reposito
                                       ry\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;D:\mvn\repository\com\fasterxml\jackson\datatype\jac
                                       kson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;D:\mvn\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\
                                       jackson-module-parameter-names-2.11.4.jar;D:\mvn\repository\org\springframework\boot\spring-boot-starter-tomcat\2.3.11.RELEASE\spring-boot-starter-t
                                       omcat-2.3.11.RELEASE.jar;D:\mvn\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.46\tomcat-embed-core-9.0.46.jar;D:\mvn\repository\org\glass
                                       fish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\mvn\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.46\tomcat-embed-websocket-9.0.46.jar
                                       ;D:\mvn\repository\org\springframework\spring-web\5.2.15.RELEASE\spring-web-5.2.15.RELEASE.jar;D:\mvn\repository\org\springframework\spring-beans\5.
                                       2.15.RELEASE\spring-beans-5.2.15.RELEASE.jar;D:\mvn\repository\org\springframework\spring-webmvc\5.2.15.RELEASE\spring-webmvc-5.2.15.RELEASE.jar;D:\
                                       mvn\repository\org\springframework\spring-aop\5.2.15.RELEASE\spring-aop-5.2.15.RELEASE.jar;D:\mvn\repository\org\springframework\spring-context\5.2.
                                       15.RELEASE\spring-context-5.2.15.RELEASE.jar;D:\mvn\repository\org\springframework\spring-expression\5.2.15.RELEASE\spring-expression-5.2.15.RELEASE
                                       .jar;D:\mvn\repository\org\apache\rocketmq\rocketmq-client\4.8.0\rocketmq-client-4.8.0.jar;D:\mvn\repository\org\apache\rocketmq\rocketmq-common\4.8
                                       .0\rocketmq-common-4.8.0.jar;D:\mvn\repository\org\apache\rocketmq\rocketmq-remoting\4.8.0\rocketmq-remoting-4.8.0.jar;D:\mvn\repository\com\alibaba
                                       \fastjson\1.2.69\fastjson-1.2.69.jar;D:\mvn\repository\io\netty\netty-all\4.1.65.Final\netty-all-4.1.65.Final.jar;D:\mvn\repository\org\apache\rocke
                                       tmq\rocketmq-logging\4.8.0\rocketmq-logging-4.8.0.jar;D:\mvn\repository\io\netty\netty-tcnative-boringssl-static\2.0.39.Final\netty-tcnative-borings
                                       sl-static-2.0.39.Final.jar;D:\mvn\repository\commons-validator\commons-validator\1.6\commons-validator-1.6.jar;D:\mvn\repository\commons-beanutils\c
                                       ommons-beanutils\1.9.2\commons-beanutils-1.9.2.jar;D:\mvn\repository\commons-digester\commons-digester\1.8.1\commons-digester-1.8.1.jar;D:\mvn\repos
                                       itory\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\mvn\repository\commons-collections\commons-collections\3.2.2\commons-collection
                                       s-3.2.2.jar;D:\mvn\repository\org\apache\commons\commons-lang3\3.9\commons-lang3-3.9.jar;D:\mvn\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.
                                       30.jar;D:\mvn\repository\org\springframework\spring-core\5.2.15.RELEASE\spring-core-5.2.15.RELEASE.jar;D:\mvn\repository\org\springframework\spring-
                                       jcl\5.2.15.RELEASE\spring-jcl-5.2.15.RELEASE.jar;D:\mvn\repository\org\assertj\assertj-core\3.16.1\assertj-core-3.16.1.jar;D:\development\idea201803
                                       \IntelliJ IDEA 2018.3.6\lib\idea_rt.jar
 java.vm.vendor                        Oracle Corporation
 sun.arch.data.model                   64
 user.variant
 java.vendor.url                       http://java.oracle.com/
 user.timezone                         Asia/Shanghai
 visualvm.id                           885504288085200
 os.name                               Windows 10
 java.vm.specification.version         1.8
 user.country                          CN
 sun.java.launcher                     SUN_STANDARD
 sun.boot.library.path                 C:\Program Files\Java\jdk1.8.0_291\jre\bin
 sun.java.command                      com.wsh.GCTest
 sun.cpu.endian                        little
 user.home                             C:\Users\WSH
 user.language                         zh
 java.specification.vendor             Oracle Corporation
 java.home                             C:\Program Files\Java\jdk1.8.0_291\jre
 file.separator                        \
 line.separator

 java.vm.specification.vendor          Oracle Corporation
 java.specification.name               Java Platform API Specification
 java.awt.graphicsenv                  sun.awt.Win32GraphicsEnvironment
 sun.boot.class.path                   C:\Program Files\Java\jdk1.8.0_291\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_291\jre\li
                                       b\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8
                                       .0_291\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_291\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_291\jre\classes
 user.script
 sun.management.compiler               HotSpot 64-Bit Tiered Compilers
 java.runtime.version                  1.8.0_291-b10
 user.name                             weishihuai
 path.separator                        ;
 os.version                            10.0
 java.endorsed.dirs                    C:\Program Files\Java\jdk1.8.0_291\jre\lib\endorsed
 java.runtime.name                     Java(TM) SE Runtime Environment
 file.encoding                         UTF-8
 sun.nio.ch.bugLevel
 java.vm.name                          Java HotSpot(TM) 64-Bit Server VM
 java.vendor.url.bug                   http://bugreport.sun.com/bugreport/
 java.io.tmpdir                        C:\Users\WSH\AppData\Local\Temp\
 java.version                          1.8.0_291
 user.dir                              D:\workspace\rocketmq-demo
 os.arch                               amd64
 java.vm.specification.name            Java Virtual Machine Specification
 java.awt.printerjob                   sun.awt.windows.WPrinterJob
 sun.os.patch.level
 java.library.path                     C:\Program Files\Java\jdk1.8.0_291\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapa
                                       th;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files
                                       \Java\jdk1.8.0_291\bin;D:\development\apache-maven-3.5.4\bin;D:\development\git\Git\cmd;D:\development\xftp\;D:\development\xshell\;C:\Program Files
                                       \MySQL\MySQL Shell 8.0\bin\;C:\Users\WSH\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Bandizip\;D:\development\idea201803\IntelliJ IDEA 2018
                                       .3.6\bin;;D:\development\Fiddler;.
 java.vm.info                          mixed mode
 java.vendor                           Oracle Corporation
 java.vm.version                       25.291-b10
 java.ext.dirs                         C:\Program Files\Java\jdk1.8.0_291\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
 sun.io.unicode.encoding               UnicodeLittle
 java.class.version                    52.0

sysprop 参数名称:查看单个属性?

[arthas@16288]$ sysprop java.version
 KEY                     VALUE
-----------------------------------------------------------------------------------------------------------------------
 java.version            1.8.0_291

五、Arthas jvm相关指令之sysenv

sysenv:查看当前JVM的环境属性(System Environment Variables)

//查看所有环境变量
[arthas@19956]$ sysenv
 KEY                                   VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 USERDOMAIN_ROAMINGPROFILE             GZHQLAPTOP0839
 LOCALAPPDATA                          C:\Users\WSH\AppData\Local
 PROCESSOR_LEVEL                       23
 IntelliJ IDEA                         D:\development\idea201803\IntelliJ IDEA 2018.3.6\bin;
 USERDOMAIN                            GZHQLAPTOP0839
 FPS_BROWSER_APP_PROFILE_STRING        Internet Explorer
 LOGONSERVER                           \\GZHQLAPTOP0839
 JAVA_HOME                             C:\Program Files\Java\jdk1.8.0_291
 SESSIONNAME                           Console
 ALLUSERSPROFILE                       C:\ProgramData
 PROCESSOR_ARCHITECTURE                AMD64
 PSModulePath                          C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
 SystemDrive                           C:
 MAVEN_HOME                            D:\development\apache-maven-3.5.4
 OneDrive                              C:\Users\Administrator\OneDrive
 APPDATA                               C:\Users\WSH\AppData\Roaming
 ROCKETMQ_HOME                         D:\development\rocketmq\rocketmq-all-4.8.0-bin-release
 USERNAME                              weishihuai
 ProgramFiles(x86)                     C:\Program Files (x86)
 CommonProgramFiles                    C:\Program Files\Common Files
 Path                                  C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShe
                                       ll\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_291\bin;D:\development\apache-maven-3.5.4\bin;D:\development\git\Git\cmd;D:\dev
                                       elopment\xftp\;D:\development\xshell\;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\WSH\AppData\Local\Microsoft\WindowsApps;C:\Program Files\
                                       Bandizip\;D:\development\idea201803\IntelliJ IDEA 2018.3.6\bin;;D:\development\Fiddler
 FPS_BROWSER_USER_PROFILE_STRING       Default
 PATHEXT                               .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
 DriverData                            C:\Windows\System32\Drivers\DriverData
 OS                                    Windows_NT
 COMPUTERNAME                          GZHQLAPTOP0839
 PROCESSOR_REVISION                    6001
 CLASSPATH                             .;C:\Program Files\Java\jdk1.8.0_291\lib;C:\Program Files\Java\jdk1.8.0_291\lib\tools.jar
 CommonProgramW6432                    C:\Program Files\Common Files
 ComSpec                               C:\Windows\system32\cmd.exe
 ProgramData                           C:\ProgramData
 ProgramW6432                          C:\Program Files
 WXDRIVE_START_ARGS                    --wxdrive-setting=0 --disable-gpu --disable-software-rasterizer --enable-features=NetworkServiceInProcess
 HOMEPATH                              \Users\WSH
 SystemRoot                            C:\Windows
 TEMP                                  C:\Users\WSH\AppData\Local\Temp
 HOMEDRIVE                             C:
 PROCESSOR_IDENTIFIER                  AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
 USERPROFILE                           C:\Users\WSH
 TMP                                   C:\Users\WSH\AppData\Local\Temp
 CommonProgramFiles(x86)               C:\Program Files (x86)\Common Files
 ProgramFiles                          C:\Program Files
 PUBLIC                                C:\Users\Public
 NUMBER_OF_PROCESSORS                  12
 windir                                C:\Windows
 =::                                   ::\

sysenv 查看单个环境变量

[arthas@16288]$ sysenv JAVA_HOME
 KEY                     VALUE
-----------------------------------------------------------------------------------------------------------------------
 JAVA_HOME               C:\Program Files\Java\jdk1.8.0_291

六、Arthas jvm相关指令之vmoption

vmoption:查看,更新VM诊断相关的参数

//查看所有的option
[arthas@20044]$ vmoption
 KEY                                            VALUE                                          ORIGIN                                         WRITEABLE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HeapDumpBeforeFullGC                           false                                          DEFAULT                                        true
 HeapDumpAfterFullGC                            false                                          DEFAULT                                        true
 HeapDumpOnOutOfMemoryError                     true                                           VM_CREATION                                    true
 HeapDumpPath                                   d:/dumps/                                      VM_CREATION                                    true
 CMSAbortablePrecleanWaitMillis                 100                                            DEFAULT                                        true
 CMSWaitDuration                                2000                                           DEFAULT                                        true
 CMSTriggerInterval                             -1                                             DEFAULT                                        true
 PrintGC                                        false                                          DEFAULT                                        true
 PrintGCDetails                                 false                                          DEFAULT                                        true
 PrintGCDateStamps                              false                                          DEFAULT                                        true
 PrintGCTimeStamps                              false                                          DEFAULT                                        true
 PrintGCID                                      false                                          DEFAULT                                        true
 PrintClassHistogramBeforeFullGC                false                                          DEFAULT                                        true
 PrintClassHistogramAfterFullGC                 false                                          DEFAULT                                        true
 PrintClassHistogram                            false                                          DEFAULT                                        true
 MinHeapFreeRatio                               0                                              DEFAULT                                        true
 MaxHeapFreeRatio                               100                                            DEFAULT                                        true
 PrintConcurrentLocks                           false                                          DEFAULT                                        true
 UnlockCommercialFeatures                       false        

vmoption:查看指定的option?

[arthas@16288]$ vmoption PrintGC
 KEY                           VALUE                         ORIGIN                       WRITEABLE
-----------------------------------------------------------------------------------------------------------------------
 PrintGC                       false                         DEFAULT    

七、Arthas jvm相关指令之其他指令

//列出所有 Mbean 的名称
[arthas@20044]$ mbean
java.lang:type=MemoryPool,name=Metaspace
java.lang:type=MemoryPool,name=PS Old Gen
java.lang:type=GarbageCollector,name=PS Scavenge
java.lang:type=MemoryPool,name=PS Eden Space
JMImplementation:type=MBeanServerDelegate
java.lang:type=Runtime
java.lang:type=Threading
java.lang:type=OperatingSystem
java.lang:type=MemoryPool,name=Code Cache
java.nio:type=BufferPool,name=direct
java.lang:type=Compilation
java.lang:type=MemoryManager,name=CodeCacheManager
java.lang:type=MemoryPool,name=Compressed Class Space
java.lang:type=Memory
java.nio:type=BufferPool,name=mapped
java.util.logging:type=Logging
java.lang:type=MemoryPool,name=PS Survivor Space
java.lang:type=ClassLoading
java.lang:type=MemoryManager,name=Metaspace Manager
com.sun.management:type=DiagnosticCommand
java.lang:type=GarbageCollector,name=PS MarkSweep
com.sun.management:type=HotSpotDiagnostic
  • ?heapdump :dump java heap,类似jmap命令的 heap dump功能
//dump到指定文件

[arthas@19956]$ heapdump d:/test2.hprof
Dumping heap to d:/test2.hprof ...
Heap dump file created

只dump live对象:

[arthas@58205]$ heapdump --live /tmp/dump.hprof
Dumping heap to /tmp/dump.hprof...
Heap dump file created
  • vmtool:从jvm里查询对象,执行forceGc
vmtool --action forceGc

  PHP知识库 最新文章
Laravel 下实现 Google 2fa 验证
UUCTF WP
DASCTF10月 web
XAMPP任意命令执行提升权限漏洞(CVE-2020-
[GYCTF2020]Easyphp
iwebsec靶场 代码执行关卡通关笔记
多个线程同步执行,多个线程依次执行,多个
php 没事记录下常用方法 (TP5.1)
php之jwt
2021-09-18
上一篇文章      下一篇文章      查看所有文章
加:2021-09-20 15:33:56  更:2021-09-20 15:35:25 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年12日历 -2024/12/29 4:11:55-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码
数据统计