Long garbage collection pause due to single-threaded CMS initial mark

Solution Unverified - Updated

Environment

  • OpenJDK
  • Oracle JDK
  • CMS (low pause) collector

Issue

  • CMS initial mark phase is serial / single-threaded (user ~= real time):
[GC [1 CMS-initial-mark: 1962869K(8388608K)] 2380861K(10424128K), 4.7281533 secs] [Times: user=4.74 sys=0.01, real=4.73 secs] 

Resolution

Add -XX:+CMSParallelInitialMarkEnabled (JDK7), or replace -XX:-CMSParallelInitialMarkEnabled with -XX:+CMSParallelInitialMarkEnabled to enable multi-threaded initial marking.

Root Cause

CMS initial marking is disabled by default in JDK7. It can also be disable with the -XX:-CMSParallelInitialMarkEnabled (note - vs +).

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.