When does the CMS collector run by default

Assuming no other flags are set, when the tenured generation heap is 90% full. We have an 7968MB heap, and a 2048MB young generation. As such, our tenured generation is approximately 5920M.

Below we show the initial mark starts at just over 90%.

The default is 90%, even though the default value shows as -1.

-bash-4.1$ jinfo -flag CMSInitiatingOccupancyFraction $(pgrep java)
-XX:CMSInitiatingOccupancyFraction=-1
-bash-4.1$

As such, is 90% hardcoded in the java source code? A future post will provide input based on what we find in the OpenJDK source code.

UPDATE: 2017/07/04

Oracle actually documents the 92% at the following link:

https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/cms.html

Specifically, the following…

“A concurrent collection also starts if the occupancy of the tenured generation exceeds an initiating occupancy (a percentage of the tenured generation). The default value for this initiating occupancy threshold is approximately 92%, but the value is subject to change from release to release. This value can be manually adjusted using the command-line option -XX:CMSInitiatingOccupancyFraction=, where is an integral percentage (0 to 100) of the tenured generation size.”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.