Intermittent Minion Timeouts and High System Load under Large Fleet Concurrency - Salt Master: "Request Timed Out," "Connection Refused," or "Too many open files" errors under high minion concurrency
search cancel

Intermittent Minion Timeouts and High System Load under Large Fleet Concurrency - Salt Master: "Request Timed Out," "Connection Refused," or "Too many open files" errors under high minion concurrency

book

Article ID: 419800

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite) VMware vSphere ESXi

Issue/Introduction

Administrators handling growing environments may notice performance degradation on the Salt Master. Common symptoms include:

  • Running commands such as salt * test.ping results in a timeout message advising to run the command with the --async option.
  • Minions intermittently fail to return data or show as "Not Connected" despite the service running.
  • High System Load (Load Average) or high CPU usage (user/system) observed in top or htop on the Master.
  • High Disk I/O wait times (wa) indicating the Master is disk bound.
  • System logs showing "Connection Refused" or "Too many open files" errors.

Environment

SaltStack - all versions

Cause

These symptoms are typically caused by the Salt Master reaching resource limits due to scale. Default configurations are often intended for smaller installations (under 1000 minions). Specific causes include:

  • Thundering Herd: Too many minions attempting to authenticate, re-authenticate, or reconnect simultaneously, overwhelming the Master's open ports.
  • Resource Exhaustion: The Master has insufficient CPU power to render pillars for many minions at once, or insufficient Disk I/O throughput to handle the job cache for every return.
  • Network Limits: The underlying OS (RHEL/CentOS/Linux) default network stack settings (sysctl) and file descriptor limits (ulimit) are often too low for high-concurrency environments.

Resolution

To resolve these issues, you must tune both the Operating System and the Salt configuration to handle higher concurrency and reduce I/O load.

Important: Applying these changes requires a complete stop and start of the Salt Master service to ensure file handles and socket bindings are cleanly released. Do not use systemctl restart.

1. Salt Master Configuration Tuning

Edit the /etc/salt/master configuration file to reduce load on the CPU and Disk.

  • Enable Key Cache:

    If the Master has many accepted keys, it consumes significant resources determining matching minions for publications. Enabling the key cache reduces this to a single file open.

    key_cache: 'sched'
  • Optimize Job Cache Retention:

    The job cache stores every minion return in a single file. Large retention times create hundreds of thousands of files, causing I/O bottlenecks. Reduce the retention time (e.g., to 24 hours) if historical data is not critical.

    keep_jobs_seconds: 86400
  • Enable Pillar Cache (Optional for Vanilla Environments):
    Note: This option is incompatible with masters that are integrated with Aria Config due to the master plugin already providing a similar functionality.

    If the Master is CPU bound due to rendering complex pillars, caching can reduce load. Note: Read security caveats regarding sensitive data in the master config before enabling.

    pillar_cache: True
  • Increase Worker Threads:

    Default threads are often too low for 1000+ minions. A general rule of thumb is 1 thread per 100 minions, but monitor CPU usage.

    worker_threads: 10

2. Salt Minion Configuration Tuning

To prevent "Thundering Herds," Minions must be configured to back off and randomize their connection attempts. Edit /etc/salt/minion (or manage via Salt States):

  • Randomize Re-Auth Delays:

    This prevents all minions from re-authenticating simultaneously when the Master restarts or rotates keys.

    random_reauth_delay: 60
  • Tune Reconnection Settings:

    Adjust how quickly and randomly minions attempt to reconnect to avoid SYN floods. The example below spreads reconnections over a minute.

    recon_default: 1000
    recon_max: 59000
    recon_randomize: True

3. Operational Best Practices

When running ad-hoc commands on the CLI, avoid hitting all minions simultaneously.

  • Use Batch Mode: Instead of salt '' disk.usage, use batch mode to loop through minions in chunks.
    salt '*' test.ping -b 50

4. Applying the Changes

Once the configurations are updated, perform a full stop and start of the service to ensure all tuning takes effect cleanly.

# On RHEL/CentOS 7/8/9
systemctl stop salt-master
# Wait for the Salt master daemon to stop completely
ps -ef | grep -i master
# Confirm that all processes have stopped
systemctl start salt-master