Simple tool to monitor jvm memory usage and garbage collection

JDK has built-in tool to monitor jvm memory usage: jstat

This is a command line tool, which runs like:

$ jstat -gc 17707 5000
where, -gc is the option, 17707 is process ID of the jvm process, 5000 is output frequency: every 5 seconds.

 

Following is example output:

 

$ Jstat -gc 17707 5000
 S0C S1C S0U S1U EC EU OC OR PC PU YGC YGCT FGC GCTF GCT
34944.0 34944.0 26066.5 0.0 279744.0 219021.0 699072.0 250829.1 104640.0 104498.2 47 16 1055
4898 5953 34944.0 34944.0 26066.5 0.0 279744.0 219371.7 699072.0 250829.1 104640.0 104498.3 47 1.055 16 4.898 5.953
34944.0 34944.0 0.0 26066.5 279744.0 232479.2 699072.0 250829.1 104640.0 104498.8 47 1.055 16 4.898 5.953

... ...

34944.0 34944.0 1105.2  0.0   279744.0   216551.2  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   217444.3  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   219828.4  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   220063.1  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222029.5  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222160.4  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222289.1  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222417.7  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222534.9  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090
34944.0 34944.0 1105.2  0.0   279744.0   222667.3  699072.0   449222.0  104640.0 104587.7     54    1.193  16      4.898    6.090

 

The output unit is KB.

 

S0C: Current (allocated) memory size of the survivor 0 -- stores new objects that survived couple of minor GCs

S1C: Current (allocated) memory size of the survivor 1 -- stores new objects that survived couple of minor GCs

S0U: Used memory size of the survivor 0

S1U: Used memory size of the survivor 1

EC:   Current (allocated) memory size of the Eden -- when object created, it's put into Eden

EU:   Used memory size of the Eden

OC:   Current (allocated) memory size of the Old Generation -- stores objects that survived many minor GCs

OU:   Used memeory of the Old Generation

PC:   Current (allocated) memory size of the Permanent Generation -- stores class meta data and app constants etc

PU:   Used memory of the Permanent Generation

YGC:   Garbage Collection counter for Young Generation memory -- minor GC

YGT:    Time (seconds) used by Garbage Collection for Young Generation memory -- minor GC

FGC:   Major Garbage Collection counter for Old Generation memory - major GC

FGCT: Time used by Major Garbage Collection counter for Old Generation memory

GCT:    Total time used by all Garbage Collection operations

 

 below is diagram of jvm memory modle:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326465976&siteId=291194637