[vox-tech] ssd and swap
Chanoch (Ken) Bloom
kbloom at gmail.com
Wed May 26 08:13:09 PDT 2010
On Wed, 2010-05-26 at 07:34 -0700, Scott Miller wrote:
> Anyone using an SSD? I've got one on the way to use as a boot drive,
> and am pondering not having swap at all. Is this crazy?
>
> In the Windows world I see persons advising turning off the Windows
> page file when using an SSD.
>
> I have a lot of ram: 8GB. :) But is it risky to not have a swap?
> Thanks for your input,
You'll want to allocate lots of swap if you plan on using suspend to
disk. (That's where Linux puts the RAM image on when you hibernate the
computer.)
Aside from that, I feel that swap is counterproductive if you have that
much RAM. I always advise people to have at least twice as much RAM as
the applications they *typically* use. I know that with 4 GB of RAM (and
a 500 MB typical working set -- I'm only using 250 MB right now), I
barely touch my swap, and may accumulate only a few megabytes of it over
the course of a day.
The time when I *do* touch swap is when I have some sort of memory leak
-- typically in a program I or one of my students wrote -- and the
computer allocates all of its RAM *very* quickly. In this case, having
swap only serves to make the computer completely unresponsive as the
computer marches toward having the out-of-memory process killer kill the
offending process. Without swap, the offending program would die after
consuming less RAM, and without wasting time swapping. (I know I should
use a ulimit to keep these programs under control, but I never remember
to set one until it happens to me. Then it's too late.)
(While people [1] will tell you that you should have swap since it
balances the VM algorithm, letting it put anonymous unused data on swap,
when the file-backed data it's caching is more valuable, but since I
never see that happen under normal circumstances, I don't think it's
worth it anymore.)
So IMO, swap is useless. If you can set up your computer without it,
more power to you.
--Ken
[1] http://sourcefrog.net/weblog/software/linux-kernel/swap.html,
More information about the vox-tech
mailing list