[Discuss] SSD drives vs. Mechanical drives

Edward Ned Harvey (blu) blu at nedharvey.com
Wed May 7 09:37:30 EDT 2014


> From: discuss-bounces+blu=nedharvey.com at blu.org [mailto:discuss-
> bounces+blu=nedharvey.com at blu.org] On Behalf Of Dan Ritter
> 
> For a modern server, swap should be an emergency usage only.

Incorrect.

On a modern (linux) server, the kernel is able to balance stale application memory just like cache.  If there is some idle process whose memory is colder than the coldest cache page, then it's actually *more valuable* to keep the cache in memory and swap out the process.  The linux kernel can do this, if an only if there exists swap available.  By swapping out the idle process and keeping cache in-memory, the kernel improves system performance.

But you're correct that swap should never be actively used.  The practice that I like to follow is:  Give the system a small amount of swap.  1G at most, regardless of how much ram is present in the system.  That way, the kernel can improve performance by gaining up to 1G ram by swapping out idle processes, yet if a process runs away and starts hogging ram, the system won't let it run *too* long before giving it "cannot allocate memory" and thus usually causing the errant process to die and free its memory.



More information about the Discuss mailing list