Core Java

Overhead added by Garbage Collection Logging

Enabling Garbage collection logs on your application has certain advantages. In nutshell, Garbage collection logs will facilitate you to optimize Garbage Collection pause time, improve overall application’s response time, forecast production outages, reduce computing cost. Even though Garbage collection logs have these advantages, we weren’t sure what overhead does garbage collection logging add to the application. Thus we set out to conduct the below case study.

Environment

For our study we chose to use the open source spring boot pet clinic application. Pet Clinic is a poster child application that was developed to demonstrate the spring boot framework features. 

We ran this application in OpenJDK 11. We deployed this application on the Amazon AWS t2.medium EC2 instance which has 16GB RAM and 2 CPUs. Test was orchestrated using Apache JMeter stress testing tool. We used AWS Cloudwatch to measure the CPU, Memory utilization. In nutshell here are the tools/technologies, we used to conduct this case study:

  • OpenJDK 11
  • AWS EC2
  • AWS Cloudwatch
  • Apache JMeter

Test Scenario

In this environment, we conducted 2 tests:

  1. Baseline Test – In this scenario we ran the pet clinic application without enabling garbage collection (GC) logs using the JMeter tool for 20 minutes with 200 concurrent users
  2. GC log Enabled Test – In this scenario we ran the pet clinic application with enabling garbage collection(GC) logs using the same JMeter script for 20 minutes with 200 concurrent users. 

Note: If you don’t know how to enable GC log, see this post: ‘How to enable GC logs ?

Test Results

We captured average CPU and memory utilization from the AWS Cloudwatch and average response time and throughput from the JMeter tool. Data collected from both scenarios are summarized in the below table.

Data CollectedBaseline testEnabled GC test
Avg CPU Usage8.35%10.10%
Avg Memory Usage20.80%20.50%
Avg Response Time3901 ms3881 ms
Avg Throughput24.4/sec24.5/sec

As you can see there is no noticeable difference in the CPU and Memory consumption. Similarly there is no noticeable difference in the average response and transaction throughput. 

Conclusion

Thus based on our study we can conclude that there is no noticeable overhead in enabling the garbage collection log file. Given the benefits we get by enabling the Garbage collection log, you can consider enabling GC logging on all your production instances.

Published on Java Code Geeks with permission by Ram Lakshmanan, partner at our JCG program. See the original article here: Overhead added by Garbage Collection Logging

Opinions expressed by Java Code Geeks contributors are their own.

Ram Lakshmanan

Ram Lakshmanan developed world's finest DevOps tools: GCeasy.io, fastThread.io, HeapHero.io. Every single day, millions & millions of people in North America—bank, travel, and commerce—use the applications that Ram Lakshmanan has architected. Ram is an acclaimed speaker in major conferences on scalability, availability, and performance topics. Recently, he has founded a startup, which specializes in troubleshooting performance problems.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button