快速的发现线程cpu高, 最终发现是gc线程, 最终去分析jvm
top -o %CPU
top -Hp108920
jmap -dump:format=b,file=heap.bin 108920
jvm 命令和工具_个人渣记录仅为自己搜索用的博客-CSDN博客
$ jstat -gcold 108920 MC MU CCSC CCSU OC OU YGC FGC FGCT GCT 218368.0 212670.3 25344.0 23913.0 2355200.0 2355200.0 1191 9925 7594.058 7691.720
$ jmap -heap 108920 Attaching to process ID 108920, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.242-b716 using parallel threads in the new generation. using thread-local object allocation. Concurrent Mark-Sweep GC Heap
Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 3984588800 (3800.0MB) NewSize = 1572864000 (1500.0MB) MaxNewSize = 1572864000 (1500.0MB) OldSize = 2411724800 (2300.0MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 536870912 (512.0MB) CompressedClassSpaceSize = 528482304 (504.0MB) MaxMetaspaceSize = 536870912 (512.0MB) G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 1415577600 (1350.0MB)
used = 763203736 (727.8478012084961MB)
free = 652373864 (622.1521987915039MB) 53.91465194137008%
used Eden Space:
capacity = 1258291200 (1200.0MB)
used = 763203736 (727.8478012084961MB)
free = 495087464 (472.1521987915039MB) 60.65398343404134%
used From Space:
capacity = 157286400 (150.0MB)
used = 0 (0.0MB)
free = 157286400 (150.0MB) 0.0%
used To Space:
capacity = 157286400 (150.0MB)
used = 0 (0.0MB) free = 157286400 (150.0MB) 0.0%
used concurrent mark-sweep generation:
capacity = 2411724800 (2300.0MB)
used = 2411724800 (2300.0MB)
free = 0 (0.0MB) 100.0% used
88380 interned Strings occupying 10042968 bytes.
$ jstat -gcutil 108920
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 93.23 100.00 97.39 94.35 1191 97.661 9965 7611.965 7709.627
printf "%x\n" 108931 1a983
jstack 108920|grep 1a983
"Concurrent Mark-Sweep GC Thread" os_prio=0 tid=0x00007fea2bb2f600 nid=0x1a983 runnable