[PLUG] Swap or Not?

Steve Bonds 1s7k8uhcd001 at sneakemail.com
Thu Jan 29 09:09:02 UTC 2004


On Wed, 28 Jan 2004, Paul Mullen paul-at-nellump.net |PDX Linux| wrote:

> What is the general consensus [1] regarding the use of a swap partition
> on a system with "plenty" of RAM? My daily driver has 512 MB of RAM, and
> I've never bothered to set up a swap partition for it. So far, I don't
> seem to lack anything in the performance department, but then I have
> nothing to compare to. Am I missing something here?

I don't think there is a general consensus so much as a mess of differing
opinions.  Here's a survey of some of the most popular and my take on
them:

1) Make swap 2x RAM

This is a very old rule of thumb, dating back from the PDP-11 days of
UNIX.  This kind of made sense once upon a time when RAM was hideously
expensive and the servers had a massively multiuser workload.  It was
important that things that remained unused were moved out of the way for
things that needed the RAM during the present.

I don't think this is a good rule for workstations (more on this later).

2) Make swap 1x RAM

On some UNIX systems if they don't have at least 1x swap, the system
doesn't use all the physical memory.  (HP-UX is like this by default)

I don't think Linux ever had this problem.

3) Make swap some small fixed size (i.e. 100MB)

This gives the system some small amount of room to swap out things that
are truly unused, but not so much that you're waiting large amounts of
time for things to be swapped back in.

If I have problems with option (4) below, this is where I go next.

4) Don't make any swap

If you have "plenty" of RAM this is the highest performance option.
However, if you ever see kscand hogging the CPU and system performance get
choppy, you'll know that you no longer have "plenty" of RAM and you may
want to get more (or turn on swap).  This choice eliminates the problem of
the kernel swapping out programs to make room for more disk buffers.
(This happens a lot on workstations, particularly if they run nightly
backups.  All the file activity coupled with litte or no application
activity fools the kernel into thinking all those apps you'll need the
next morning are "unused".)

  -- Steve




More information about the PLUG mailing list