Debugging GC behavior

Now that we know how to tune the memory quite finely, we need to know what our application does, to be able to adjust the configuration. To do so, the JVM provides several ad hoc tools.

The most common and, probably, the most useful tool for the memory is the -verbose:gc option that you can pass launching your JVM. It will output memory information. If we activate it on our quote application, you will quickly see these sorts of lines:

[GC (Allocation Failure) 41320K->14967K(153600K), 0.0115487 secs][GC (Metadata GC Threshold) 44213K->20306K(153600K), 0.0195955 secs][Full GC (Metadata GC Threshold) 20306K->13993K(139264K), 0.0596210 secs][GC (Allocation Failure) 77481K->23444K(171008K), 0.0081158 secs][GC (Metadata GC ...

Get Java EE 8 High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.