How can I speed up performance by using multiple swap partitions?

Asked By 0 points N/A Posted on -
qa-featured

One day I was searching the web and found either a SuSE or Red Hat site that was saying that you could set up your swap in a RAID fashion. They were talking about a large server with a lot of disk drives, and you could put a swap partition on many of them, and set all these swap partitions to the same priority. This way they would work more like they were in a RAID setup, and the speed of swap writing and reading from the disks would be improved.

Also, near the end of the replies to the 'How to use RAM as Swap' article, there was mention that someone should be reworking the swap algorithm so it didn't use such a simple and slow search method for finding and using swap slots. I believe it was a mention of Andrew Morton himself saying something like that in an lkml email. I don't know if that has been done, but the 2.6 kernel swap is a lot different than the 2.4, so maybe it was at least attempted.

Help me out

 

SHARE
Answered By 0 points N/A #111917

How can I speed up performance by using multiple swap partitions?

qa-featured

 

If your system (especially a server) has multiple drives set up as a RAID 0 array (data
striping), it would automatically spread the data across all the drives in parallel, greatly
increasing the speed of disk writes versus a non-RAID setup, where the swap partition is on
only one drive. Of course, not everyone can afford a RAID setup; fortunately, there is an
alternative that offers many of the same performance benefits in a multidisk environment, at
least as far as swap space performance is concerned.
As it happens, there is a way to “parallelize” swap file read/writes through the use of the
priority setting in the /etc/fstab file. (Note: This works best with multiple SCSI drives and/or
controllers. Two IDE drives on the same controller will see little or no performance boost from
this technique, but multiple IDE drives on multiple controllers may benefit somewhat.)
Use an appropriate tool (such as kfstab [available from kfstab.purespace.de/kfstab], which
knows the exact layout of the file that fstab requires) to open the file /etc/fstab. This file lists
the partitions used by Linux, including swap space. (Note: It is possible to use a simple text
editor such as vi, but if you do not get the columns lined up just right, or if you use tabs instead
of spaces or vice versa, you can corrupt your system; so if you elect to go this route, rather
than using a tool specifically designed for editing fstab, such as kfstab, be sure to make a
backup copy of fstab first, so that you can recover if your system crashes.)

Related Questions