Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-15043

[Server] Investigate changes in SERVER-60412: Host memory limit check does not honor cgroups v2

    XMLWordPrintable

Details

    • Task
    • Status: Open
    • Major - P3
    • Resolution: Unresolved
    • None
    • 5.3.0, 4.4.14, 4.2.20, 5.0.7
    • manual, Server
    • None

    Description

      Downstream Change Summary

      Adds support for using cgroups v2 to specify the memory available to the environment running a mongo server (e.g., mongod). SERVER-16571 added support for cgroups v1, and this ticket extends that support for cgroups v2.

      Description of Linked Ticket

      As I checked mongoDB gained support for memory constraints over cgroup in linux with SERVER-16571. However it seems that it doesn't have the ability to check memory limit if host is using cgroups v2 resulting hostInfo.system.memLimitMB to be equal to system memory in a containerized environment.

      Current code to read memory limits in src/mongo/util/processinfo_linux.cpp

      // LinuxSysHelper::getMemorySizeLimit().
      .....
      std::string cgmemlimit = readLineFromFile("/sys/fs/cgroup/memory/memory.limit_in_bytes");
      ....

      But in cgroups v2 the memory limit is at /sys/fs/cgroup/memory.max.

      I think engine should check if the cgroups v2 is enabled on the host and then read the limits according to that.

      Tested on mongodb 4.2.6 in docker containers at host Fedore CoreOS 34.20210904.3.0. But I do believe newer versions have the same since source code seems same since first implementation.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              backlog-server-pm Backlog - Core Eng Program Management Team
              Dave Cuthbert Dave Cuthbert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                37 weeks, 5 days ago