Administrators handling growing environments may notice performance degradation on the Salt Master. Common symptoms include:
salt * test.ping results in a timeout message advising to run the command with the --async option.top or htop on the Master.SaltStack - all versions
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:
To resolve these issues, you must tune both the Operating System and the Salt configuration to handle higher concurrency and reduce I/O load.
systemctl restart.Edit the /etc/salt/master configuration file to reduce load on the CPU and Disk.
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'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: 86400Note: 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: TrueDefault 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: 10To prevent "Thundering Herds," Minions must be configured to back off and randomize their connection attempts. Edit /etc/salt/minion (or manage via Salt States):
This prevents all minions from re-authenticating simultaneously when the Master restarts or rotates keys.
random_reauth_delay: 60Adjust 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: TrueWhen running ad-hoc commands on the CLI, avoid hitting all minions simultaneously.
salt '' disk.usage, use batch mode to loop through minions in chunks.salt '*' test.ping -b 50Once 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