Explore 3 Popular Myths About Garbage Collection

Explore 3 Popular Myths About Garbage Collection

There are 3 highly popular myths about garbage collection. Let’s review those myths and the actual truth behind them.

Myth #1: Minor GCs don’t pause the application

There are different types of garbage collection events: Minor GC event, Major GC event & Full GC event. It’s been proposed that Minor GC are harmless, as they don’t pause the application. However Major/Full GC are dangerous because they pause the application.

Truth

This is a lie. 100% lie. Minor GCs do pause the application. Minor GC pause times are comparatively lower than other GC events, most of the time. Thus, they could be called “harmless.” However, in some cases, we have seen Minor GCs take more time than all the Major/Full GC events. Thus, when tuning your application, pay proper attention to Minor GC pause time metrics as well.

Myth #2: Serial GC performance is horrible

There are several types of garbage collection algorithms:

  1. Serial GC
  2. Parallel GC
  3. Concurrent Mark & Sweep (CMS) GC
  4. G1 GC
  5. Shenandoah GC

Each GC algorithm exhibits its unique performance characteristics. An incorrect education industry has been saying that serial GCs are not meant for serious applications. Serial GC performance characteristics are horrible, and they should be used only during development time or in prototype applications.

Truth

To validate this theory, we conducted a study on a major B2B travel application in production, which processes more than 70% of North America’s leisure travel transactions. We configured a couple of servers to use the latest ‘G1 GC’ algorithm and a couple of servers to use the ‘Serial GC’ algorithm. We just used vanilla G1 GC and Vanilla Serial GC settings. We didn’t pass any additional GC tuning parameters. Details about this study can be found here.

The results were that Serial GC performance to be comparable (in fact slightly better than) to G1 GC algorithm. Of course, with proper tuning and parameters settings, G1 GC can be made to run better than Serial GC. The take away is, Serial GC is not as bad as it’s portrayed.

Myth #3: garbage collection is automatic. I don’t have to worry about it.

I have heard a few developer friends saying, “garbage collection is automatic. I don’t have to worry about it.”

Truth

The first part is true, i.e. “garbage collection is automatic” on all modern platforms — JVM (Java Virtual Machine), ART (Android Run Time). But the second part is not so true. You do have to worry about it. Garbage collection is automatic, but it’s not free. It comes with a price. In fact, the price can be very expensive. Poor garbage collection can lead to:

  • Unpleasant user experience (SLA Breaches)
  • Increase in the bill from cloud hosting providers
  • Can put the entire application availability at risk

To learn about the profound impact of garbage collection, you may consider reading this article.

Author bio: Ram Lakshmanan

ram-lakshshman

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 that specializes in troubleshooting performance problems.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as