JDK-8198547 : Enable UseDynamicNumberOfGCThreads by default
  • Type: CSR
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-02-22
  • Updated: 2018-03-13
  • Resolved: 2018-03-12
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Determine the upper limit for the number of threads GC should use based on heap size by setting UseDynamicNumberOfGCThreads as default.

Problem
-------

Garbage collectors currently size the number of threads to use to the number of available CPU resources.

This is a very bad fit for running smaller VMs (installers, ...) with tens or low hundreds of MB of heap sizes as even in this case tens of threads are being created at startup and later used during gc.

This leads to delayed startup, and inefficient use of thread resources - actually in many cases using less threads for GC work if there is little work to do improves pause times due to synchronization overhead.

Hotspot already has the command line option UseDynamicNumberOfGCThreads which limits the number of threads based on heap size. However this feature is currently turned off by default.

Solution
--------

Set the default value of the existing flag "UseDynamicNumberOfGCThreads" to true.

Specification
-------------

    diff -r 2a12ff1fff68 src/hotspot/share/runtime/globals.hpp
    --- a/src/hotspot/share/runtime/globals.hpp     Tue Mar 06 10:30:24 2018 +0100
    +++ b/src/hotspot/share/runtime/globals.hpp     Tue Mar 06 12:57:37 2018 +0100
    @@ -1430,9 +1430,10 @@
                 "Use semaphore synchronization for the GC Threads, "            \
                 "instead of synchronization based on mutexes")                  \
                                                                                 \
    -  product(bool, UseDynamicNumberOfGCThreads, false,                         \
    -          "Dynamically choose the number of parallel threads "              \
    -          "parallel gc will use")                                           \
    +  product(bool, UseDynamicNumberOfGCThreads, true,                          \
    +          "Dynamically choose the number of threads up to a maximum of "    \
    +          "ParallelGCThreads parallel collectors will use for garbage "     \
    +          "collection work")                                                \
                                                                                 \
       diagnostic(bool, InjectGCWorkerCreationFailure, false,                    \
                  "Inject thread creation failures for "                         \


Comments
Change seem reasonable. Please consider whether or not a release note is warranted for this change. Moving to Approved.
12-03-2018

Reviewed CSR. The fix is simple and testing show no obvious regressions.
07-03-2018

Summary from Performance: Running +UseDynamicNumberOfGCThreads through our promotion benchmarks, we see no significant changes on throughput benchmarks (a few false positives/negatives as usual), but definitely a slew of footprint and startup improvements. So this seems like a win with no obvious tradeoffs.
26-02-2018