Page 1 of 1

swap as software raid1 or not?

Posted: Thu Jan 14, 2010 4:43 am
by BruceLee
how do you think about setting up swap as software raid1.
default by kernel is raid0 if you setup two swap partitions on each hdd.

some people think its good to make raid1 others don't.
What do the experts say? :)
And how have you decided?

Thanks

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 8:40 am
by scott
Theres a better way to do that, by setting the priority of 2 separate swap partitions to -1 you will get a stripe effect without the soft raid overhead.

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 10:01 am
by BruceLee
thats right, but setting priority to -1 or equal numbers doesn't create raid1 but raid0 like you said.
if in this case one disk crashes there will be just "50%" of the swapped and striped stuff and the server mostly crashes or not?

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 11:17 am
by scott
Meh kind of, keep in mind just how slow memory->swap and swap->memory performance really is. Adding raid (of any kind) is just going to make that even slower. Could you gain something with an HA approach to swap, maybe.... it depends. Stuff in swap is for the most part comprised of anonymous mappings (data that does not map to a file) and if you had a failing disk it is conceivable that it could cause problems. Its hard to say though, because an anonymous mapping could literally be anything, and the application may not even be using it any more.

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 11:25 am
by BruceLee
ok, so your recommendation is to just leave the two swap partitions as they are, without raid, just striped by kernel.
Right?
thanks a lot

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 12:10 pm
by scott
Yeah thats what I do here

Re: swap as software raid1 or not?

Posted: Thu Jan 14, 2010 12:14 pm
by BruceLee
great, thanks