Garbage collection log is a vital artifact to study the performance characteristics of an application. It plays a key role in diagnosing memory/CPU related problems. However today’s world Garbage collection logs are analyzed manually. Most often it’s analyzed only when there is a performance problem. There is no programmatic way to analyze Garbage Collection logs in a proactive manner. Thus gceasy.io is introducing a RESTful API to analyze garbage collection logs. Here are couple of use cases where this API can be used.

Use case 1: Production Proactive GC Log analysis

In production environment, where there are several JVMs running, only selective few JVM’s Garbage Collection logs are analyzed. Because of the tediousness involved in analyzing all the Garbage Collection logs not every single JVMs Garbage Collections are analyzed. Most of times, only when there is a performance problems, Garbage Collection logs are analyzed. With Garbage Collection analysis API, you can analyze GC logs in a proactive manner. On a periodic basis you can invoke Garbage Collection analysis API to check whether any problem is brewing in the application. Garbage Collection log analysis API reports any vulnerabilities that is currently happening in the application, besides that its ML algorithms can even forecast certain types of memory problems that’s going to happen in near future.

Use case 2: Continuous Integration

As part of continuous integration after all tests are executed against the source code, Garbage Collection log analysis API can be invoked to see whether application is suffering from any memory problems. If API reports any memory problems, then build can be failed. In this way you can catch the memory problem right during code commit time instead of catching it in performance tests or production.

How to invoke Garbage Collection log analysis API?

Invoking Garbage Collection log analysis is an extremely simple:

Register with us. We will email you the API key. This is a one-time setup process.

Body of the HTTP request should contain the Garbage collection log that needs to be analyzed.

HTTP Response will be sent back in JSON format. JSON has several important stats about the GC log. Primary element to look in the JSON response is: “isProblem“. This element will have value to be “true”, if any memory problems has been discovered. “problem” element will contain detailed description about the memory problem. Sample response is given below.

CURL command

Assuming your GC log file is located in “./my-app-gc.log”, then CURL command to invoke the API is:

JSON Response Elements

Unique transaction Id that is generated for every response. This is used for any debugging or diagnosis purposes

graphURL

Graphical visualization of the GC log can be found in this location.

isProblem

true’ is returned if any memory problems are found. ‘false’ is returned if no memory problems are found. This element can be used to build any alerts for proactive GC monitoring

problem

Description of the memory problem is reported in this element. Like what type of memory problem it is. What are the side-effects and symptoms it might cause

jvmHeapSize

The data points in this section is gathered from the GC log, thus It may or may not match with the size that is specified by the JVM system properties (i.e. –Xmx, -Xms,…). Say you have configured total heap size (i.e. –Xmx) as 2gb, whereas at runtime if JVM has allocated only 1gb, then in this report you are going to see the allocated size as 1gb only.

youngGen

allocatedSize

Young Generation’s allocated size (i.e. specified at the JVM level)

peakSize

Young Generation’s peak utilization size at runtime

oldGen

allocatedSize

Old Generation’s allocated size (i.e. specified at the JVM level)

peakSize

Old Generation’s peak utilization size at runtime

metaSpace

allocatedSize

Metaspace’s allocated size (i.e. specified at the JVM level)

peakSize

MetaSpace’s peak utilization size at runtime

permGen

allocatedSize

Perm Generation’s allocated size (i.e. specified at the JVM level)

peakSize

Perm Generation’s peak utilization size at runtime

total

allocatedSize

Total allocated heap size (i.e. specified at the JVM level) includes Young + Old + Perm (or Metaspace)