JVM heap usage variation. Is this graph normal?

Viewed 1221

This is the JVM memory usage of a pre-production server while running a load test(Xmx=10g). I have few questions.

  1. Garbage collector has run almost each 5 minutes. During these 5 minutes heap has grown from 3GB to 10GB. Is this growth normal? If not, how is is possible to analyze the problem in my application?

  2. Within two garbage collector cycles, there is a gradual decrease and sudden spike of average heap usage. What is the reason for that?

  3. Inside the gradual decline mentioned in second comment, without having a smooth decline, there is a vibration. What is the reason for that?

1 Answers

This heap utilisation pattern is sometimes called "a saw" and seems healthy as in your case it stays consistent. Take a look at Memory Leaks: Fallacies and Misconceptions article which dives deeper into common heap utilisation patterns and their problems.

  1. The answer depends on the application code, for some application it is normal for other it is not. The only way to figure it out is to understand what is the application doing.

  2. You are most likely running a concurrent GC which doesn't perform full GC cycle as long as there is available memory. The teeth of the saw pattern are probably live objects moving from the survivor space to the old space.

  3. Same as 1.

Instead of looking at the picture you want to understand some basic parameters and judge if they are healthy for your application:

  1. What is the duration and frequency of new space GC

  2. What is the duration and frequency of old space GC

  3. How much time is spent in GC

  4. How much CPU % is spent in GC

  5. Application latency impact by GC

Related