New Features

New Java-based garbage collector

For this 6.1.0-Warcraft release of Onesait Platform we have been testing and supporting the new Java Garbage Collector, called ZGC, which allows to minimise JVM pause times making it very suitable for low latency and high throughput applications.

From this version onwards, therefore, it will be possible to enable this Garbage Collector for environments that require it.

What does it consist of?

Gargabe Collector Z is a rather novel garbage collection algorithm introduced by Oracle in JDK 11 with the aim of minimising application pause times in the Java Virtual Machine (JVM), which makes it a very opportune option for modern applications that require extremely low latency and high performance, as we said in the introduction.

The approach of this collector is generational, dividing the available memory into two main generations: the young generation and the old generation (or mature generation). The young generation is further subdivided into the ‘Eden’ space and two ‘Survivor Spaces’, while the old generation is where long-lived objects are relocated.

Features

This collector is characterised by:

  • A focus on low latency: The most prominent feature of the ZGC is its ability to guarantee consistently short pause times. This is achieved by minimising ‘stop the world’ (STW) pauses, where all application threads are stopped for garbage collection. This makes it an excellent choice for applications that require near-instantaneous responses, such as e-commerce systems, financial services and real-time gaming.
  • Scalability: It is designed to efficiently manage very large amounts of memory, from a few gigabytes to several terabytes. This ability to handle large volumes of data makes it particularly useful for memory-intensive applications such as data analytics systems, in-memory databases and Big Data applications.
  • Concurrent Phases: It has the ability to perform critical garbage collection tasks, such as tagging, object relocation and reference processing, concurrently with application threads. This means that most of the garbage collection work is performed without stopping application execution, significantly minimising STW-type pauses.
  • Consistent and Predictable Performance: is designed to provide stable and predictable performance. It seeks to keep pause times within a predefined limit, which is crucial for applications with strict latency requirements. This is especially important in production environments where interruptions can severely impact user experience or system performance.
  • Compressed Oops support: Compressed Oops (Ordinary Object Pointers) is supported, allowing you to work efficiently with 32-bit references even on 64-bit platforms. This results in a more efficient use of memory, as it reduces the space needed to store references to objects in the heap.

Advantages over other collectos

Unlike other traditional garbage collectors, such as G1 or Parallel GC, which can have longer pause times as heap size increases, ZGC maintains low pause times regardless of heap size. This makes it especially useful for applications that require a consistent and fast response time, regardless of workload or memory size.


Header Image: Cristian Macovei en Unsplash
DZone: Java Z Garbage Collector (ZGC): Revolutionizing Memory Management

✍🏻 Author(s)

Leave a Reply

Your email address will not be published. Required fields are marked *