jvm调试

环境准备

docker创建调试环境
docker run --name framegc -h framegc -d --restart=always --privileged  -e TZ='Asia/Shanghai' -p 10011:10011 -p 10002:10002 -p 10012:10012 -p 10001:10001  registry.cn-beijing.aliyuncs.com/king019/frame:gc

登录后执行

source /etc/profile
cd /opt/soft/version/aliyun/ali_fw_frame/fw_frame/frame_jvm/frame_jvm_gc/frame_jvm_gc_g1
git pull
sh ./start.txt 

启动jvm  g1垃圾回收器运行环境

命令总结

jps

[root@framegc frame_jvm_gc_g1]# jps -h
usage: jps [--help]
       jps [-q] [-mlvV] [<hostid>]

Definitions:
    <hostid>:      <hostname>[:<port>]
    -? -h --help -help: Print this help message and exit.


[root@framegc frame_jvm_gc_g1]# jps -v
337 Jps -Dapplication.home=/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-2.el8_6.x86_64 -Xms8m -Djdk.module.main=jdk.jcmd
270 SpringRunG1 -Xms64m -Xmx64m -Xss1m -XX:MaxDirectMemorySize=10m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -Xlog:gc*:./gc/gc.log -XX:+PrintSafepointStatistics -XX:NativeMemoryTracking=detail -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=19001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1

jstat

Usage: jstat --help|-options
       jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]

Definitions:
  <option>      An option reported by the -options option
  <vmid>        Virtual Machine Identifier. A vmid takes the following form:
                     <lvmid>[@<hostname>[:<port>]]
                Where <lvmid> is the local vm identifier for the target
                Java virtual machine, typically a process id; <hostname> is
                the name of the host running the target Java virtual machine;
                and <port> is the port number for the rmiregistry on the
                target host. See the jvmstat documentation for a more complete
                description of the Virtual Machine Identifier.
  <lines>       Number of samples between header lines.
  <interval>    Sampling interval. The following forms are allowed:
                    <n>["ms"|"s"]
                Where <n> is an integer and the suffix specifies the units as 
                milliseconds("ms") or seconds("s"). The default units are "ms".
  <count>       Number of samples to take before terminating.
  -J<flag>      Pass <flag> directly to the runtime system.
  -? -h --help  Prints this help message.
  -help         Prints this help message.

[root@framegc frame_jvm_gc_g1]# jstat -options
-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation
[root@framegc frame_jvm_gc_g1]# jstat -class  270
Loaded  Bytes  Unloaded  Bytes     Time   
  7262 13643.9        0     0.0       2.20
[root@framegc frame_jvm_gc_g1]# jstat -compiler 270
Compiled Failed Invalid   Time   FailedType FailedMethod
    3248      0       0     5.38          0             
[root@framegc frame_jvm_gc_g1]# jstat -gc 270
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT   
 0.0   5120.0  0.0   5120.0 34816.0   7168.0   25600.0     7835.6   33456.0 32076.4 4608.0 4056.0      6    0.062   0      0.000   4      0.008    0.069
[root@framegc frame_jvm_gc_g1]# jstat -gccapacity 270
 NGCMN    NGCMX     NGC     S0C   S1C       EC      OGCMN      OGCMX       OGC         OC       MCMN     MCMX      MC     CCSMN    CCSMX     CCSC    YGC    FGC   CGC 
     0.0  65536.0  39936.0    0.0 5120.0  34816.0        0.0    65536.0    25600.0    25600.0      0.0 1079296.0  33456.0      0.0 1048576.0   4608.0      6     0     4
[root@framegc frame_jvm_gc_g1]# jstat -gccause 270
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT    LGCC                 GCC                 
  0.00 100.00  20.59  30.61  95.88  88.02      6    0.062     0    0.000     4    0.008    0.069 G1 Evacuation Pause  No GC               
[root@framegc frame_jvm_gc_g1]# jstat -gcmetacapacity 270
   MCMN       MCMX        MC       CCSMN      CCSMX       CCSC     YGC   FGC    FGCT    CGC    CGCT     GCT   
       0.0  1079296.0    33456.0        0.0  1048576.0     4608.0     6     0    0.000     4    0.008    0.069
[root@framegc frame_jvm_gc_g1]# jstat -gcnew 270
 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT  
   0.0 5120.0    0.0 5120.0  2  15 2560.0  34816.0   7168.0      6    0.062
