RFR: 8203359: Container level resources events [v10]

Severin Gehwolf sgehwolf at openjdk.java.net
Tue Apr 27 09:45:46 UTC 2021


On Thu, 22 Apr 2021 16:00:32 GMT, Jaroslav Bachorik <jbachorik at openjdk.org> wrote:

>> With this change it becomes possible to surface various cgroup level metrics (available via `jdk.internal.platform.Metrics`) as JFR events.
>> 
>> Only a subset of the metrics exposed by `jdk.internal.platform.Metrics` is turned into JFR events to start with.
>> * CPU related metrics
>> * Memory related metrics
>> * I/O related metrics
>> 
>> For each of those subsystems a configuration data will be emitted as well. The initial proposal is to emit the configuration data events at least once per chunk and the metrics values at 30 seconds interval. 
>> By using these values the emitted events seem to contain useful information without increasing overhead (the metrics values are read from `/proc` filesystem so that should not be done too frequently).
>
> Jaroslav Bachorik has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
> 
>  - Prevent event container bytecode generation if no container present
>  - Fix event metadata
>  - Roll back conditional registration of container events
>  - Remove container events flag
>  - Remove trailing spaces
>  - Doh
>  - Report container type and register events conditionally
>  - Remove unused test files
>  - Initial test support for JFR container events
>  - Update the JFR control files
>  - ... and 3 more: https://git.openjdk.java.net/jdk/compare/23dc6e83...04c3f092

@jbachorik The test needs fixing.

test/hotspot/jtreg/containers/docker/TestJFREvents.java line 147:

> 145:                                       .addClassOptions(eventName, "period=endChunk"))
> 146:             .shouldHaveExitValue(0)
> 147:             .shouldContain(memoryPressureFld)

This test fails for me on cgroupv1 with:


----------System.err:(42/1407)----------
 stdout: [===== EventType: jdk.ContainerMemoryUsage
startTime = 946400166
duration = 0
eventThread = {
  osName = "main"
  osThreadId = 6
  javaName = "main"
  javaThreadId = 1
  group = {
    parent = {
      parent = N/A
      name = "system"
    }
    name = "main"
  }
}

stackTrace = null
memoryFailCount = 0
memoryUsage = 57786368
swapMemoryUsage = 57782272
];
 stderr: []
 exitValue = 0

java.lang.RuntimeException: 'memoryPressure' missing from stdout/stderr

        at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:206)
        at TestJFREvents.testMemoryUsage(TestJFREvents.java:147)
        at TestJFREvents.main(TestJFREvents.java:77)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:831)

JavaTest Message: Test threw exception: java.lang.RuntimeException: 'memoryPressure' missing from stdout/stderr

JavaTest Message: shutting down test


I think `memoryPressure` got removed from the code and, thus, should get removed from the test.

-------------

Changes requested by sgehwolf (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3126


More information about the hotspot-jfr-dev mailing list