JayotisDiggory

Differences between revisions 6 and 7
Revision 6 as of 2007-09-13 18:57:54
Size: 3818
Editor: S010600112fc62b58
Comment:
Revision 7 as of 2007-09-13 22:19:28
Size: 3982
Editor: S010600112fc62b58
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
I have a great interest in the paging functions of the kernel. This is due to several blown hard drives which I believe where thrashed to death by page swapping and system file reads... (i.e. swap partition and root/data on same device.) So I decided to replace the typical swap set up with one that didn't rely on a mechanical device which is prone to failure. In doing so I have increased the performance of my system by 50% overall, and an astounding 200% in some cases of heavy paging activity. I am very interested in the paging functions of the kernel. This is due to several blown hard drives which I believe where thrashed to death by page swapping and system file reads... (i.e. swap partition and root/data on same device.) So I decided to replace the typical swap set up with one that didn't rely on a mechanical device which is prone to failure. In doing so I have increased the performance of my system by 50% overall, and an astounding 200% in some cases of heavy paging activity.
Line 7: Line 7:
= How to Swap = == How to Manage Swap Space ==
Line 9: Line 9:
Hardware:
AMD64 +3800@2.41 Ghz
512MB RAM
Mainboard with 4 external USB2.0 ports
4 identical 512MB USB2.0 storage devices.

Software:
Ubuntu 7.04 Feisty Fawn

= Setup procedure =

Partition and format the 4 USB storage devices as linux swap.
Reboot.
Open gparted and check the devices are present and proper format.
Edit /etc/fstab and add the following lines

/dev/sda1 none swap sw,pri=10 0 0

/dev/sdb1 none swap sw,pri=10 0 0

/dev/sdc1 none swap sw,pri=10 0 0

/dev/sdd1 none swap sw,pri=10 0 0

#Note: the device names should match what is shown by gparted.

You should also see the original swap partition with a `pri` value, change that too 0 if it is not already. You want to have a Hard Disk swap partition as a fall back messure.
(e.g. /dev/hdc2 none swap sw,pri=0 0 0 )

save and exit.
Restart machine.
The reason for this swap setup is to eliminate using a slow, mechanical, Hard Drive(HD) as a swap device. The HD is a bottleneck due to a physical arm that needs to move to each bit of data before it can be sent to RAM. With USB flash memory devices, memory is accessed in RAM fashion and no movement(aside from electrons) is required; this also means that fragmentation of the page file does not effect access times. Data read speeds on these devices are far faster then that of a conventional HD. When a page is requested to be placed into physical memory, it happens almost instantly. Since the write operations are slower then read, multiple devices are used to multi-task the process on a hardware level.
Line 42: Line 12:
== Known bugs == === Setup procedure ===
''only 4 USB2.0 ports & 4 identical make/model storage devices are needed''
Line 44: Line 15:
On restart Ubuntu did not turn on the new swap devices for me, if this happen to you as well you can turn them on manually with `swapon -a` or place the command inside a startup script which runs before the desktop is loaded (i inserted a link into rc5.d to a script called S04swapsys). 1. Partition and format the 4 USB storage devices as linux swap.[[BR]]
2. Reboot.[[BR]]
3. Open gparted, check the devices are present, in proper format and their names.[[BR]]
4. Edit '''''/etc/fstab''''' and add the following lines
Line 46: Line 20:
pri=10 is not the most effective value (I still need to do some research on this), the reason is because each page is assigned a priority which is lower then the last. What I think this means is if you assign a device pri=10, the first page used has pri=9. What should happen is all swap pages are created on the USB devices first, then the HD partition is used, or the HD is used if the USB devices are busy. {{{/dev/sda1 none swap sw,pri=10 0 0
/dev/sdb1 none swap sw,pri=10 0 0
/dev/sdc1 none swap sw,pri=10 0 0
/dev/sdd1 none swap sw,pri=10 0 0}}}
Line 48: Line 25:
While I am using AMD64, I'm not sure if the pri option accepts 64bit values yet... more research.      Note: the device names should match what is shown by gparted.
Line 50: Line 27:
= Info =
The reason for this swap setup is to elimanate the HD bottleneck with fast USB flash memory devices. The read speeds on these devices are far faster then a HD so when a page is requested to be placed into physical memory, it happens almost instantly. Since the write speeds are much slower, multiple devices are used to multi-task the process and again, the HD swap partition is there as a fall back.
5. You should also see the original swap partition with a `pri=` value, change that too `pri=0` if it is not already. You want to have a Hard Disk swap partition as a fall back measure.
{{{#example
/dev/hdc2 none swap sw,pri=0 0 0 }}}

6. Save '''''fstab'''''.[[BR]]
7. Restart machine. [[BR]]
8. Check to see if your swap devices are activated with `swapon -s` ; if yes then your done... if no then please read the known bugs.


=== Known bugs ===

On restart Ubuntu did not turn on the new swap devices for me, if this happen to you as well you can turn them on manually with `swapon -a` or place the command inside a startup script which runs before the desktop is loaded. I inserted a syslink '''''S04swapsys''''' into '''''rc5.d''''' pointing to a script called '''''swapsys''''' located at '''''/etc/init.d''''' which looked like this {{{!# /bin/sh
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin

swapon -a

exit 0}}}


=== Testing ===
Line 69: Line 66:
= Also see = === Also see ===

Introduction

I am very interested in the paging functions of the kernel. This is due to several blown hard drives which I believe where thrashed to death by page swapping and system file reads... (i.e. swap partition and root/data on same device.) So I decided to replace the typical swap set up with one that didn't rely on a mechanical device which is prone to failure. In doing so I have increased the performance of my system by 50% overall, and an astounding 200% in some cases of heavy paging activity.

How to Manage Swap Space

The reason for this swap setup is to eliminate using a slow, mechanical, Hard Drive(HD) as a swap device. The HD is a bottleneck due to a physical arm that needs to move to each bit of data before it can be sent to RAM. With USB flash memory devices, memory is accessed in RAM fashion and no movement(aside from electrons) is required; this also means that fragmentation of the page file does not effect access times. Data read speeds on these devices are far faster then that of a conventional HD. When a page is requested to be placed into physical memory, it happens almost instantly. Since the write operations are slower then read, multiple devices are used to multi-task the process on a hardware level.

Setup procedure

only 4 USB2.0 ports & 4 identical make/model storage devices are needed

1. Partition and format the 4 USB storage devices as linux swap.BR 2. Reboot.BR 3. Open gparted, check the devices are present, in proper format and their names.BR 4. Edit /etc/fstab and add the following lines

{{{/dev/sda1 none swap sw,pri=10 0 0 /dev/sdb1 none swap sw,pri=10 0 0 /dev/sdc1 none swap sw,pri=10 0 0 /dev/sdd1 none swap sw,pri=10 0 0}}}

  • Note: the device names should match what is shown by gparted.

5. You should also see the original swap partition with a pri= value, change that too pri=0 if it is not already. You want to have a Hard Disk swap partition as a fall back measure. {{{#example /dev/hdc2 none swap sw,pri=0 0 0 }}}

6. Save fstab.BR 7. Restart machine. BR 8. Check to see if your swap devices are activated with swapon -s ; if yes then your done... if no then please read the known bugs.

Known bugs

On restart Ubuntu did not turn on the new swap devices for me, if this happen to you as well you can turn them on manually with swapon -a or place the command inside a startup script which runs before the desktop is loaded. I inserted a syslink S04swapsys into rc5.d pointing to a script called swapsys located at /etc/init.d which looked like this {{{!# /bin/sh #

PATH=/bin:/usr/bin:/sbin:/usr/sbin

swapon -a

exit 0}}}

Testing

I have been testing this setup with excellent results using the following software:

-Wine-> World of Warcraft(windowed mode)

-Firefox->flash & graphic pages

-Azureus-> large file download.

-Mplayer-> playing movie

-xmms->music stream

These are all running at the same time and I am focus switching back and forth with no problems, very fast results.

WoW running by itself is where I get the 200% value. It is based on how long it takes to reload large areas and how long it takes move when entering populated cities and areas. The game runs smoother, faster and is more stable then running it on the OS it was designed for.

Also see

man swapon(2) priority option


JayotisDiggory (last edited 2008-08-06 17:00:40 by localhost)