[root@framegc frame_jvm_gc_g1]# jstat -gcnewcapacity 270
  NGCMN      NGCMX       NGC      S0CMX     S0C     S1CMX     S1C       ECMX        EC      YGC   FGC   CGC 
       0.0    65536.0    39936.0      0.0      0.0  65536.0   5120.0    65536.0    34816.0     6     0     4
[root@framegc frame_jvm_gc_g1]# jstat -gcold 270
   MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT    CGC    CGCT     GCT   
 33456.0  32076.4   4608.0   4056.0     25600.0      7835.6      6     0    0.000     4    0.008    0.069
[root@framegc frame_jvm_gc_g1]# jstat -gcoldcapacity 270
   OGCMN       OGCMX        OGC         OC       YGC   FGC    FGCT    CGC    CGCT     GCT   
        0.0     65536.0     25600.0     25600.0     6     0    0.000     4    0.008    0.069
[root@framegc frame_jvm_gc_g1]# jstat -gcutil 270
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT   
  0.00 100.00  20.59  30.61  95.88  88.02      6    0.062     0    0.000     4    0.008    0.069
[root@framegc frame_jvm_gc_g1]# jstat -printcompilation 270
Compiled  Size  Type Method
    3248     12    1 java/util/concurrent/locks/LockSupport setBlocker

jinfo

[root@framegc frame_jvm_gc_g1]# jinfo 
Usage:
    jinfo <option> <pid>
       (to connect to a running process)

where <option> is one of:
    -flag <name>         to print the value of the named VM flag
    -flag [+|-]<name>    to enable or disable the named VM flag
    -flag <name>=<value> to set the named VM flag to the given value
    -flags               to print VM flags
    -sysprops            to print Java system properties
    <no option>          to print both VM flags and system properties
    -? | -h | --help | -help to print this help message
[root@framegc frame_jvm_gc_g1]# jinfo 270
Java System Properties:
#Thu Aug 25 23:01:51 CST 2022
awt.toolkit=sun.awt.X11.XToolkit
java.specification.version=11
sun.cpu.isalist=
sun.jnu.encoding=UTF-8
com.sun.management.jmxremote.authenticate=false
java.class.path=/opt/soft/version/aliyun/ali_fw_frame/fw_frame/frame_jvm/frame_jvm_gc/frame_jvm_gc_g1/target/classes\:/root/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.3.7.RELEASE/spring-boot-starter-web-2.3.7.RELEASE.jar\:/root/.m2/repository/org/springframework/boot/spring-boot-starter/2.3.7.RELEASE/spring-boot-starter-2.3.7.RELEASE.jar\:/root/.m2/repository/org/springframework/boot/spring-boot/2.3.7.RELEASE/spring-boot-2.3.7.RELEASE.jar\:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.3.7.RELEASE/spring-boot-autoconfigure-2.3.7.RELEASE.jar\:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar\:/root/.m2/repository/org/springframework/spring-core/5.2.12.RELEASE/spring-core-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-jcl/5.2.12.RELEASE/spring-jcl-5.2.12.RELEASE.jar\:/root/.m2/repository/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar\:/root/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.3.7.RELEASE/spring-boot-starter-json-2.3.7.RELEASE.jar\:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.3/jackson-databind-2.11.3.jar\:/root/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.3/jackson-annotations-2.11.3.jar\:/root/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.3/jackson-core-2.11.3.jar\:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.11.3/jackson-datatype-jdk8-2.11.3.jar\:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.11.3/jackson-datatype-jsr310-2.11.3.jar\:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.11.3/jackson-module-parameter-names-2.11.3.jar\:/root/.m2/repository/org/springframework/spring-web/5.2.12.RELEASE/spring-web-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-beans/5.2.12.RELEASE/spring-beans-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-webmvc/5.2.12.RELEASE/spring-webmvc-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-aop/5.2.12.RELEASE/spring-aop-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-context/5.2.12.RELEASE/spring-context-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/spring-expression/5.2.12.RELEASE/spring-expression-5.2.12.RELEASE.jar\:/root/.m2/repository/org/springframework/boot/spring-boot-starter-jetty/2.3.7.RELEASE/spring-boot-starter-jetty-2.3.7.RELEASE.jar\:/root/.m2/repository/jakarta/servlet/jakarta.servlet-api/4.0.4/jakarta.servlet-api-4.0.4.jar\:/root/.m2/repository/jakarta/websocket/jakarta.websocket-api/1.1.2/jakarta.websocket-api-1.1.2.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-servlets/9.4.35.v20201120/jetty-servlets-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-continuation/9.4.35.v20201120/jetty-continuation-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-http/9.4.35.v20201120/jetty-http-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-util/9.4.35.v20201120/jetty-util-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-io/9.4.35.v20201120/jetty-io-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.35.v20201120/jetty-webapp-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.35.v20201120/jetty-xml-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.35.v20201120/jetty-servlet-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-security/9.4.35.v20201120/jetty-security-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-server/9.4.35.v20201120/jetty-server-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-util-ajax/9.4.35.v20201120/jetty-util-ajax-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.4.35.v20201120/websocket-server-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.4.35.v20201120/websocket-common-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.4.35.v20201120/websocket-api-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.4.35.v20201120/websocket-client-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-client/9.4.35.v20201120/jetty-client-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.4.35.v20201120/websocket-servlet-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.4.35.v20201120/javax-websocket-server-impl-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-annotations/9.4.35.v20201120/jetty-annotations-9.4.35.v20201120.jar\:/root/.m2/repository/org/eclipse/jetty/jetty-plus/9.4.35.v20201120/jetty-plus-9.4.35.v20201120.jar\:/root/.m2/repository/org/ow2/asm/asm/9.0/asm-9.0.jar\:/root/.m2/repository/org/ow2/asm/asm-commons/9.0/asm-commons-9.0.jar\:/root/.m2/repository/org/ow2/asm/asm-tree/9.0/asm-tree-9.0.jar\:/root/.m2/repository/org/ow2/asm/asm-analysis/9.0/asm-analysis-9.0.jar\:/root/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.4.35.v20201120/javax-websocket-client-impl-9.4.35.v20201120.jar\:/root/.m2/repository/org/glassfish/jakarta.el/3.0.3/jakarta.el-3.0.3.jar\:/root/.m2/repository/org/projectlombok/lombok/1.18.24/lombok-1.18.24.jar\:/root/.m2/repository/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar\:/root/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar\:/root/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar\:/root/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar\:/root/.m2/repository/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar\:/root/.m2/repository/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0.jar\:/root/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar\:/root/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.17.2/log4j-slf4j-impl-2.17.2.jar\:/root/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar\:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar\:/root/.m2/repository/org/apache/logging/log4j/log4j-core/2.13.3/log4j-core-2.13.3.jar
java.vm.vendor=Red Hat, Inc.
sun.arch.data.model=64
java.vendor.url=https\://www.redhat.com/
user.timezone=Asia/Shanghai
java.vm.specification.version=11
os.name=Linux
sun.java.launcher=SUN_STANDARD
sun.boot.library.path=/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-2.el8_6.x86_64/lib
com.sun.management.jmxremote.ssl=false
sun.java.command=com.k.fram.jvm.gc.g1.SpringRunG1 --spring.application.admin.enabled\=true --spring.application.admin.jmx-name\=org.springframework.boot\:type\=Admin,name\=SpringApplication
com.sun.management.jmxremote=
jdk.debug=release
sun.cpu.endian=little
user.home=/root
user.language=en
java.specification.vendor=Oracle Corporation
java.version.date=2022-04-19
java.home=/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-2.el8_6.x86_64
file.separator=/
java.vm.compressedOopsMode=32-bit
line.separator=\n
java.specification.name=Java Platform API Specification
java.vm.specification.vendor=Oracle Corporation
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.awt.headless=true
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
java.runtime.version=11.0.15+10-LTS
user.name=root
path.separator=\:
os.version=5.4.39-linuxkit
java.runtime.name=OpenJDK Runtime Environment
file.encoding=UTF-8
spring.beaninfo.ignore=true
java.vm.name=OpenJDK 64-Bit Server VM
java.vendor.version=18.9
java.vendor.url.bug=https\://bugzilla.redhat.com/enter_bug.cgi?product\=Red%20Hat%20Enterprise%20Linux%208&component\=java-11-openjdk
jetty.git.hash=bdc54f03a5e0a7e280fab27f55c3c75ee8da89fb
java.io.tmpdir=/tmp
com.sun.management.jmxremote.port=19001
java.version=11.0.15
user.dir=/opt/soft/version/aliyun/ali_fw_frame/fw_frame/frame_jvm/frame_jvm_gc/frame_jvm_gc_g1
os.arch=amd64
java.vm.specification.name=Java Virtual Machine Specification
PID=270
java.awt.printerjob=sun.print.PSPrinterJob
sun.os.patch.level=unknown
java.library.path=/usr/java/packages/lib\:/usr/lib64\:/lib64\:/lib\:/usr/lib
java.vm.info=mixed mode, sharing
java.vendor=Red Hat, Inc.
java.vm.version=11.0.15+10-LTS
java.rmi.server.hostname=127.0.0.1
java.rmi.server.randomIDs=true
sun.io.unicode.encoding=UnicodeLittle
java.class.version=55.0

