JDK-8199944 : Add Container MBean to JMX
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 10
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2018-03-21
  • Updated: 2021-01-26
  • Resolved: 2021-01-26
Related Reports
Blocks :  
Relates :  
Relates :  
JDK-8182070 is adding an internal API that will return Container Metrics.  A Container MBean or additions to the OperatingSystemMBean should be implemented in order to expose these metrics to Management tools.
This has been resolved by https://bugs.openjdk.java.net/browse/JDK-8226575

I think adding a "Container MBean" is the wrong focus at the top-level - we never considered adding a Zone MBean for Solaris. The issue is that the existing OperatingSystem MBean/MXBean APIs are not always meaningful in a containerized environment. What we need is a bean that reports _available_ resources, and that then has to account for any OS resource management mechanisms (e.g. Zones), containers that run on top of the OS (cgroups and the users thereof) or any specific API that might exist for limiting a resource. We already have this for "available processors" it just needs to be extended to other resources - specifically memory. There are no issues with achieving platform consistency with such a bean. Consider this an ExecutionEnvironmentMXBean. We could then have platform specific "container" MBeans to expose more detailed information specific to a particular environment. There is no requirement that such a thing must exist for every platform, so again no platform consistency issue to address.

Publishing a MBean for container metrics is equivalent to defining an exported interface that has to be supported for a long time across several JDK releases. Before publishing the MBean specifiation, care should be taken that all the fields of container metrics included in the MBean specification can be retrieved consistently across all the JDK supported platforms. JDK-8182070 is focused on retrieving container metrics from linux based platforms only and there is scope/PoC to retirieve the same from windows/OSX platforms. This enhancement will be put on hold until metrics can be retrieved consistenly across all the platforms.