vm.swappiness
WARNINGOK
Rule IDs: os_002, os_008
Overview
- Purpose
- Linux kernel tendency to swap anonymous pages (often seen in host summary output).
- Dynamic (MySQL 8.4 reference)
- Linux sysctl — not a MySQL variable.
- Default value
- Distribution-dependent (commonly 60).
- Version and product notes
- Applies to Linux hosts only.
- Documentation
- Primary reference depends on product (MySQL, MariaDB, Percona, or OS documentation).
What is checked
Rules that reference this variable, with their severity and what each rule detects:
- WARNING
os_002: Set vm.swappiness=1 (or at most 10) for database servers. echo 1 > /proc/sys/vm/swappiness or add to /etc/sysctl.conf. - OK
os_008: Positive check — confirms configuration meets expected thresholds.
Tuning guidance
- Recommended actions:
- Set vm.swappiness=1 (or at most 10) for database servers. echo 1 > /proc/sys/vm/swappiness or add to /etc/sysctl.conf.
- Trade-offs: OS tuning (swap, THP, NUMA, I/O scheduler) operates outside MySQL but directly affects database performance. Changes require root access and may need a reboot.
Example
sysctl vm.swappiness=1 -- Persist in /etc/sysctl.conf: vm.swappiness = 1