VM Flags:
-XX:CICompilerCount=3 -XX:ConcGCThreads=1 -XX:G1ConcRefinementThreads=4 -XX:G1HeapRegionSize=1048576 -XX:GCDrainStackTargetSize=64 -XX:+HeapDumpOnOutOfMemoryError -XX:InitialHeapSize=67108864 -XX:+ManagementServer -XX:MarkStackSize=4194304 -XX:MaxDirectMemorySize=10485760 -XX:MaxHeapSize=67108864 -XX:MaxNewSize=39845888 -XX:MinHeapDeltaBytes=1048576 -XX:NativeMemoryTracking=detail -XX:NonNMethodCodeHeapSize=5830732 -XX:NonProfiledCodeHeapSize=122913754 -XX:+PrintSafepointStatistics -XX:ProfiledCodeHeapSize=122913754 -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:ThreadStackSize=1024 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC 

VM Arguments:
jvm_args: -Xms64m -Xmx64m -Xss1m -XX:MaxDirectMemorySize=10m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -Xlog:gc*:./gc/gc.log -XX:+PrintSafepointStatistics -XX:NativeMemoryTracking=detail -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=19001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 
java_command: com.k.fram.jvm.gc.g1.SpringRunG1 --spring.application.admin.enabled=true --spring.application.admin.jmx-name=org.springframework.boot:type=Admin,name=SpringApplication
java_class_path (initial): /opt/soft/version/aliyun/ali_fw_frame/fw_frame/frame_jvm/frame_jvm_gc/frame_jvm_gc_g1/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.3.7.RELEASE/spring-boot-starter-web-2.3.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter/2.3.7.RELEASE/spring-boot-starter-2.3.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot/2.3.7.RELEASE/spring-boot-2.3.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.3.7.RELEASE/spring-boot-autoconfigure-2.3.7.RELEASE.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/root/.m2/repository/org/springframework/spring-core/5.2.12.RELEASE/spring-core-5.2.12.RELEASE.jar:/root/.m2/repository/org/springframework/spring-jcl/5.2.12.RELEASE/spring-jcl-5.2.12.RELEASE.jar:/root/.m2/repository/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.3.7.RELEASE/spring-boot-starter-json-2.3.7.RELEASE.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.3/jackson-databind-2.11.3.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.3/jackson-annotations-2.11.3.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.3/jackson-core-2.11.3.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.11.3/jackson-datatype-jdk8-2.11.3.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.11.3/jackson-datatype-jsr310-2.11.3.jar:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.11.3/jackson-module-parameter-names-2.11.3.jar:/root/.m2/repository/org/springframework/spring-web/5.2.12.RELEASE/spring-web-5.2.12.RELEASE.jar:/root/.m2/repository/org/springframework/spring-beans/5.2.12.RELEASE/spring-beans-5.2.12.RELEASE.jar:/root/.m2/repository/org/springframework/sprin
Launcher Type: SUN_STANDARD

jmap

[root@framegc frame_jvm_gc_g1]# jmap
Usage:
    jmap -clstats <pid>
        to connect to running process and print class loader statistics
    jmap -finalizerinfo <pid>
        to connect to running process and print information on objects awaiting finalization
    jmap -histo[:live] <pid>
        to connect to running process and print histogram of java object heap
        if the "live" suboption is specified, only count live objects
    jmap -dump:<dump-options> <pid>
        to connect to running process and dump java heap
    jmap -? -h --help
        to print this help message

    dump-options:
      live         dump only live objects; if not specified,
                   all objects in the heap are dumped.
      format=b     binary format
      file=<file>  dump heap to <file>
      parallel=<number>  parallel threads number for heap iteration:
                         parallel=0 default behavior, use predefined number of threads
                         parallel=1 disable parallel heap iteration
                         parallel=<N> use N threads for parallel heap iteration

    Example: jmap -dump:live,format=b,file=heap.bin <pid>
