JVM调优常用命令及工具

JVM调优常用命令及工具目录1、jstat命令1.1、查看class加载统计1.2、查看编译统计1.3、垃圾回收统计2、jmap命令2.1、查看内存使用情况jmap-heap2629682.2、查看内存中对象数量及大小2.3、将内存使用情况dump到文件中2.4、通过jhat对dump文件进行分析2.5、通过MAT工具对dump文件进行分析3、jstack命令4、jdk自带jvisualvm工具1、jstat命令jstat命令可以查看堆内存各部分的使用量,以及加载类的数

大家好,又见面了,我是你们的朋友全栈君。


目录

1、jstat命令

1.1、查看class加载统计

1.2、查看编译统计

1.3、垃圾回收统计

2、jmap命令

2.1、查看内存使用情况 jmap -heap 262968

2.2、查看内存中对象数量及大小

2.3、将内存使用情况dump到文件中

2.4、通过jhat对dump文件进行分析

2.5、通过MAT工具对dump文件进行分析

3、jstack命令

4、jdk自带jvisualvm工具

5、gc日志分析工具gceasy


1、jstat命令

jstat命令可以查看堆内存各部分的使用量,以及加载类的数量。

E:\IDEA\WorkSpace\zsy-teacher-server>jstat -help
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.

1.1、查看class加载统计

E:\IDEA\WorkSpace\zsy-teacher-server>jps -l
455796 org.jetbrains.idea.maven.server.RemoteMavenServer
212432
468948 sun.tools.jps.Jps
262968 com.zhixinhuixue.teacher.academic.ZSYAcademicApplication
328040 org.jetbrains.jps.cmdline.Launcher
380680 org.jetbrains.jps.cmdline.Launcher

E:\IDEA\WorkSpace\zsy-teacher-server>jstat -class 262968
加载类数量 占用空间 未加载数量 未加载占用空间  时间      
Loaded  Bytes  Unloaded  Bytes     Time
 14647 26952.9        0     0.0      12.69

1.2、查看编译统计

E:\IDEA\WorkSpace\zsy-teacher-server>jstat -compiler 262968
编译数量 失败数量 不可用数量 时间  失败类型  失败方法
Compiled Failed Invalid   Time   FailedType FailedMethod
    9242      0       0     1.77          0

1.3、垃圾回收统计

每500ms统计一次gc情况,共执行200次。jstat -gc 262968 500 200

JVM调优常用命令及工具

S0C:第一个Survivor区的大小(KB)
S1C:第二个Survivor区的大小(KB)
S0U:第一个Survivor区的使用大小(KB)
S1U:第二个Survivor区的使用大小(KB)
EC:Eden区的大小(KB)
EU:Eden区的使用大小(KB)
OC:Old区大小(KB)
OU:Old使用大小(KB)
MC:方法区大小(KB)
MU:方法区使用大小(KB)
CCSC:压缩类空间大小(KB)
CCSU:压缩类空间使用大小(KB)
YGC:年轻代垃圾回收次数
YGCT:年轻代垃圾回收消耗时间
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

2、jmap命令

jmap可以进行内存使用情况的汇总,并对内存的溢出进行定位与分析。

