Explanation of Tomcat GC log statements

2019-02-03 08:37发布

Here is a statement from my catalina.out, generated by my tomcat server :

1885.855: [GC [PSYoungGen: 742996K->64359K(761472K)] 2509583K->1832973K(4116928K), 0.1453610 secs] [Times: user=0.31 sys=0.00, real=0.14 secs]

Could someone explain the meaning of various numbers in here?

1条回答
爷的心禁止访问
2楼-- · 2019-02-03 09:31

The break-up of the line is as followd:

1885.85 - this in seconds is the amount of time the JVM has been running, so around 31 minutes or so in your case at which point the GC took place.

[GC - states a GC occured at this point in time. This is a Partial GC, sometimes it will show Full GC

Now, the Total Heap available for the JVM = Young + Old

[PSYoungGen:742996K->64359K(761472K) - represents the Parallel Scavenging Collector in the Young generation (which is one of the many types of GC collectors available in the JVM).

The memory freed by GC is always of the pattern

x->y(z) 

x is the initial memory before GC, y is the memory after GC, z is the total memory allowed for that area in the JVM

so in your example, 742996K->64359K(761472K) - the total Young size is 761Mb, and when it reached 742 Mb a collection took place, and it cleared down to 64.3Mb i.e. it cleared up 678 Mb

2509583K->1832973K(4116928K)

Here the total heap memory is represented. So out of a total possible heap of 4.1 Gb, when the GC took place, it had filled 2.5 Gb and it has come down to 1.83 Gb - again the same 678 Mb is what got cleared.

0.1453610 secs]

This entire operation took 0.1453610 seconds

[Times: user=0.31 sys=0.00, real=0.14 secs] 

shows the break-up of user, system and real times taken.

This is just one line - you would be looking for a pattern esp one that says Full GC in it And use a log analyzer like GCViewer for showing you throughput and other good stuff.

Also read the docs from Sun to get the basics.

Further reading:

http://sujitpal.blogspot.com/2006/08/charting-jvm-garbage-collection.html

Java Garbage Collection Log messages

查看更多
登录 后发表回答