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

More than 20X slowdown for ManagementFactory.getGarbageCollectorMXBeans()

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • P4
    • Resolution: Unresolved
    • 9, 10, 11, 12, 13, 14, 15, 16
    • tbd
    • core-svc

    Description

      We noticed a large slowdown from ManagementFactory.getGarbageCollectorMXBeans() comparing JDK 8 and JDK 11. The culprit is probably JDK-8065213, which changes it to call stream().flatMap().collect() underneath.

      Using the attached simple loop program, with -XX:-TieredCompilation, JDK 8 takes ~0.2 seconds, JDK 11 takes ~4.5 seconds.

      This method is important for some programs that repeatedly call it to collect statistics about GC. Such a program could cache the returned list of this method. However, according to JavaDocs, the JVM "may add or remove GarbageCollectorMXBean during execution", so caching is not an ideal solution.

      Attachments

        Activity

          People

            Unassigned Unassigned
            manc Man Cao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: