Automatic Garbage Collection was first introduced in 1962 in the Lisp programming language. In 1995, when Java came into existence, it embraced the automatic garbage collection in full scale and really popularized it. Since then, most of the popular programming languages that have come have this automatic garbage collection capability. Garbage Collection has tremendously evolved over the years. In this post, I would like to share 4 important emerging trends and innovations that are happening in the field of Garbage Collection:

1. Pause less GC

2. Improved GC Performance

3. Self-Tuning GC

4. AI assisted GC Tuning Tools

Let’s discuss these trends in detail.

1. Pause Less GC

A major complaint that is placed on automatic Garbage Collection is the pause time. i.e. whenever GC events run, it pauses our application. No customer transactions will be processed when GC pauses are happening. This results in increased computing costs and degraded response time

In the future, we are going to see Garbage Collection run without any pauses. In fact, even today we have the Azul JVM which supports pause-less garbage collection. However, Azul JVM needs more memory & CPU (than regular JVMs) and it also needs specialized appliances to run. In future, regular OpenJDK Garbage Collection algorithms will support this pause less garbage collection technology and they can run on any regular commodity hardware.

2. Improved GC Performance

There is a famous saying: “If You Can’t Measure It, You Can’t Optimize It”. Similarly, when it comes to Garbage Collection performance there are 3 primary Key Performance Indicators, that we should measure:

a. GC Throughput indicates the amount of time JVM spends in processing application transactions vs garbage collection. One should target to achieve high throughput

b. GC Latency indicates the pause time of every GC event. One should target to achieve Low Latency.

c. GC Footprint indicates the overhead added by the automatic Garbage Collection. One should target to achieve a low footprint.

In future, we are going to see GC algorithms performance increase several folds. We are going to see high throughput, low latency applications with very minimal footprint GC algorithms.

3. Self-Tuning GC 

We are living in a world of FSD (Fully Self Driving) cars, where cars are able to drive themselves on busy roads. Similarly, GC will self-tune itself when appropriate goals are set. Even today there are JVM parameters, where you can set soft goals. Example: -XX:MaxGCPauseMillis. Let’s say you configure the value as 200 to this JVM parameter, then JVM will try to keep your average GC Pause time under 200 milliseconds. However, today this is only a soft goal and not 100% honored. Future GC algorithms will evolve, they will become more robust and honor the goals more precisely.

4. AI Assisted GC Tuning Tools

Fig: GCeasy Machine Learning Algorithms Recommendation

GC Tuning tools will evolve. It will use Machine Learning algorithms to model & simulate the GC behavior and come up with appropriate GC settings for your application. Even today, tools like GCeasy leverage ML algorithms to come up with generic GC settings and recommendations for your application. These tools will evolve, to provide more precise JVM settings that will enhance your application’s performance several folds

Conclusion

There is a famous saying: ‘Only thing that is constant is change’ :-). It’s true everywhere, including automatic Garbage Collection. Let’s see where this super interesting space of automatic garbage collection heads towards.