Rich Freeman on 11 Apr 2013 10:28:59 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] RAID for swap?

On Thu, Apr 11, 2013 at 12:44 PM, christopher barry
<> wrote:
> Use a separate SSD for swap if you *really* think you'll be needing to
> regularly use swap. Otherwise, install enough memory for your needs.
> Avoid having to use swap in the first place.

Cost of RAM: $8/GB.  Cost of HD: $0.10/GB.  Sure, I'd rather have the
former than the latter, but it isn't always the most cost-effective
solution for rare peaks in usage.

I run my swap on top of LVM+raid5, and I'm not sure I would recommend
this.  On the one hand it is more disaster-resistant.  On the other
hand I tend to get panics when my system heavily swaps, and I'm not
sure why.  Only once I managed to capture the error message - it
looked like some kind of filesystem sync issue (maybe ext4 is crashing
when the drives are heavily utilized).  Usually I just find my server
unresponsive with the monitor refusing to wake up (sysrq-sub will
reboot it, though I doubt the s/u does anything).  Usually in that
state the drive light just flickers about once a second or so.  Might
be hardware though - I have a much better case now and I haven't seen
it happen yet (though I haven't done any RAM-hungry tasks yet).

For me the main drivers for using swap are so that I don't invoke the
oom-killer when I get some odd spike in usage, to help mitigate apps
that tend to leak RAM (the wasted RAM just gets swapped out and never
read, and I don't lose cache), and for cases where my tmpfs fills up
(usually while building something big like openoffice or chromium -
especially if I'm building a few things in parallel).  On Gentoo
building with tmpfs is a MASSIVE performance improvement, but a few
packages consume a fair bit of space during builds so it can't always
fit into RAM.  It will never perform worse that building from disk -
the only difference between swapping tmpfs and ext3 is that the former
only ever writes something to disk if RAM is in demand, and the latter
always writes everything to disk within 30 seconds even if it will
never be needed again.

If you do put swap on raid I wouldn't do it on top of a file - every
layer hurts performance.  I'd keep it simple.  Keep in mind that if a
consumer drive fails on a consumer motherboard there is a chance that
your whole system or the other drives will hang due to hardware
glitches - consumer motherboards don't do as good a job isolating
individual drives as a server board does.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --