Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8296126

Add +XX:OsCachedMetricsRefreshRate=<value> to set a refresh rate of the cached metrics

    XMLWordPrintable

Details

    • CSR
    • Resolution: Withdrawn
    • P4
    • None
    • hotspot
    • None
    • behavioral
    • minimal
    • Adds a new option which does not conflict with any current or previous option.
    • add/remove/modify command line option

    Description

      Summary

      Add a new command line option:

      -XX:OsCachedMetricsRefreshRate=<value>, -

      which will set the OS cached metrics refresh rate as times per second.

      Problem

      JDK-8232207 introduced the timeout between re-readings of the cached metrics (memory limit and active processor count) to avoid re-reading container settings too often and at the same time keeps the system responsive. The value of the timeout was hardcoded as 20 ms and cannot be changed. However, in the course of the discussion there were some thoughts concerning possible need to add a flag to control it in the future.

      Solution

      Add a new command line product option:

      -XX:OsCachedMetricsRefreshRate=<value>, -

      where a value is times per second and is in the range [1; 1000000000].

      It substitutes the hardcoded timeout of 20 ms between re-readings of the OS cached metrics introduced in JDK-8232207 and allows to set this timeout (as a refresh rate) by a user at the launch time.

      It can be used as followed:

      java -XX:OsCachedMetricsRefreshRate=100 MyApp

      Specification

      --- a/src/hotspot/os/linux/globals_linux.hpp
      +++ b/src/hotspot/os/linux/globals_linux.hpp
      @@ -77,7 +77,13 @@
                 "Use CPU_ALLOC code path in os::active_processor_count ")     \
                                                                               \
         product(bool, DumpPerfMapAtExit, false, DIAGNOSTIC,                   \
      -          "Write map file for Linux perf tool at exit")
      +          "Write map file for Linux perf tool at exit")                 \
      +                                                                        \
      +  product(uint, OsCachedMetricsRefreshRate, 50, DIAGNOSTIC,             \
      +          "Specify the refresh rate of the OS cached metrics to avoid " \
      +          "re-reading container settings too often. [times per second]" \
      +          "The default equals to 20ms timeout between re-reads.")       \
      +          range(1, NANOSECS_PER_SEC)                                    \
      
       // end of RUNTIME_OS_FLAGS

      See the changes in the pull request [1] for implementation details. This option is only available on Linux.

      [1] https://github.com/openjdk/jdk/pull/10918

      Attachments

        Issue Links

          Activity

            People

              omikhaltcova Olga Mikhaltcova
              omikhaltcova Olga Mikhaltcova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: