JayotisDiggory

Differences between revisions 9 and 10
Revision 9 as of 2007-09-19 18:50:11
Size: 4572
Editor: S010600112fc62b58
Comment:
Revision 10 as of 2007-09-19 19:55:40
Size: 4741
Editor: S010600112fc62b58
Comment:
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
''Only 4 USB2.0 ports & 4 identical make/model USB2.0 Flash memory storage devices 256MB or more are needed. You can get away with a 4 port hub although I've never tried. Also, the use of more devices may improve performance even further...'' ''Only 4 USB2.0 ports and 4 identical make/model USB2.0 Flash memory storage devices 256MB or more are needed. You can get away with a 4 port hub although I've never tried so maybe not. Also, the use of more devices may improve performance even further depending on the amount of swap space you use. At 500MB+ I suggest 8.''
Line 15: Line 15:
1. Partition and format the 4 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
 1. Start `gparted` then partition and format the 4 USB devices as linux swap.[[BR]]
 2. Remember the device names(sd*) and exit `gparted`.[[BR]]
 3. Edit '''''/etc/fstab''''' and add the following lines{{{/dev/sda1 none swap sw,pri=10 0 0
Line 25: Line 22:
     Note: the device names should match what is shown by gparted.      Note: the device names(sd*1) should match what was shown by gparted.
Line 27: Line 24:
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 }}}
 1.#4 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 }}}If Ubuntu setup your swap drive the the name is a hideous UUID and not something nice like hdc2, the pri value is all that needs to be changed.
Line 31: Line 27:
6. Save '''''fstab'''''.[[BR]]
7. Edit '''''/etc/init.d/bootmisc.sh''''' and look for {{{ # Remove bootclean's flag files.
 1.#5 Save '''''fstab'''''.[[BR]]
 6. Edit '''''/etc/init.d/bootmisc.sh''''' and look for{{{ # Remove bootclean's flag files.
Line 34: Line 30:
 rm -f /tmp/.clean}}} [[BR]]
add these lines below it {{{      echo 1024 > /sys/block/sda/device/max_sectors
 rm -f /tmp/.clean}}}add these lines below it {{{ echo 1024 > /sys/block/sda/device/max_sectors
Line 40: Line 35:
 swapon -a}}}
Note1: This is my device layout, your device names(sd*) maybe different.  A hub ''may'' also need its max_sector changed.
 swapon -a}}}[[BR]]
Note1: This is my device layout, your device names(sd*) maybe different.[[BR]]
Line 44: Line 39:
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 contact me.
 1.#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 contact me.
Line 55: Line 50:
I have been testing this setup with excellent results using the following software: Testing has been done using the following software:
Line 57: Line 52:
-Wine-> World of Warcraft(windowed mode)      -Ubuntu 7.04 x86_64:
Line 59: Line 54:
-Firefox->flash & graphic pages      -Wine-> World of Warcraft(windowed mode).
Line 61: Line 56:
-Azureus-> large file download.      -Firefox->flash & graphic pages.
Line 63: Line 58:
-Mplayer-> playing movie      -Azureus-> large file download.
Line 65: Line 60:
-xmms->music stream      -Mplayer-> playing movie.
Line 67: Line 62:
These are all running at the same time and I am focus switching back and forth with no problems, very fast results.      -xmms-> music stream.
Line 69: Line 64:
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. These are all running at the same time, focus switching back/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/areas. The game runs smoother, faster and is more stable then running it on the OS it was designed for.

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 data access times. 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 and 4 identical make/model USB2.0 Flash memory storage devices 256MB or more are needed. You can get away with a 4 port hub although I've never tried so maybe not. Also, the use of more devices may improve performance even further depending on the amount of swap space you use. At 500MB+ I suggest 8.

  1. Start gparted then partition and format the 4 USB devices as linux swap.BR

  2. Remember the device names(sd*) and exit gparted.BR

  3. 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(sd*1) should match what was shown by gparted.
  1. 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 }}}If Ubuntu setup your swap drive the the name is a hideous UUID and not something nice like hdc2, the pri value is all that needs to be changed.

  1. Save fstab.BR

  2. Edit /etc/init.d/bootmisc.sh and look for{{{ # Remove bootclean's flag files.

    • # Don't run bootclean again after this!

      rm -f /tmp/.clean}}}add these lines below it {{{ echo 1024 > /sys/block/sda/device/max_sectors echo 1024 > /sys/block/sdb/device/max_sectors echo 1024 > /sys/block/sdc/device/max_sectors echo 1024 > /sys/block/sdd/device/max_sectors

      swapon -a}}}BR

Note1: This is my device layout, your device names(sd*) maybe different.BR Note2: I am not sure if bootmisc.sh is best place for these commands, it seems max_sectors gets overwritten anywhere before this script. If you know of a better way(not udev rule) then please let me know.

  1. Restart machine. BR

  2. Check to see if your swap devices are activated with swapon -s ; if yes then your done... if no then please contact me.

Testing

WarningBR I have noticed that my fans (GPU, CPU or both) rev up to a pitch I've never heard before. While my system has hardware fail-safes built into them, I don't want to find them and only run all programs for a couple of minutes. BR

Testing has been done using the following software:

  • -Ubuntu 7.04 x86_64:

    -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, focus switching back/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/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) -p priority


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