查看java进程gc频率和堆内存信息

jps 查看 java 进程 ID

[hadoop@node1 ~]$ 
You have mail in /var/spool/mail/root
[hadoop@node1 ~]$ jps
26276 nimbus
27238 Logstash
31017 RunJar
13579 AzkabanExecutorServer
7307 Jps
27180 Logstash
22799 NameNode
23025 SecondaryNameNode
23284 ResourceManager
19444 AzkabanWebServer
18613 core
26934 Elasticsearch
14166 HMaster
17688 Main

使用jstat查看gc的信息

jstat -gc 22799 1s 30

每秒获取一次gc信息获取三十次22799为java进程ID

参数说明:S0C:第一个幸存区的大小
  S1C:第二个幸存区的大小
  S0U:第一个幸存区的使用大小
  S1U:第二个幸存区的使用大小
  EC:伊甸园区的大小
  EU:伊甸园区的使用大小
  OC:老年代大小
  OU:老年代使用大小
  MC:方法区大小
  MU:方法区使用大小
  CCSC:压缩类空间大小
  CCSU:压缩类空间使用大小
  YGC:年轻代垃圾回收次数
  YGCT:年轻代垃圾回收消耗时间
  FGC:老年代垃圾回收次数
  FGCT:老年代垃圾回收消耗时间
  GCT:垃圾回收消耗总时间

[hadoop@node1 ~]$ jstat -gc 22799 1s 30
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT   
3584.0 3584.0  0.0   2560.0 1390592.0 1183261.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183261.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183270.1 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183272.2 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183272.2 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183272.2 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183272.2 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183272.2 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183300.0 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183309.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183309.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183311.4 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639
3584.0 3584.0  0.0   2560.0 1390592.0 1183347.5 1051136.0   443026.8  48384.0 47434.8 5376.0 5138.6  13527  592.237   5     19.403  611.639

jmap -heap 22799

[hadoop@node1 ~]$ jmap -heap 22799
Attaching to process ID 22799, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.151-b12

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

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 4294967296 (4096.0MB)
   NewSize                  = 174587904 (166.5MB)
   MaxNewSize               = 1431306240 (1365.0MB)
   OldSize                  = 349700096 (333.5MB)
   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 = 1423966208 (1358.0MB)
   used     = 1230129784 (1173.143180847168MB)
   free     = 193836424 (184.85681915283203MB)
   86.38756854544683% used
From Space:
   capacity = 3670016 (3.5MB)
   used     = 2621488 (2.5000457763671875MB)
   free     = 1048528 (0.9999542236328125MB)
   71.42987932477679% used
To Space:
   capacity = 3670016 (3.5MB)
   used     = 0 (0.0MB)
   free     = 3670016 (3.5MB)
   0.0% used
PS Old Generation
   capacity = 1076363264 (1026.5MB)
   used     = 453659472 (432.6433868408203MB)
   free     = 622703792 (593.8566131591797MB)
   42.14743174289531% used

18933 interned Strings occupying 1911424 bytes.

你可能感兴趣的:(查看java进程gc频率和堆内存信息)