Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8196989

Revamp G1 JMX MemoryPool and GarbageCollector MXBean definitions

    Details

    • Type: Enhancement
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 11, 12
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Subcomponent:
      gc
    • Understanding:
      Fix Understood
    • CPU:
      generic
    • OS:
      generic

      Description

      The original JMX proposal came from Erik Helin, Thomas Schatzl and Stefan Johansson.

      ---------

      The current JMX memory pool and collector definitions for the G1 collector don't reflect reality well, thus should be replaced with ones that do. I expect to ask for a backport to a JDK 11 update release, and possibly JDK 8, so users can transition their code independent of a JDK 8/10 to JDK 11 migration.

      No JMX specification change is necessary, since the per-JVM ManagementFactory and per-collector GarbageCollector MXBeans MemoryPools are left undefined by the specification.

      An attempt was made to merge old and new definitions in a compatible way, but foundered on the problem of iterating over G1s GarbageCollectorMXBeans: old and new versions would overlap functionality in ways that cannot be reconciled. The new definitions will be the default, but for compatibility, a new -XX:+G1UseLegacyMonitoring Hotspot switch will revert to the current definitions.

      The three existing MemoryPoolMXBeans

      "G1 Eden Space" : eden
      "G1 Survivor Space" : survivor space
      "G1 Old Gen" : old generation, including humongous regions

      are replaced with five

      "G1 Eden Space" : eden
      "G1 Survivor Space" : survivor space
      "G1 Old Space" : old generation (now a "space" rather than a "gen", and does not include regions containing humongous or archive objects)
      "G1 Humongous Space" : humongous space (regions containing humongous objects)
      "G1 Archive Space" : class data sharing metadata space, a read-only space

      These five spaces are address-wise disjoint, though logically the "G1 Archive Space" is part of the "G1 Old Space". All existing code assumes that memory pools are address-wise disjoint.

      The new "G1 Humongous Space" has usage thresholds enabled. Only the "G1 Old Space" has thresholds enabled in the legacy model.

      The two existing GarbageCollectorMXBeans

      "G1 Young Generation" : incremental collector, pure young and mixed collections
      "G1 Old Generation" : stop-the-world full heap collector

      are replaced with four. They and the memory pools they affect are

      "G1 Young" : incremental pure young generation collector
          "G1 Eden Space"
          "G1 Survivor Space"
          "G1 Humongous Space"
      "G1 Mixed" : incremental young + partially old collector
          "G1 Eden Space"
          "G1 Survivor Space"
          "G1 Humongous Space"
          "G1 Old Space"
      "G1 Full" : stop-the-world full heap collector
          "G1 Eden Space"
          "G1 Survivor Space"
          "G1 Humongous Space"
          "G1 Old Space"
          "G1 Archive Space"
      "G1 Concurrent Cycle" : a concurrent cycle
          "G1 Humongous Space"
          "G1 Old Space"

      The CollectionTime attribute for the "G1 Concurrent Cycle" collector is the total of a concurrent cycle's stop-the-world wall clock time. An associated young collection is reported as a separate event.

      As with the current definition, MemoryPool Usage.max attributes are the maximum heap size (-Xmx) for "G1 Old Space" and -1 (undefined) for the other memory pools. This definition is compatible with iteration over a GarbageCollector's memory pools to sum the positive values of "max" and get something reasonable. Further, for all collectors, the sum of "max" minus the sum of "committed" results in the total uncommitted memory, and the sum of "max" minus the sum of "used" results in the total free memory.

      The "G1 Archive Space" is associated with the "G1 Full" GarbageCollector, even though it will never be collected. Its Usage init, committed and used sub-attributes are all the same value, and its max sub-attribute is -1.

      ----------

      JFR currently identifies three garbage collectors, New, Old, and Full. These correspond to the "G1 Young", "G1 Mixed", and "G1 Full" collectors, respectively. There are no changes to JFR event definitions.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                phh Paul Hohensee
                Reporter:
                phh Paul Hohensee
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: