Tuning swap partition my result into a good system performance. You can tune swap by editing /etc/fstab file.
For example if you have two partitions as follows:
Now Linux system will only use one partition at a time. It will use next partition only if first partition exhausted. Each swap area has a priority, either high or low. The default priority is low. Within the low-priority areas, newer areas are even lower priority than older areas.
According to swap man page: All priorities set with swapflags are high-priority, higher than default. They may have any non-negative value chosen by the caller. Higher numbers mean higher priority. Swap pages are allocated from areas in priority order, highest priority first. For areas with different priorities, a higher-priority area is exhausted before using a lower-priority area. If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.
This may result into performance issue as a new process needs to be swapped to disk it may have to wait until another process is swapped out. So open your /etc/fstab:
# vi /etc/fstab
Find out line that read as follows:
/dev/sdb3 swap swap default 0 0
/dev/sdc3 swap swap default 0 0
Replace it as follows:
/dev/sdb3 swap swap pri=0 0 0
/dev/sdc3 swap swap pri=0 0 0
Restart the system or turn on and off swap to take effect with swapon command:
# sync;sync;swapoff -a
# swapon -a
The result of above tuning is that your system should able to use any one of the swap partition independently. Please note that this hack is only useful if your system uses swap.
- How do I monitor what my MySQL server is doing?
- MySQL, Linux, FreeBSD, and Swap Space â€“ an excellent article that explains the importance of swap space by Jeremy Zawodny
- Read man page of fstatb, mount and swapon(2) for more information.
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop