Is -XX:+UseG1GC the correct replacement for -Xincgc?

牧云@^-^@ 提交于 2019-11-29 04:05:22

For Oracle/OpenJDK 8 the default collector on most machines is the Parallel Throughput Collector, except for some 32bit windows machines where it can be the Serial GC.

Xincgc is CMS in incremental mode. The main benefit you're seeing probably is caused by switching from the Throughput Collector to CMS, not from the incremental mode, which is designed for single-core CPUs.

Incremental Mode is also deprecated, so simply enable CMS via -XX:+UseConcMarkSweepGC and see if that works for you.

Of course you can also try G1GC, which is also designed to reach low pause time goals and has the advantage that it does not suffer from fragmentation like CMS does and thus is less likely to experience concurrent mode failures which result in a single-threaded stop the world collection.

So, try both and measure.

See also: Oracle's Java 8 GC Tuning Guides

Until this option completely deprecated by Oracle in the newer version. We could still use this, by applying the following jvm params:

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps

The later 2 params are for logging on GC activities.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!