E:\IDEA\WorkSpace\zsy-teacher-server>jmap -help
Usage:
    jmap [option] <pid>
        (to connect to running process)
    jmap [option] <executable <core>
        (to connect to a core file)
    jmap [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    <none>               to print same info as Solaris pmap
    -heap                to print java heap summary
    -histo[:live]        to print histogram of java object heap; if the "live"
                         suboption is specified, only count live objects
    -clstats             to print class loader statistics
    -finalizerinfo       to print information on objects awaiting finalization
    -dump:<dump-options> to dump java heap in hprof binary format
                         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>
                         Example: jmap -dump:live,format=b,file=heap.bin <pid>
    -F                   force. Use with -dump:<dump-options> <pid> or -histo
                         to force a heap dump or histogram when <pid> does not
                         respond. The "live" suboption is not supported
                         in this mode.
    -h | -help           to print this help message
    -J<flag>             to pass <flag> directly to the runtime system

2.1、查看内存使用情况 jmap -heap 262968

E:\IDEA\WorkSpace\zsy-teacher-server>jmap -heap 262968
Attaching to process ID 262968, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.112-b15

using thread-local object allocation.
Parallel GC with 6 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 4282384384 (4084.0MB)
   NewSize                  = 89128960 (85.0MB)
   MaxNewSize               = 1427111936 (1361.0MB)
   OldSize                  = 179306496 (171.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 44564480 (42.5MB)
   used     = 20908560 (19.939956665039062MB)
   free     = 23655920 (22.560043334960938MB)
   46.91754509420956% used
From Space:
   capacity = 524288 (0.5MB)
   used     = 327680 (0.3125MB)
   free     = 196608 (0.1875MB)
   62.5% used
To Space:
   capacity = 524288 (0.5MB)
   used     = 0 (0.0MB)
   free     = 524288 (0.5MB)
   0.0% used
PS Old Generation
   capacity = 190840832 (182.0MB)
   used     = 83238872 (79.38277435302734MB)
   free     = 107601960 (102.61722564697266MB)
   43.61690898517986% used

55755 interned Strings occupying 6056248 bytes.

2.2、查看内存中对象数量及大小

jmap -histo 262968 | more  查看所有对象,包括活跃与非活跃

E:\IDEA\WorkSpace\zsy-teacher-server>jmap -histo 262968 | more

 num     #instances         #bytes  class name
----------------------------------------------
   1:        181809       19559592  [C
   2:         71774        6316112  java.lang.reflect.Method
   3:         19920        5804872  [B
   4:        136743        4375776  java.util.concurrent.ConcurrentHashMap$Node
   5:        168391        4041384  java.lang.String
   6:         57031        3574848  [Ljava.lang.Object;
   7:         22018        3531104  [I
   8:         76694        3067760  java.util.LinkedHashMap$Entry
   9:          6954        2983384  [J
  10:         34863        2819000  [Ljava.util.HashMap$Node;
  11:         57796        2774208  org.aspectj.weaver.reflect.ShadowMatchImpl
  12:         74417        2381344  java.util.HashMap$Node
  13:         19058        2115552  java.lang.Class
  14:         43398        2083104  java.util.HashMap
  15:         36511        2044616  java.util.LinkedHashMap
  16:          1238        2007008  [Ljava.util.concurrent.ConcurrentHashMap$Node;
  17:         60447        1934304  java.util.ArrayList$Itr
  18:         57796        1849472  org.aspectj.weaver.patterns.ExposedState
  19:         21750        1218000  java.util.stream.ReferencePipeline$Head
  20:         48749        1169976  java.util.ArrayList
  21:         18125        1160000  java.util.stream.ReferencePipeline$3
  22:         45905        1031840  [Ljava.lang.Class;
  23:         14500         928000  java.util.stream.ReferencePipeline$2
  24:         12553         903816  java.lang.reflect.Field
  25:         15249         853944  java.util.concurrent.ConcurrentHashMap$KeyIterator

jmap -histo:live 262968 | more   查看活跃对象

E:\IDEA\WorkSpace\zsy-teacher-server>jmap -histo:live 262968 | more

 num     #instances         #bytes  class name
----------------------------------------------
   1:        132592       13472128  [C
   2:         45363        3991944  java.lang.reflect.Method
   3:        120158        3845056  java.util.concurrent.ConcurrentHashMap$Node
   4:        131883        3165192  java.lang.String
   5:         57796        2774208  org.aspectj.weaver.reflect.ShadowMatchImpl
   6:         35060        2259592  [Ljava.lang.Object;
   7:         18745        2083000  java.lang.Class
   8:         50467        2018680  java.util.LinkedHashMap$Entry
   9:         57796        1849472  org.aspectj.weaver.patterns.ExposedState
  10:         20912        1653560  [Ljava.util.HashMap$Node;
  11:          1138        1445664  [Ljava.util.concurrent.ConcurrentHashMap$Node;
  12:           633        1440456  [J
  13:         41023        1312736  java.util.HashMap$Node
  14:         21097        1181432  java.util.LinkedHashMap
  15:          7441        1134096  [B
  16:         11197         886048  [I
  17:         24219         581256  java.util.ArrayList
  18:         32586         521376  java.lang.Object
  19:         22812         518928  [Ljava.lang.Class;
  20:          8401         403248  java.util.HashMap
  21:          7054         338592  org.springframework.core.ResolvableType
  22:          9156         219744  sun.reflect.generics.tree.SimpleClassTypeSignature
-- More  --
对象说明:
B byte
C char
D double
F float
I int
J long
Z boolean
[
数组,如
[I
表示
int[]
[L
+
类名 其他对象

2.3、将内存使用情况dump到文件中

  • 手动导出dump文件:jmap -dump:live,format=b,file=dump.hprof PID  /  jmap -dump:format=b,file=dump.dat PID
  • 自动导出dump文件(当jvm堆内存溢出时):-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/temp/dump.hprof
E:\IDEA\WorkSpace\zsy-teacher-server>jmap -dump:format=b,file=temp\dump.dat 262968
Dumping heap to E:\IDEA\WorkSpace\zsy-teacher-server\temp\dump.dat ...
Heap dump file created

E:\IDEA\WorkSpace\zsy-teacher-server>cd temp

E:\IDEA\WorkSpace\zsy-teacher-server\temp>dir
 驱动器 E 中的卷是 开发
 卷的序列号是 0A9A-D661

 E:\IDEA\WorkSpace\zsy-teacher-server\temp 的目录

2021/07/16  10:56    <DIR>          .
2021/07/16  10:56    <DIR>          ..
2021/07/16  10:56       155,059,455 dump.dat
               1 个文件    155,059,455 字节
               2 个目录 324,694,474,752 可用字节

2.4、通过jhat对dump文件进行分析

jhat -port <port> <file>
E:\IDEA\WorkSpace\zsy-teacher-server\temp>jhat -port 9000 dump1.hprof
Reading from dump1.hprof...
Dump file created Fri Jul 16 11:10:22 CST 2021
Snapshot read, resolving...
Resolving 1240951 objects...
Chasing references, expect 248 dots......................................................................................................................................
..................................................................................................................
Eliminating duplicate references.........................................................................................................................................
...............................................................................................................
Snapshot resolved.
Started HTTP server on port 9000
Server is ready.

JVM调优常用命令及工具

2.5、通过MAT工具对dump文件进行分析

MAT(Memory Analyzer Tool)
,一个基于
Eclipse
的内存分析工具,是一个快速、功能丰
富的
JAVA heap
分析工具,它可以帮助我们查找内存泄漏和减少内存消耗。
JVM调优常用命令及工具

 若dump文件过大,可以加大-Xmx

JVM调优常用命令及工具

 参考https://www.cnblogs.com/liangzs/p/8489321.html

3、jstack命令

用法:jstack <pid>

E:\IDEA\WorkSpace\zsy-teacher-server\temp>jstack -help
Usage:
    jstack [-l] <pid>
        (to connect to running process)
    jstack -F [-m] [-l] <pid>
        (to connect to a hung process)
    jstack [-m] [-l] <executable> <core>
        (to connect to a core file)
    jstack [-m] [-l] [server_id@]<remote server IP or hostname>
        (to connect to a remote debug server)

Options:
    -F  to force a thread dump. Use when jstack <pid> does not respond (process is hung)
    -m  to print both java and native frames (mixed mode)
    -l  long listing. Prints additional information about locks
    -h or -help to print this help message
E:\IDEA\WorkSpace\zsy-teacher-server\temp>jstack 262968
2021-07-16 15:06:43
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.112-b15 mixed mode):
"RibbonApacheHttpClientConfiguration.connectionManagerTimer" #198 daemon prio=5 os_prio=0 tid=0x0000000026bf8000 nid=0x39144 in Object.wait() [0x000000003327f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.util.TimerThread.mainLoop(Timer.java:552)
- locked <0x00000006c41e7448> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:505)
"hystrix-zsy-ufile-service-1" #197 daemon prio=5 os_prio=0 tid=0x0000000026bf9800 nid=0x5e768 waiting on condition [0x000000003317e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c4259720> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-10" #196 daemon prio=5 os_prio=0 tid=0x0000000026bf5800 nid=0x75e8c waiting on condition [0x000000003307e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-9" #195 daemon prio=5 os_prio=0 tid=0x0000000026bf4000 nid=0x8880c waiting on condition [0x0000000032f7f000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-8" #194 daemon prio=5 os_prio=0 tid=0x0000000026bf5000 nid=0x8d52c waiting on condition [0x0000000032e7f000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-7" #193 daemon prio=5 os_prio=0 tid=0x0000000026bf7000 nid=0x2ed28 waiting on condition [0x0000000032d7e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RxComputationScheduler-6" #192 daemon prio=5 os_prio=0 tid=0x0000000026bf3000 nid=0x90140 waiting on condition [0x0000000032c7e000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c187d0d0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-6" #191 daemon prio=5 os_prio=0 tid=0x0000000026beb800 nid=0x8a484 waiting on condition [0x0000000032b7e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-5" #190 daemon prio=5 os_prio=0 tid=0x0000000026bf2800 nid=0x8feb8 waiting on condition [0x0000000032a7e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-4" #189 daemon prio=5 os_prio=0 tid=0x0000000026bf1800 nid=0x19114 waiting on condition [0x000000003297f000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-3" #188 daemon prio=5 os_prio=0 tid=0x0000000026bf1000 nid=0x526b8 waiting on condition [0x000000003287f000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"HystrixTimer-6" #187 daemon prio=5 os_prio=0 tid=0x0000000026bf0000 nid=0x74158 waiting on condition [0x000000003277e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c407a338> (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 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1081)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"hystrix-zsy-base-service-2" #186 daemon prio=5 os_prio=0 tid=0x0000000026bef800 nid=0x369a0 waiting on condition [0x000000003257e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"HystrixTimer-5" #185 daemon prio=5 os_prio=0 tid=0x0000000026bee800 nid=0x6a644 waiting on condition [0x000000003247e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c407a338> (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 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1088)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RxComputationScheduler-5" #184 daemon prio=5 os_prio=0 tid=0x0000000026beb000 nid=0x8fe50 waiting on condition [0x000000003237e000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c187d288> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RibbonApacheHttpClientConfiguration.connectionManagerTimer" #183 daemon prio=5 os_prio=0 tid=0x0000000026bed000 nid=0x141c0 in Object.wait() [0x000000003227f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.util.TimerThread.mainLoop(Timer.java:552)
- locked <0x00000006c42756d0> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:505)
"hystrix-zsy-base-service-1" #182 daemon prio=5 os_prio=0 tid=0x0000000026bec800 nid=0x82818 waiting on condition [0x000000003217e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c420ae60> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"HystrixTimer-4" #181 daemon prio=5 os_prio=0 tid=0x000000002626b800 nid=0x1970 waiting on condition [0x000000003207e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c407a338> (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 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1088)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RxComputationScheduler-4" #180 daemon prio=5 os_prio=0 tid=0x000000002626a000 nid=0x1d070 waiting on condition [0x0000000031f7f000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c187d440> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RibbonApacheHttpClientConfiguration.connectionManagerTimer" #179 daemon prio=5 os_prio=0 tid=0x0000000026269000 nid=0x6f54 in Object.wait() [0x0000000031e7f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.util.TimerThread.mainLoop(Timer.java:552)
- locked <0x00000006c42fae80> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:505)
"hystrix-zsyte-paper-service-1" #178 daemon prio=5 os_prio=0 tid=0x000000002669d000 nid=0x7ec2c waiting on condition [0x0000000031d7e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c41f2f40> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:458)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:924)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"HystrixTimer-3" #177 daemon prio=5 os_prio=0 tid=0x000000002669a800 nid=0x71150 waiting on condition [0x0000000031c7e000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c407a338> (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 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1088)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"RxComputationScheduler-3" #176 daemon prio=5 os_prio=0 tid=0x000000002669c000 nid=0x61ddc waiting on condition [0x0000000031b7f000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x00000006c187d5f8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

4、jdk自带jvisualvm工具

VisualVM,能够监控线程,内存情况,查看方法的CPU时间和内存中的对象,已被GC的对象,反向查看分配的堆栈(如100个String对象分别由哪几个对象分配出来的)。
VisualVM使用简单,几乎0配置,功能还是比较丰富的,几乎囊括了其它JDK自带命令的所有功能。

  • 内存信息
  • 线程信息
  • Dump堆(本地进程)
  • Dump线程(本地进程)
  • 打开堆Dump。堆Dump可以用jmap来生成。
  • 打开线程Dump
  • 生成应用快照(包含内存信息、线程信息等等)
  • 性能分析。CPU分析(各个方法调用时间,检查哪些方法耗时多),内存分析(各类对象占用的内存,检查哪些类占用内存多)

JVM调优常用命令及工具

 JVM调优常用命令及工具

 JVM调优常用命令及工具

JVM调优常用命令及工具

5、gc日志分析工具gceasy

https://www.gceasy.io/

-XX:+UseParallelGC
-XX:+UseParallelOldGC
-Xms512m
-Xmx512m
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC
-Xloggc:gc.log

 JVM调优常用命令及工具

 

JVM调优常用命令及工具

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/146519.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号