Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a replacement for the garbage collection JVM args in Java 11?

In Java 11 a number of JVM args relating to GC logging are not supported anymore. What, if anything, can they be replaced with, if we still want to use GC logging? In particular, this relates to the following JVM args:

-Xlog:gc:work/logs/gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles -XX:GCLogFileSize 

Thanks.

like image 374
martin_wun Avatar asked Jan 11 '19 10:01

martin_wun


People also ask

What is the default garbage collector in Java 11?

G1GC. The default garbage collector in Java 11 is the G1 garbage collector (G1GC). The aim of G1GC is to strike a balance between latency and throughput. The G1 garbage collector attempts to achieve high throughput by meeting pause time goals with high probability.

Which is the best garbage collector in Java?

Z Garbage Collector (ZGC) ZGC is a low-latency garbage collector that works well with very large (multi-terabyte) heaps. Like G1, ZGC works concurrently with the application. ZGC is concurrent, single-generation, region-based, NUMA-aware, and compacting.

Can you force JVM to do garbage collection?

You really can't force Java GC. The Java garbage collection algos are non-deterministic, and while all of these methods can motivate the JVM to do GC, you can't actually force it.

What is the default garbage collector in Java?

G1 Garbage Collector is the default garbage collection of Java 9. G1 collector replaced the CMS collector since it's more performance efficient. How G1 Garbage Collector works is different from other collectors. Unlike other collectors, the G1 collector partitions the heap space into multiple equal-sized regions.


1 Answers

List of your <arguments, current mapping, reasons> is as follows:

-XX:+PrintGCTimeStamps     -XX:+PrintGCDateStamps    ==>  decoration options                                -Xlog:::time,level,tags 

-XX:+PrintGCDetails       ==>  -Xlog:gc* 

-XX:+PrintGCApplicationStoppedTime ==> -Xlog:safepoint 

Note: PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and not separated in the new logging.


-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles     -XX:GCLogFileSize          ==>  output options                                 -Xlog::::filecount=5,filesize=1024 

The bits that are handled by the framework do require tweaking

Reference: The documentation I've referred to and request you to follow for such migration details.

like image 173
Naman Avatar answered Sep 22 '22 18:09

Naman