DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • Replacing JSON With Protobuf in Your Microservice Mesh: A Zero-Downtime Migration Blueprint
  • The Bottleneck of Scaling
  • Rust-Native Alternatives to Spark SQL and DataFrame Workloads

Trending

  • Kubernetes Rolling Updates Are Lying to You — and Your Users Are Paying for It
  • Ingesting Public Data That Fails Silently: Patterns From a TypeScript and Cloudflare Workers Pipeline
  • Delta Lake UniForm to Snowflake: Cross-Platform Table Access Without a Second Copy
  • Your Event Storming Is Not Your Software Design

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Languages
  4. How To Do GC Log Analysis?

How To Do GC Log Analysis?

In this post, we will discuss the benefits of analyzing the garbage collection logs, essential steps to conduct GC log analysis, and some free tools to analyze.

By 
Ram Lakshmanan
DZone Core CORE ·
Feb. 12, 22 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
11.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Log analysis illustration

Analyzing garbage collection logs provides several advantages like it reduces GC pause time, reduces cloud computing cost, predicts outages, provides effective metrics for capacity planning. To learn about the profound advantages of GC log analysis, please refer to this post. In this post let’s learn how to analyze GC logs?

Basically, there are 3 essential steps when it comes to GC log analysis:

  1. Enable GC logs
  2. Measurement duration and environment
  3. Tools to analyze

Let’s discuss these steps in detail.

1. Enable GC Logs

Even though certain monitoring tools provide real-time Garbage Collection graphs/metrics, they don’t provide a complete set of details to study the GC behavior. GC logs are the best source of information, to study the Garbage Collection behavior. You can enable GC logs, by specifying below JVM arguments in your application:

Java 8 and Below Versions

If your application is running on Java 8 and below versions, then pass the following arguments:

 
-XX:+PrintGCDetails -Xloggc:<gc-log-file-path> 
Example: 
-XX:+PrintGCDetails -Xloggc:/opt/tmp/myapp-gc.log


Java 9 and Above Versions

If your application is running on Java 9 and above versions, then pass the following arguments:

 
-Xlog:gc*:file=<gc-log-file-path> 
Example: 
-Xlog:gc*:file=/opt/tmp/myapp-gc.log


2. Measurement Duration an Environment

It’s always best practice to study the GC log for a 24-hour period during a weekday so that the application would have seen both high volume and low volume traffic tide. 

It’s best practice to collect the GC logs from the production environment because garbage collection behavior is heavily influenced by traffic patterns. It’s hard to simulate production traffic in a test environment. Also, the overhead added by GC log in production servers is negligible, in fact, it’s not even measurable. To learn about overhead added by enabling GC logs, you can read my previous post.

3. Tools To Analyze

Once you have captured GC logs, you can use one of the following free tools to analyze the GC logs:

  1. GCeasy
  2. IBM GC and Memory Visualizer
  3. HP Jmeter
  4. Garbage Cat

Furthermore, here is an interesting video clip that walks you through the best practices, KPIs, tips, and tricks to help you effectively optimize Garbage collection performance. 

If you use any other tool or method to conduct your GC analysis, feel free to share them in the comments below. 

garbage collection

Published at DZone with permission of Ram Lakshmanan. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • Replacing JSON With Protobuf in Your Microservice Mesh: A Zero-Downtime Migration Blueprint
  • The Bottleneck of Scaling
  • Rust-Native Alternatives to Spark SQL and DataFrame Workloads

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook