Testiranje swap-a na USB-u

Poznajemo performanse računara, ali i USB-a u verziji 2. Ne očekujem da će se nešto revolucionarno desiti, posebno što koristim 4GB memorije, a sistem ponekad tek ponekad pređe 3gb, ali hajde da probamo.

Za početak postavimo konfiguraciju:

If you don’t have time to change an existing system, than at least, make sure that you use a USB stick for your swap space. It increases performance because

  1. swap is on a different device. It does not block the access to your harddisk to operate.
  2. swap performance is much faster on USB stick.

I have a SanDisk 8G as swap space. My machine is doing swaps 200 times faster!

You must have heard that USB sticks have limited writes. True. You’ll replacing your $5 swap stick every 6 months.

Create a partition as you normally would. Then format it with mkfs.swap

Normally you don’t create partitions? Then simply install (apt-get) and use qtparted to create your partition. Let’s say you created partition sdb1. Then execute:

sudo mkswap /dev/sdb1

To see the uuid of your swap, execute

ls -l /dev/disk/by-uuid/ | grep sdb1

Mine reads, “dbceaa30-73cc-45a0-9b11-dade7131d192”. So go to your /etc/fstab (sudo kate /etc/fstab) and add the line:

# usb swap
UUID=dbceaa30-73cc-45a0-9b11-dade7131d192 none swap sw,pri=5 0 0

Also comment out the other line which specifies the swap partition on your hard disk. You don’t need it anymore. In case you are keeping it pri=5 above makes usb to take over swapping.

Enable the new swap space

sudo swapon -a

You can see the current swap configuration of your machine

swapon -s

When my swap went USB, I found out that I could launch around virtual machines for testing purposes and live them around freely. With less concern. Ubuntu has a “swappiness” setting. When it’s 100, it will swap out any idle process ASAP and use the freed memory for data caches. So with a fast swap space, you can increase the storage cache memory to increase the performance of the computer once more. How useful this trick depends on how CPU intensive your processes are. But in general, things are just idling around. So give the memory to cache and get better harddisk performance.

sudo sysctl -w vm.swappiness=100

The default value of swappiness is 60. You can experiment values between 60 and 100 to get a better result depending on your CPU usage ratio.

http://conceptspace.wikidot.com/blog:20

This entry was posted in Informacione tehnologije, Istraživanja, Linux. Bookmark the permalink.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.