JDK-7189147 : GC threads should be created as needed not all at once
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8-pool
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2012-08-03
  • Updated: 2023-11-06
  • Resolved: 2023-11-05
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.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
Currently the GC threads are created all at once and put to use as soon as the JVM startsup.  That may not be necessary, especially on systems with large number of HW strands that would create hundreds of GC threads.  AppServers would benefit more since the spend much of their startup loading classes and the such.  Instead I propose an alternative:

Create a small GC thread pool on startup capped at some resonable (16 threads?) and then create more threads based on some heuristic.  Ideas are allocation rate, heap size, etc

Once the system has entered some steady state, GC threads could come and go as needed and depending on load (this is more useful for concurrent collectors such as G1).  I may not want to use 40% of my system to GC when I really need to finish some critical aspect of my application (JBB2012 ops come to mind here).

Comments
UseDynamicNumberOfGCThreads has been limiting the number of threads initially created for a long time. Fixed by JDK-6858051 and enabling UseDynamicNumberOfGCThreads. And later JDK-8198547 made UseDynamicNumberOfGCThreads true by default.
05-11-2023

As I understand it, -XX:+UseDynamicNumberOfGCThreads still creates the maximum number of GC threads at JVM startup and then utilizes only some of them during collections. Thread creation can be expensive in both time and space (stacks) on machines with large numbers of cores.
13-09-2013