Swap pressure
low on-server
What it inspects
The last line of `vmstat 1 3`, reading the si (swap in) and so (swap out) columns in KB per second. Both zero passes, both under 100 warns, and 100 or more in either fails. If vmstat is missing or its output cannot be parsed, the check is skipped.
Why it matters
Swapping means the machine is short of RAM and is using disk as memory, which is thousands of times slower. Sustained swapping makes services slow and unresponsive, and it often comes just before the kernel kills a process for lack of memory. The fix is to reduce memory use or add memory.
How to verify
vmstat 1 5; free -h
How to fix
Judgement step: find the process using the memory, then reduce its use, add RAM, or lower swappiness. Tuning alone does not add memory.
Find the memory pressure and relieve it needs your judgement
Any distro
# Swap-in/swap-out means the kernel is moving memory pages to and from disk because RAM is short.
# This check takes the last line of `vmstat 1 3`: any non-zero si/so is a warning, and 100 KB/s or more fails.
# Look at it over time: vmstat 1 10
# Who is using the memory: ps aux --sort=-%mem | head
# Totals and swap devices: free -h; swapon --show
# Then decide, in this order of preference:
# 1. Fix or limit the memory-hungry process (a leak, an oversized cache, too many workers).
# 2. Add RAM, or move a workload to another machine.
# 3. Lower swappiness so the kernel prefers dropping cache over swapping (this reduces swapping, it does not add memory):
# sysctl vm.swappiness=10
# and to keep it across reboots, put `vm.swappiness = 10` in /etc/sysctl.d/99-swappiness.conf.
# A brief swap burst is normal and passes again once memory pressure ends; only sustained pressure is a problem.