Sagar
Sagar

Reputation: 5596

Performance Metrics to choose garbage collector

What should I measure while choosing the garbage collector?

In my case, I am trying to compare the performance of throughput collector over G1GC, not quite sure what should I look for before making my final decision. I know looking at how much time is spent by garbage collector sounds like a good idea but it might or might not affect my application performance. (FYI - migrating from Java 8 to Java 11)

Upvotes: 2

Views: 873

Answers (1)

Karol Dowbecki
Karol Dowbecki

Reputation: 44952

The different GC in JVM are designed for different use cases:

  1. Throughput - Parallel
  2. Latency - CMS
  3. Predictability - G1, ZGC

Once you know which of these use cases you are looking for you can pick up a relevant metric e.g. it makes no sense to measure average pause time for throughput collector, it would be better to look at total time spent collecting.

Comparing Parallel collector to G1 makes no sense, they are designed for different use case. If you have to process batches of data quickly use Parallel. If you have an application that has to be responsive during the workload use G1.

Upvotes: 2

Related Questions