• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Linux: Should I Increase Swap

Swap is 0.  Should it be increased?
-bash-3.2# free
             total       used       free     shared    buffers     cached
Mem:        524288       8672     515616          0          0          0
-/+ buffers/cache:       8672     515616
Swap:            0          0          0

Open in new window

  • 2
3 Solutions
You nearly always want at least some swap, especially if you only have 512MB of RAM.  I'm a bit thrown back however that you are only currently using 8.5MB, but anyways.

A very non-technical explanation could be -- think of swap as the "oh crap" memory for your applications when the physical memory is used up.  It allows portions of the physical memory contents not currently being used to be swapped out to disk to free up physical space for other processes, and swapped back if/when possible.

For servers, you don't want to rely on swap -- you want swap for the "oh crap" factor, then if more physical memory is truly needed, add some.

In current Linux kernels, swap space is also used for tmpfs filesystems such as /tmp and /dev/shm.

Basically with 0 swap and especially with only 512MB RAM, you are setting yourself up for system failures.
Read through this link, it covers most of the basics without getting super-technical.

Hugh McCurdyCommented:
Papertrip offers good advice.  I suggest you follow it.
For the most part, I'd not have any less swap than the amount of RAM you have, and being a long time linux user, I'm still used to having my rule of thumb being that you have twice as much swap space as RAM.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now