JDK-8134151 : Tune object monitor provisioning
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2015-08-21
  • Updated: 2021-01-07
  • Resolved: 2020-11-11
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Threads currently maintain a local list of ObjectMonitor objects which they provision from the global list. The stated reason for this construct is both to reduce contention on the global list mutex, and to reduce coherency traffic between monitors. Since JDK-8049737 removes the latter concern by padding out monitors, we only have the concern that we might see contention on the global mutex left, thus limiting the usefulness of having threads provision large chunks of monitors.

There's a compelling argument to make this tunable: By allowing user to set the number of monitors provisioned as low as to 1 would additionally be a worthwhile for applications tuned for low footprint overhead. Experiments have shown a reduction in footprint by 20-50MB on some setups of SPECjEnterprise2010 is manageable without a noticeable throughput or latency cost by reducing the MAXPRIVATE constant. Additionally the current options to limit the monitor population (-XX:MonitorBound=#) fails to take into account that a large proportion of the object monitors will be unused but held by threads on their local provisioning queue. This addition would work together with and not compete with -XX:MonitorBound for those users who wish to constrain the footprint overhead further.

In summary: There's a current limit of 1024 monitors provisioned per thread, with an implicit initial value of 32. I propose making these constants into flags, as well as reducing their default values from 1024 and 32 down to 256 and 8 to make JDK9 locking changes footprint neutral to end users without tuning.
Comments
JDK-8253064 has been integrated. Closing this bug as a duplicate.
11-11-2020

Erik and Dan's work on this bug: JDK-8253064 monitor list simplifications and getting rid of TSM will delete the per-thread in-use and free lists so this bug can be closed as a duplicate if/when JDK-8253064 gets integrated.
05-11-2020

The cache line padding improvement may contribute to make the provisioning behavior excessively eager.
24-08-2015