[root@framegc frame_jvm_gc_g1]# jmap -clstats 270
Index Super InstBytes KlassBytes annotations    CpAll MethodCount Bytecodes MethodAll    ROAll    RWAll    Total ClassName
    1    -1   4264792        504           0        0           0         0         0       24      616      640 [B
    2    15    968784        624         128    14272         109      4576     60936    20576    57128    77704 java.lang.String
    3    15    931384        680           0    22120         139      5679     79216    28040    76448   104488 java.lang.Class
    4  4269    608080       1120           0     6824          47      1117     23184     7024    25040    32064 java.lang.reflect.Method
    5    15    592288        600           0     1368           9       213      2880     1632     3592     5224 java.util.concurrent.ConcurrentHashMap$Node
    6    -1    540240        504           0        0           0         0         0       24      616      640 [Ljava.lang.Object;
    7    -1    359680        504           0        0           0         0         0       24      616      640 [I
    8    -1    317392        504           0        0           0         0         0       24      616      640 [C
    9    -1    300240        504           0        0           0         0         0       32      616      648 [Ljava.util.HashMap$Node;
   10    11    299000        592           0      512           1        10       624      312     1656     1968 java.util.LinkedHashMap$Entry
   11    15    279584        592           0     1392           7       149      1880     1200     3016     4216 java.util.HashMap$Node
   12    -1    218664        504           0        0           0         0         0       56      616      672 [Ljava.lang.Class;
   13    -1    189752        504           0        0           0         0         0       32      616      648 [Ljava.util.concurrent.ConcurrentHashMap$Node;

 7803  4784         0        552           0      312           2         5       312      208     1120     1328 sun.util.spi.CalendarProvider
             12962000    5029600       94376 13908816       71966   2937666  19783528 13652704 27558608 41211312 Total
                31.5%      12.2%        0.2%    33.7%           -      7.1%     48.0%    33.1%    66.9%   100.0%
Index Super InstBytes KlassBytes annotations    CpAll MethodCount Bytecodes MethodAll    ROAll    RWAll    Total ClassName

jstack

[root@framegc frame_jvm_gc_g1]# jstack 
Usage:
    jstack [-l][-e] <pid>
        (to connect to running process)

Options:
    -l  long listing. Prints additional information about locks
    -e  extended listing. Prints additional information about threads
    -? -h --help -help to print this help message
[root@framegc frame_jvm_gc_g1]# jstack 270
2022-08-25 23:08:01
Full thread dump OpenJDK 64-Bit Server VM (11.0.15+10-LTS mixed mode, sharing):

Threads class SMR info:
_java_thread_list=0x00007fe8c0000ba0, length=23, elements={
0x00007fe93c0da800, 0x00007fe93c0dd000, 0x00007fe93c0e5800, 0x00007fe93c0e8000,
0x00007fe93c0eb000, 0x00007fe93c0ed800, 0x00007fe93c0f0000, 0x00007fe93c102800,
0x00007fe93c4c0800, 0x00007fe93c4c7800, 0x00007fe93c4e2000, 0x00007fe8d0042000,
0x00007fe93cf77000, 0x00007fe93cf78800, 0x00007fe93cf7a000, 0x00007fe93cf7b800,
0x00007fe93cf7d800, 0x00007fe93cf7f800, 0x00007fe93cf81000, 0x00007fe93cf83000,
0x00007fe93d0a5000, 0x00007fe93c02c000, 0x00007fe8f8001000
}

"Reference Handler" #2 daemon prio=10 os_prio=0 cpu=1.75ms elapsed=1581.27s tid=0x00007fe93c0da800 nid=0x117 waiting on condition  [0x00007fe9402d8000]
   java.lang.Thread.State: RUNNABLE
    at java.lang.ref.Reference.waitForReferencePendingList(java.base@11.0.15/Native Method)
    at java.lang.ref.Reference.processPendingReferences(java.base@11.0.15/Reference.java:241)
    at java.lang.ref.Reference$ReferenceHandler.run(java.base@11.0.15/Reference.java:213)

"Finalizer" #3 daemon prio=8 os_prio=0 cpu=0.79ms elapsed=1581.26s tid=0x00007fe93c0dd000 nid=0x118 in Object.wait()  [0x00007fe9401d7000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(java.base@11.0.15/Native Method)
    - waiting on <0x00000000fc09df48> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(java.base@11.0.15/ReferenceQueue.java:155)
    - waiting to re-lock in wait() <0x00000000fc09df48> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(java.base@11.0.15/ReferenceQueue.java:176)
    at java.lang.ref.Finalizer$FinalizerThread.run(java.base@11.0.15/Finalizer.java:170)

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 cpu=0.46ms elapsed=1581.26s tid=0x00007fe93c0e5800 nid=0x119 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #5 daemon prio=9 os_prio=0 cpu=0.22ms elapsed=1581.26s tid=0x00007fe93c0e8000 nid=0x11a runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #6 daemon prio=9 os_prio=0 cpu=2324.92ms elapsed=1581.26s tid=0x00007fe93c0eb000 nid=0x11b waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C1 CompilerThread0" #8 daemon prio=9 os_prio=0 cpu=1150.64ms elapsed=1581.25s tid=0x00007fe93c0ed800 nid=0x11c waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"Sweeper thread" #9 daemon prio=9 os_prio=0 cpu=0.20ms elapsed=1581.25s tid=0x00007fe93c0f0000 nid=0x11d runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Common-Cleaner" #10 daemon prio=8 os_prio=0 cpu=4.96ms elapsed=1581.20s tid=0x00007fe93c102800 nid=0x11e in Object.wait()  [0x00007fe915bfa000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(java.base@11.0.15/Native Method)
    - waiting on <0x00000000fc0fceb0> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(java.base@11.0.15/ReferenceQueue.java:155)
    - waiting to re-lock in wait() <0x00000000fc0fceb0> (a java.lang.ref.ReferenceQueue$Lock)
    at jdk.internal.ref.CleanerImpl.run(java.base@11.0.15/CleanerImpl.java:148)
    at java.lang.Thread.run(java.base@11.0.15/Thread.java:829)
    at jdk.internal.misc.InnocuousThread.run(java.base@11.0.15/InnocuousThread.java:161)

"RMI TCP Accept-0" #12 daemon prio=5 os_prio=0 cpu=1.14ms elapsed=1580.82s tid=0x00007fe93c4c0800 nid=0x11f runnable  [0x00007fe914307000]
   java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(java.base@11.0.15/Native Method)
    at java.net.AbstractPlainSocketImpl.accept(java.base@11.0.15/AbstractPlainSocketImpl.java:474)
    at java.net.ServerSocket.implAccept(java.base@11.0.15/ServerSocket.java:565)
    at java.net.ServerSocket.accept(java.base@11.0.15/ServerSocket.java:533)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(java.rmi@11.0.15/TCPTransport.java:394)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(java.rmi@11.0.15/TCPTransport.java:366)
    at java.lang.Thread.run(java.base@11.0.15/Thread.java:829)

"DestroyJavaVM" #33 prio=5 os_prio=0 cpu=2564.06ms elapsed=1578.15s tid=0x00007fe93c02c000 nid=0x10f waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" #34 daemon prio=9 os_prio=0 cpu=17.28ms elapsed=370.46s tid=0x00007fe8f8001000 nid=0x3d4 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" os_prio=0 cpu=304.25ms elapsed=1581.28s tid=0x00007fe93c0d6800 nid=0x116 runnable  

"GC Thread#0" os_prio=0 cpu=90.21ms elapsed=1581.29s tid=0x00007fe93c050000 nid=0x111 runnable  

"GC Thread#1" os_prio=0 cpu=76.43ms elapsed=1580.65s tid=0x00007fe90c016000 nid=0x125 runnable  

"GC Thread#2" os_prio=0 cpu=42.13ms elapsed=1579.59s tid=0x00007fe90c09a000 nid=0x131 runnable  

"GC Thread#3" os_prio=0 cpu=35.23ms elapsed=1579.59s tid=0x00007fe90c09b800 nid=0x132 runnable  

"G1 Main Marker" os_prio=0 cpu=1.72ms elapsed=1581.29s tid=0x00007fe93c059000 nid=0x112 runnable  

"G1 Conc#0" os_prio=0 cpu=30.68ms elapsed=1581.29s tid=0x00007fe93c05b800 nid=0x113 runnable  

"G1 Refine#0" os_prio=0 cpu=5.33ms elapsed=1581.29s tid=0x00007fe93c0a1800 nid=0x114 runnable  

"G1 Refine#1" os_prio=0 cpu=0.46ms elapsed=1580.64s tid=0x00007fe910001000 nid=0x126 runnable  

"G1 Young RemSet Sampling" os_prio=0 cpu=667.58ms elapsed=1581.29s tid=0x00007fe93c0a3800 nid=0x115 runnable  
"VM Periodic Task Thread" os_prio=0 cpu=3388.33ms elapsed=1580.78s tid=0x00007fe93c4e5800 nid=0x123 waiting on condition  

JNI global refs: 17, weak refs: 0

jcmd

jcmd [pid | main-class] command...|PerfCounter.print| 
-f filename
[root@framegc frame_jvm_gc_g1]# jcmd
1137 jdk.jcmd/sun.tools.jcmd.JCmd
270 com.k.fram.jvm.gc.g1.SpringRunG1 --spring.application.admin.enabled=true --spring.application.admin.jmx-name=org.springframework.boot:type=Admin,name=SpringApplication
[root@framegc frame_jvm_gc_g1]# jcmd 270
270:
The following commands are available:
Compiler.CodeHeap_Analytics
Compiler.codecache
Compiler.codelist
Compiler.directives_add
Compiler.directives_clear
Compiler.directives_print
Compiler.directives_remove
Compiler.queue
GC.class_histogram
GC.class_stats
GC.finalizer_info
GC.heap_dump
GC.heap_info
GC.run
GC.run_finalization
JFR.check
JFR.configure
JFR.dump
JFR.start
JFR.stop
JVMTI.agent_load
JVMTI.data_dump
ManagementAgent.start
ManagementAgent.start_local
ManagementAgent.status
ManagementAgent.stop
Thread.print
VM.class_hierarchy
VM.classloader_stats
VM.classloaders
VM.command_line
VM.dynlibs
VM.flags
VM.info
VM.log
VM.metaspace
VM.native_memory
VM.print_touched_methods
VM.set_flag
VM.stringtable
VM.symboltable
VM.system_properties
VM.systemdictionary
VM.uptime
VM.version
help

For more information about a specific command use 'help <command>'.
jcmd Compiler.CodeHeap_Analytics 270
jcmd Compiler.codecache 270
jcmd Compiler.codelist 270
jcmd Compiler.directives_add 270
jcmd Compiler.directives_clear 270
jcmd Compiler.directives_print 270
jcmd Compiler.directives_remove 270
jcmd Compiler.queue 270
jcmd GC.class_histogram 270
jcmd GC.class_stats 270
jcmd GC.finalizer_info 270
jcmd GC.heap_dump 270
jcmd GC.heap_info 270
jcmd GC.run 270
jcmd GC.run_finalization 270
jcmd JFR.check 270
jcmd JFR.configure 270
jcmd JFR.dump 270
jcmd JFR.start 270
jcmd JFR.stop 270
jcmd JVMTI.agent_load 270
jcmd JVMTI.data_dump 270
jcmd ManagementAgent.start 270
jcmd ManagementAgent.start_local 270
jcmd ManagementAgent.status 270
jcmd ManagementAgent.stop 270
jcmd Thread.print 270
jcmd VM.class_hierarchy 270
jcmd VM.classloader_stats 270
jcmd VM.classloaders 270
jcmd VM.command_line 270
jcmd VM.dynlibs 270
jcmd VM.flags 270
jcmd VM.info 270
jcmd VM.log 270
jcmd VM.metaspace 270
jcmd VM.native_memory 270
jcmd VM.print_touched_methods 270
jcmd VM.set_flag 270
jcmd VM.stringtable 270
jcmd VM.symboltable 270
jcmd VM.system_properties 270
jcmd VM.systemdictionary 270
jcmd VM.uptime 270
jcmd VM.version 270

引用

Java Platform, Standard Edition Tools Reference, Release 11

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值