Increasing swap performance

If your Linux machine is configured with several swap partitions, the default trend is to use of one partition at a time. Once one swap partition has been full the next will be used. This is not always the best method for performance, since when a new process needs to be swapped to disk it may be forced to wait until another process is swapped out.

For instance, if there are two swap partitions specified in /etc/fstab it will look something like this:

/dev/sda2    swap     swap    defaults           0 0
/dev/sda3 swap swap defaults 0 0

Change the mount options section from ”defaults” to ”pri=0” :

/dev/sda2    swap      swap    pri=0           0 0
/dev/sda3 swap swap pri=0 0 0

If you want to do this in a live system, then swapoff and swapon with “-p 0” option for each swap device – one by one. Once this has been done the system will be able to access any of the designated swap partitions independently of the others. This can increase the swap performance of a machine which is regularly swapping memory to disk. However it is important to bear in mind that in most situations a machine should not make heavy use of swap partitions.
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

Netapp deduplication

Next Post

Linux RPM database recovery

Related Posts