Skip to main content

JDK 11 have nasty surprise? It has fast, scalable and easy to tune new garbage collector i.e. ZGC?

Java 11 is ready with new exciting features and it have nasty surprises as well, It have a newly designed Garbage Collector which is fast, scalable and easy to tune. Let's find out what is it. It is one of the most exciting feature in JDK 11. This brand new Garbage Collector, ZGC, which is being developed by Oracle that promises very low pause times on multi-terabyte heaps. JVM tuning will not be a tedious job because it is easy to tune as well. It is an experimental feature in JDK 11 later on it will available as full feature. It is scalable low latency Garbage Collector which means 
it will have pause time less than 10ms no matter how big your heap is. 
it is scalable, it can handle multi-terabyte heaps without affecting the performance. 
Key features of ZGC are :
1. Concurrent 
  • Marking
  • Relocation/compaction
  • Relocation set selection
  • reference processing 
  • StringTable cleaning
2. Single Generation
3. Load barriers
4. Colored pointers
5. Region based : heap is divided into small regions 
6. Partial compaction
7. Non-uniform memory access (NUMA) aware 
ZGC pause times do not increase with heap or live-set size.
Lets have a quick look at ZGC cycle:
1 - Pause Mark Start : This cycle start with this phase where thread stack scanned to find out the object pointers i.e roots. it is a time expensive operation because here GC needs to walk through the entire object graph.
2 - Pause Mark End : This phase is also known as synchronization point, to coordinate with marking phase. At the end of this phase GC will known the liveness of the objects which means GC will get to know which object is live and which is garbage. It also perform some more operations concurrently like 
  • reference processing and weak root cleaning: where GC takes care of soft, weak, and Phantom references and finalization. 
  • relocation set collection: where GC figures out which part of heap needs to be compacted to free up the memory.
3 - Pause Relocation Start : Here thread stacks are get scanned to handle roots pointing into the location sets then compacting the heap happens. Compacting the heap is also a time expensive operation because GC need to free up large contiguous chunks of memory and get back the memory available for new allocations.
This is end of GC cycle and this entire cycle gets completed in less than 10ms.

How to get started with JVM tuning with ZGC
Enable :
-XX : +UnlocakExperimentalVMOption (to enable the experimental feature in JVM)
-XX : +UseZGC
Tuning :
-Xmx <size> (Setting the max size)
-XX : ConcGCThreads=<number> (setting up the no of GC threads)
Logging :
-Xlog : gc (basic)
-Xlog : gc* (detailed logging)

Keep reading the articles, we are trying our best to get the best informative article on Java latest versions. 

Also read the following topics to get understand entire garbage collection process in Java. 

Comments

Top 5 Most Read Posts

Who is Peter Lynch and what is his philosophy in equity market investment? 25 Golden Rules of the most successful Fund Manager.

Peter Lynch (born January 19, 1944) is an American investor, mutual fund manager, and philanthropist. As the manager of the Magellan Fund at Fidelity Investments between 1977 and 1990, Lynch averaged a 29.2% annual return, consistently more than doubling the S&P 500 stock market index and making it the best-performing mutual fund in the world. During his 13 year tenure, assets under management increased from $18 million to $14 billion. He also co-authored a number of books and papers on investing and coined a number of well known mantras of modern individual investing strategies, such as Invest in what you know and ten bagger. Lynch is consistently described as a "legend" by the financial media for his performance record. Base on his career I have compiled his investing rules here. 25 GOLDEN RULES by @Peter Lynch 1: Nobody can predict interest rates, the future direction of the economy or the stock market. Dismiss all such forecasts & concentrate on what's actual...

What is version checking in Hibernate ?

Version checking used in hibernate when more then one thread trying to access same data. For example : User A edit the row of the TABLE for update ( In the User Interface changing data This is user thinking time) and in the same time User B edit the same record for update and click the update. Then User A click the Update and update done. Change made by user B is gone. In hibernate you can prevent slate object updation using version checking. Check the version of the row when you are updating the row. Get the version of the row when you are fetching the row of the TABLE for update. On the time of updation just fetch the version number and match with your version number (on the time of fetching).

What is wrong with HDFC securities? Are they doing some fraudulent activities or just causing issues with their platform as usually it don't work during market hours?

I have opened a DEMAT account with HDFC Securities in 2019 as HDFC group is well known for the customer services and I also hold a salary account with HDFC Bank, DEMAT account with the following conditions/offers as expressed by the executive. Trading Account Opening Charges (One Time) :  ₹999 (At that time it offered on lower price, I forget the exact price) Trading Annual Maintenance Charges AMC (Yearly Fee) : ₹0 Demat Account Opening Charges (One Time) : ₹0 Demat Account Annual Maintenance Charges AMC (Yearly Fee) : ₹750, nil if portfolio value below ₹2 lacs. Equity Delivery : 0.50% Equity Intraday : 0.05% Equity Futures : 0.05% Equity Options : ₹100 per lot or 1% of the premium (whichever is higher) Currency Futures : ₹23 per contract Currency Options : ₹20 per contract Commodity Futures : 0.02% for Intraday / 0.025% for positional Commodity Options : 0.02% for Intraday / 0.025% for positional It was going good but after 2-3 months I got to know that there are...

Fundamental Analysis : Asian Paints Ltd.

Asian Paints group is the largest paint manufacturer in India also engaged in the business of manufacturing of varnishes, enamels or lacquers, surfacing preparation, organic composite solvents and thinners. It operates in 15 countries and has 26 paint manufacturing facilities in the world serving consumers in over 60 countries. Besides Asian Paints, the group operates around the world through its various brands viz. Asian Paints Berger, Apco Coatings, SCIB Paints, Taubmans, Causeway Paints and Kadisco Asian Paints. It also manufactures metal sanitary ware such as bath, sinks, washbasins and similar articles. Recently introduced Lightings, Furnishings and Furniture thus adding more products in the Home décor and Interior Design category. Market Cap ₹ 244,763 Cr. Current Price ₹ 2,552 High / Low ₹ 2,873 / 1,483 Stock P/E 89.0 Book Value ₹ 115 Dividend Yield 0.47 % ROCE 33.8 % ROE 27.5 % Face Value ₹ 1.00 Price to book value 22.2 EPS ₹ 28.7 High price all time ₹ 2,873 Low price all time ₹...

What are JEE Containers? What are their different types?

Containers are the interface between a component and the low-level, platform-specific functionality that supports the component. Before it can be executed, a web, enterprise bean, or application client component must be assembled into a Java EE module and deployed into its container. The assembly process involves specifying container settings for each component in the Java EE application and for the Java EE application itself. Container settings customize the underlying support provided by the Java EE server, including such services as security, transaction management, Java Naming and Directory Interface (JNDI) API lookups, and remote connectivity. Here are some of the highlights. The Java EE security model lets you configure a web component or enterprise bean so that system resources are accessed only by authorized users. The Java EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a ...