1、查看生产内存使用情况
jmap -heap pid
结果如下:
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 4294967296 (4096.0MB)
NewSize = 1610612736 (1536.0MB)
MaxNewSize = 1610612736 (1536.0MB)
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 805306368 (768.0MB)
MaxPermSize = 805306368 (768.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 1449590784 (1382.4375MB)
used = 1068927656 (1019.4088516235352MB)
free = 380663128 (363.02864837646484MB)
73.73995942843963% used
Eden Space:
capacity = 1288568832 (1228.875MB)
used = 1021910896 (974.5701751708984MB)
free = 266657936 (254.30482482910156MB)
79.30588344387334% used
From Space:
capacity = 161021952 (153.5625MB)
used = 47016760 (44.83867645263672MB)
free = 114005192 (108.72382354736328MB)
29.198975304932336% used
To Space:
capacity = 161021952 (153.5625MB)
used = 0 (0.0MB)
free = 161021952 (153.5625MB)
0.0% used
concurrent mark-sweep generation:
capacity = 2684354560 (2560.0MB)
used = 593305384 (565.8201065063477MB)
free = 2091049176 (1994.1798934936523MB)
22.102347910404205% used
Perm Generation:
capacity = 805306368 (768.0MB)
used = 91667304 (87.4207534790039MB)
free = 713639064 (680.5792465209961MB)
11.3829106092453% used
上述查询结果是写文章临时搞的,当时生产的Perm Generation已经达到96%;
首先分析永久代存放的东西 :用于存放静态文件,如今Java类、方法等。
既然是这样那么最有可能就是class文件,联想到之前做的一个功能,加载不同版本的mysql和hana库,这里使用了动态加载jar包驱动,那基本确定就是这里的问题了,当然后来也证实了 确实是这里的问题,
2、使用arthas 分析
在事故刚发生的时候,我是用了阿里的arthas工具进行分析,还是很香的
直接使用 jvm命令 查看到加载的class数目
还有一些其他的命令,具体查看官网:https://arthas.aliyun.com/doc/install-detail.html
网友评论