TMAegisBeta
更多 cockroachdb 規則

CockroachDB

TMA-COCKROACHDB-2.5

Disable Linux Memory Swapping to Prevent Performance and Stability Issues

中等級 1自動化cockroachdb

說明

For production CockroachDB deployments on Linux VMs or bare-metal, it is a critical requirement to disable Linux memory swapping or ensure the system has adequate RAM to prevent swap usage. Swapping database memory pages to slow disk I/O introduces severe and unpredictable latency, compromising the database's performance and stability. The benchmark rates this recommendation Manual; the automated check covers its objective pass criterion. Passes when /proc/swaps lists no active swap device. Also confirm at least 4 GiB RAM per vCPU and that --cache plus 2x --max-sql-memory stays below 80% of RAM.

檢查方式

稽核方法: Shell 指令

shell
[ -r /proc/swaps ] || exit 1; awk 'NR > 1 {n++} END {print n+0}' /proc/swaps
預期輸出
0

修補方式

修補方法: 操作指南或基礎設施修補檔

swapoff -a, remove swap entries from /etc/fstab (and set vm.swappiness=0), and size RAM to at least 4 GiB per vCPU.

屬性

作業系統
不限
標籤
cockroachdbos
參考資料
CIS CockroachDB v25.x Benchmark v1.0.0 - 2.5 Disable Linux Memory Swapping to Prevent Performance and Stability Issues

檢查此主機

請在您有權稽核的機器上執行此指令。掃描為唯讀操作。

shell
tmaegis scan --target cockroachdb