Skip to content

Feature Request: make _has_memory_headroom function more configurable #69884

Closed

Description

@dwoz

Discussed in #69732

Originally posted by do3meli July 6, 2026
The function _has_memory_headroom is actually checking if the system has less than 95% of the total memory available free. If so it will return true and otherwise it will return false:

salt/salt/minion.py

Lines 2110 to 2116 in 24a4cfa

mem = psutil.virtual_memory()
if mem.percent > 95:
log.warning(
"Memory limit reached (Used: %s%%). Pausing queue processing.",
mem.percent,
)
return False

The problem with this is, that salt-minion jobs get queued up on nodes that have a huge amount of memory still free. Let's say you have 2TB memory nodes. 5% memory headroom on such a system would be 102.4 GB. I guess that should be more than enough for salt ;-) Therefore i suggest to have the following to adjustments:

  1. make the memory limit in percent configurable: instead of using 95 as hardcoded in the code substitute this with a variable that can be configured via minion config.
  2. enhance the condition in a way that it is also possible to use a pre defined (via config of minion) number of memory that needs to be available (for example 5 GB). If that is set, i guess it would be preferred over the percent that is defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions