天天看點

關于swap分區大小

幾乎所有Linux 系統管理的書上都推薦設定交換分區大小為記憶體的2倍。這些建議到了現在就是那麼适用了,現在的伺服器動不動就是 16GB/32GB 記憶體,難道相應的交換分區也要擴大到 32GB/64GB?根據 OpenBSD 的安裝建議:

Many people follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. This rule is nonsense. On a modern system, that’s a LOT of swap, most people prefer that their systems never swap. You don’t want your system to ever run out of RAM+swap, but you usually would rather have enough RAM in the system so it doesn’t need to swap. If you are using a flash device for disk, you probably want no swap partition at all. Use what is appropriate for your needs.

再看看 RHEL 5 推薦的 swap 分區大小:

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB. For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

繼續閱讀