Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-73943

Pin code pages in memory in memory constrained systems

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0, 6.0.6, 5.0.19, 4.4.23
    • Affects Version/s: None
    • Component/s: None
    • Service Arch
    • Fully Compatible
    • v6.0, v5.0, v4.4
    • Service Arch 2023-02-20, Service Arch 2023-03-06, Service Arch 2023-03-20, Service Arch 2023-04-03, Service Arch 2023-04-17

      When mongod is under intense memory pressure on systems that do not have swap space, the operating system pages out the only pages it can when mongod makes a request for more privately mapped memory: program text segment (code) pages. It pages them out because they are available for retrieval from stable storage. Unfortunately, this means that under heavy load mongod spends an immense amount of time paging code in from disk, which can make the system become unresponsive when it would be better for it to crash.

      We should offer the option to pin code segments in memory via the mlock(2) syscall. The stack tracing machinery already knows how to find the base address of every code segment loaded into the process, and could be extended with modest effort to also report the size of those segments. This would in turn allow us to invoke `mlock` to pin those pages in memory.

            Assignee:
            jason.chan@mongodb.com Jason Chan
            Reporter:
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            33 Start watching this issue

              Created:
              Updated:
              Resolved: