JDK-8010202 : Remove CMS foreground collection
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2013-03-18
  • Updated: 2014-12-03
  • Resolved: 2014-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Duplicate :  
Relates :  
The foreground collections in CMS make the code very complex. The state transitions are very complex.

A STW foreground collection can pick up where a concurrent background collection left off to try to avoid a full GC. This is nice but normally it has worse performance than a full GC.

Also, to enable foreground collections the either of UseCMSCompactAtFullCollection or CMSFullGCsBeforeCompaction has to be set correctly on the command line ( CMSCollector::decide_foreground_collection_type()).

This means that foreground collections are most likely not being used a lot.

Here is some background from an email conversation with Jon Masamitsu:

"I cannot point to a particular customer but I think it was
CBOE that had CMSFullGCsBeforeCompaction
set on its command line.   I talked to them about it
and they said that they considered a full GC as
a failure and if they could avoid it by continuing the
collection in the foreground, then they had a chance
of surviving without the full GC.  Of course, the issue
is the pause time and if the collection in the foreground
took a long time to finish, then it was still a failure but
once in a while it was not.

Having said that I think that it performs very poorly
and should be fixed or removed.  A collection in the
foreground takes much longer than a full GC whenever
I've seen it happen.   The foreground collection should
only be done if CMS is currently sweeping and I
really think it will be effective if sweeping is made

So, the suggestion is to remove the support for foreground collections and instead introduce a mechanism for doing the sweeping in a STW parallel fashion if we have to. This enhancement request should focus on removing the foreground collection. After JDK-6798836 has been implemented we can add the feature to do STW parallel sweeping.