Which GC (Garbage Collection) strategy do you prefer for your app in new Java?

 Hi awesome community!

 

During conversation with community members, I see a lot of users used standard Garbage Collector. Also, Java world is provide a lot of interesting new things around GC and deprecated as well. 

Let's see what kind of GC supported by adoptJDK, OpenJDK, Oracle (excluding commercial builds).

  • Serial
  • Parallel
  • Concurent Mark Sweep (CMS)
  • G1
  • Shenandoah
  • ZGC
  • Epsilon (only for measuring)

I will link JEPs as possible, for clear overview.

Also, about Memory management and a good explaining about Serial, Parallel, CMS you can read on oracle site. e.g.

https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html

To be a brief, I have uploaded that picture

image.png

 

 

Hence I will upload a picture how works the 2 first algorithms

image.png

Concurent Mark Sweep

image.png

From Java 9, it marks as deprecated

You will see the message in your console

Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

As suggestion switch into G1GC or other GC.

 

G1

Introduced on Java 9 as default, If you use a JDK of lower release, G1 can be enabled with the -XX:+UseG1GC parameter. On last 2018 year, Atlassian set into setenv.sh for most of products key -XX:+UseG1GC.

image.png

Also, you can use string deduplication option

 

Shenandoah

Very strict for GC pauses

image.png

https://wiki.openjdk.java.net/display/shenandoah/Main

 

 

ZGC

Introduced on Java 11. 

Low latency.

https://wiki.openjdk.java.net/display/zgc/Main

 

Epsilon GC

Please, have a look into source for what it can be needed

In my use case, it can be covered to understand the heap size, leaks on test env. Hence I can decrease time for dancing with parameters on production env. 

Maybe that GC actively used by Atlassian developers and vendors developers as well.

 

Conclusion

I hope most of users will continue use G1 or will upload experiences with working with new algorithms. Also, will switch from CMS. 

Just also, very interesting to see performance results  C4 GC from AzulVM.

 

Cheers,

Gonchik Tsymzhitov

Comments

  1. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. junk removal pittsburg ca

    ReplyDelete
  2. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. junk removal pittsburg ca

    ReplyDelete

Post a Comment

Popular posts from this blog

Let's check installed apps dependency to be compliant for OWASP Dependency-Check

Jira: Housekeeping or continuous cleanup of the Agile activity artifacts

Atlassian Community, let's collaborate and provide stats to vendors about our SQL index usage