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

MXBean current memory usage in containers includes page cache

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      JDK17, Docker Container, Linux

      A DESCRIPTION OF THE PROBLEM :
      When I fetch memory usage and max memory it returns the values inside memory.max and memory.current files and these values includes linux page caches and this can give very false values when you read a lot of files. I've found that dotnet runtime has been experience this too until https://github.com/dotnet/runtime/pull/53074 this pr it may help there is a better description and an example implementation.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a Java app that reads a lot of files from a volume and reports the memory usages via MxBean, and deploy it to a linux container then run.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      MXBean should return memory usage metric that doesn't includes page caches.
      ACTUAL -
      MXBean's function that returns current memory usage returns more memory than jvm use although it's the only process in container.

      FREQUENCY : always


      Attachments

        Activity

          People

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: