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
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • JVM Memory Architecture and GC Algorithm Basics
  • All You Need To Know About Garbage Collection in Java
  • Choosing the Best Garbage Collection Algorithm for Better Performance in Java
  • Introduction Garbage Collection Java

Trending

  • Caching 101: Theory, Algorithms, Tools, and Best Practices
  • How to Format Articles for DZone
  • After 9 Years, Microsoft Fulfills This Windows Feature Request
  • Infrastructure as Code (IaC) Beyond the Basics
  1. DZone
  2. Coding
  3. Languages
  4. CMS Deprecated. Next Steps?

CMS Deprecated. Next Steps?

After the CMS GC algorithm was depreciated in JDK 9, what's the best approach for your existing applications?

By 
Ram Lakshmanan user avatar
Ram Lakshmanan
DZone Core CORE ·
Updated Jan. 04, 21 · Analysis
Likes (11)
Comment
Save
Tweet
Share
32.3K Views

Join the DZone community and get the full member experience.

Join For Free

The popular Concurrent Mark Sweep (CMS) GC algorithm is deprecated in JDK 9. According to JEP-291, this decision has been made to reduce the maintenance burden of the GC code base and accelerate new development.

Thus, from Java 9 onwards, if you launch the application with -XX:+UseConcMarkSweepGC (an argument which will activate the CMS GC algorithm), you are going to see below WARNING message:

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.


Why Is Our CMS Deprecated?

If there is a lot of baggage to carry, it’s hard to move forward quickly. That is what's happening in the case of CMS as well. CMS is a highly configurable, sophisticated algorithm and thereby causes a lot of complexities to the GC code base in JDK. Only if the JDK development team can simplify the GC code base, they can accelerate and innovate in GC arena. The table below summarizes the number of JVM arguments that can be passed to each GC algorithm.

 GC Algorithm

JVM arguments(approximately)

Common to all

50

Parallel

6

CMS

72

G1

26

ZGC

8


There are around 50 GC-related arguments can be passed to JVM, which is common to all GC algorithms. On top of these 50 arguments, just for CMS alone, you can pass 72 additional arguments. This is a much greater number of arguments than any other GC algorithms, as summarized in the above table. Thus, you can see the coding complexity required by the JDK team to support all these arguments.

What Are the Next Steps if You Are Using CMS?

As far as I can tell, I see three different choices in front of us:

  1. Switch to G1 GC algorithm
  2. Switch to Z GC algorithm (Early access in JDK 11, 12)
  3. Continue with CMS

Let’s explore each option in this section.

(1). Switch to G1 GC Algorithm

G1 GC has become the default GC algorithm since Java 9. So, you may consider moving your application to this algorithm. It may provide better performance characteristics than the CMS GC algorithm. It’s much easier to tune as there are comparatively a smaller number of arguments. Also, it provides options to eliminate duplicate strings from memory. If you can eliminate duplicate strings, it may help you bring down the overall memory footprint.

(2). Switch to Z GC Algorithm

Z GC is a scalable, low-latency garbage collector. Its goal is to keep GC pause times less than 10ms. Early access of Z GC algorithm is available in Java 11 and 12. So if your application is running on Java 11 or 12, you may consider upgrading to Z GC algorithm. Our preliminary analysis of Z GC is showing excellent results.

(3). Continue With CMS

For certain applications, we have seen CMS to delivery spectacular results that aren’t matched by G1 GC, even after a lot of tuning. So, if you have explored the other two options and convinced the CMS algorithm is the marriage made for your application in heaven, you can consider running with the CMS algorithm itself. There are even arguments continuing to keep CMS alive in this OpenJDK JDK9-dev mailing list. Based on my own personal experience, I am seeing the features and APIs deprecated in Java 1.1 continuing to exist even in Java 12 (even after 20 years). It seems all deprecated APIs and features seem to survive (and never truely die). Thus, continuing to run on CMS is also an option. Of course, it’s your call as well as your application stakeholder's call.

Conclusion

Note that each application is unique and different. So, don’t get carried away by the journals and literature you find on the Internet talking about GC tuning/tweaking (including this article). When you instrument a new GC setting, do thorough testing, benchmark performance characteristics, study these KPIs, and then make a conscious decision.

Good luck!

Content management system garbage collection Algorithm Java (programming language) application

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

Opinions expressed by DZone contributors are their own.

Related

  • JVM Memory Architecture and GC Algorithm Basics
  • All You Need To Know About Garbage Collection in Java
  • Choosing the Best Garbage Collection Algorithm for Better Performance in Java
  • Introduction Garbage Collection Java

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!