Sizing Swap Partitions

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Geiss
Date:  
Subject: Sizing Swap Partitions
I like to keep my swap partitions just slightly larger than the amount of
RAM, for when software suspend (new feature in 2.6 kernel) becomes stable.

I hardly ever see any swap being using on any of my servers or
workstations.

I would recommend making your swap partition at most the size of the
ram. any more than that is a waste.

the recommendation to make swap twice the size of ram comes from around
the linux kernel 2.4.12 days, when the kernel had a horrible bug in the
virtual memory implementation.

another way to size your swap: run the system with all the apps you plan
to run at the same time. use 'top' to add up how much memory each app
uses. (for each process, the amount of ram used is the RES column minuse
the SHR column) then make sure that your ram + swap size is significantly
larger than the total. of course, if the size of your physical ram is
smaller than that total, you will experience a lot of thrashing and
terrible performance. this method is almost silly these days though,
usually even 128mb of ram is plenty for servers, unless you plan to get
slashdotted or something.

On Sat, Oct 04, 2003 at 10:22:19AM -0700, Alex Munro wrote:
> I'm building a couple boxes next week. These are for
> home use and the exercise is as much the reason for
> doing it as the result. I wanted to poll the list for
> thoughts on swap partitions. I started years ago with
> Caldera distros and used a swap partion tripple the
> size of ram. I don't remember where that rule came
> from but I followed it for a number of years. At last
> years installfest I was pursuaded to reduce the size
> to double that of ram. In the last year I've been
> using multiple swap partitions, 2 to 3, each a little
> larger than ram. All of these partitions reside on the
> hda.