Wednesday, March 28, 2012

About SWAP in linux

what is swap?
swap space is the area on a HD which is part of the VM of your machine.
swap space temporarily hold a memory pages that are inactive.

why do i need swap?
  1. Memory consuming programs Sometimes, a large program (like OpenOffice, Neverwinter Nights, or a video editor) make the entire system need extra memory.
  2. Hibernation (suspend-to-disk) The hibernation feature (suspend-to-disk) writes out the contents of RAM to the swap partition before turning off the machine.
  3. Optimizing memory usage
  4. Optimizing Swap performance

How much swap do i need?
As a base minimum, it's highly recommended that the swap space should be equal to the amount of physical memory (RAM).

Example Scenarios:
  • Low RAM and low disk space With 512 MiB RAM and 30 GB hard disk, use  512 MiB for swap since RAM is very low.
  • Low RAM and high disk space With 512 MiB RAM and 100 GB hard disk, use 1 GiB for swap since RAM is very low and hard disk space is plentiful.
  • High RAM and low disk space With 2 GiB RAM and 30 GB hard disk, use 1 GiB for swap since hard disk space is very low.
  • High RAM and high disk space With 2 GiB RAM and 100 GB hard disk, use 2 GiB for swap since hard disk space is plentiful.

No comments:

Post a Comment