【大数据day04】——JVM优化 上(jvm的内存模型( 四 )


说明:
3.4.2、查看编译统计
[root@node01 ~]# jstat -compiler 6219Compiled Failed InvalidTimeFailedType FailedMethod2376108.041 org/apache/tomcat/util/IntrospectionUtils setProperty
说明:
3.4.3、垃圾回收统计
[root@node01 ~]# jstat -gc 6219S0CS1CS0US1UECEUOCOUMCMUCCSCCCSUYGCYGCTFGCFGCTGCT9216.0 8704.00.06127.3 62976.03560.433792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.323#也可以指定打印的间隔和次数,每1秒中打印一次,共打印5次[root@node01 ~]# jstat -gc 6219 1000 5S0CS1CS0US1UECEUOCOUMCMUCCSCCCSUYGCYGCTFGCFGCTGCT9216.0 8704.00.06127.3 62976.03917.333792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.3239216.0 8704.00.06127.3 62976.03917.333792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.3239216.0 8704.00.06127.3 62976.03917.333792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.3239216.0 8704.00.06127.3 62976.03917.333792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.3239216.0 8704.00.06127.3 62976.03917.333792.020434.923808.0 23196.1 2560.0 2361.671.07810.2441.323
说明:
4、jmap的使用以及内存溢出分析
前面通过jstat可以对jvm堆的内存进行统计分析,而jmap可以获取到更加详细的内容,如:内存使用情况的汇总、对内存溢出的定位与分析 。
4.1、查看内存使用情况
[root@node01 ~]# jmap -heap 6219Attaching to process ID 6219, please wait...Debugger attached successfully.Server compiler detected.JVM version is 25.141-b15using thread-local object allocation.Parallel GC with 2 thread(s)Heap Configuration: #堆内存配置信息MinHeapFreeRatio= 0MaxHeapFreeRatio= 100MaxHeapSize= 488636416 (466.0MB)NewSize= 10485760 (10.0MB)MaxNewSize= 162529280 (155.0MB)OldSize= 20971520 (20.0MB)NewRatio= 2SurvivorRatio= 8MetaspaceSize= 21807104 (20.796875MB)CompressedClassSpaceSize = 1073741824 (1024.0MB)MaxMetaspaceSize= 17592186044415 MBG1HeapRegionSize= 0 (0.0MB)Heap Usage: # 堆内存的使用情况PS Young Generation #年轻代Eden Space:capacity = 123731968 (118.0MB)used= 1384736 (1.320587158203125MB)free= 122347232 (116.67941284179688MB)1.1191416594941737% usedFrom Space:capacity = 9437184 (9.0MB)used= 0 (0.0MB)free= 9437184 (9.0MB)0.0% usedTo Space:capacity = 9437184 (9.0MB)used= 0 (0.0MB)free= 9437184 (9.0MB)0.0% usedPS Old Generation #年老代capacity = 28311552 (27.0MB)used= 13698672 (13.064071655273438MB)free= 14612880 (13.935928344726562MB)48.38545057508681% used13648 interned Strings occupying 1866368 bytes.
4.2、查看内存中对象数量及大小
#查看所有对象,包括活跃以及非活跃的jmap -histo| more#查看活跃对象jmap -histo:live| more[root@node01 ~]# jmap -histo:live 6219 | morenum#instances#bytesclass name----------------------------------------------1:374377914608[C2:34916837984java.lang.String3:884654848[B4:17188550016java.util.HashMap$Node5:3674424968java.lang.Class6:6322395512[Ljava.lang.Object;7:3738328944java.lang.reflect.Method8:1028208048[Ljava.util.HashMap$Node;9:2247144264[I10:4305137760java.util.concurrent.ConcurrentHashMap$Node11:1270109080[Ljava.lang.String;12:6484128[Ljava.util.concurrent.ConcurrentHashMap$Node;13:171482272java.util.HashMap14:328570072[Ljava.lang.Class;15:288869312java.util.ArrayList16:398363728java.lang.Object17:127161008org.apache.tomcat.util.digester.CallMethodRule18:151860720java.util.LinkedHashMap$Entry19:167153472com.sun.org.apache.xerces.internal.xni.QName20:8850880[Ljava.util.WeakHashMap$Entry;21:61849440java.lang.reflect.Constructor22:154549440java.util.Hashtable$Entry23:102741080java.util.TreeMap$Entry24:84640608org.apache.tomcat.util.modeler.AttributeInfo25:14238032[S26:94637840java.lang.ref.SoftReference27:22636816[[C 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。#对象说明BbyteCcharDdoubleFfloatIintJlongZboolean[数组,如[I表示int[][L+类名 其他对象