vm.swappiness 設成 1 或是 0 的差異

在「MongoDB System Tuning Best Practices」這份投影片裡面看到:

To avoid disk-based swap: 1 (not zero!)

以及:

‘0’ can cause unpredicted behaviour

在 kernel 的說明文件是這樣描述,設成 0 時表示只有在避免 oom 時才會 swap:

This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase agressiveness, lower values decrease the amount of swap. A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone.

設成 1 的想法頗有趣的,來看看在 MySQL 上是不是也有同樣的情況要注意...

One thought on “vm.swappiness 設成 1 或是 0 的差異”

Leave a Reply

Your email address will not be published. Required fields are marked *