Memory upgrade and swap partition size

Ben Scott dragonhawk at gmail.com
Tue Sep 26 13:41:01 EDT 2006


On 9/26/06, Jon maddog Hall <maddog at li.org> wrote:
> o RAID striping of your SWAP partition
> o placement of SWAP on a seldom used disk spindle (same thing with /tmp and /usr/tmp)
> o allocation and placement of multiple swap partitions to minimize disk latencies
> o Solid state SWAP devices

  Conversely, RAM prices have fallen incredibly.  IMO, these days,
you're almost always better off investing your money in more RAM,
rather then elaborate disk schemes to increase the performance of
swap.  If the performance of swap becomes an issue, the fix is to add
RAM so swap performance doesn't matter.  :)  As you say, "always more
RAM".

  There are exceptions to this, of course.  For a big multi-user
server or other system with an unusually heavy and varied workload,
worrying about swap performance might pay off.  Not for most systems,
though.  Even, say, a database server: If your database application
can't fit in a few tens of gigabytes of RAM, it might be more likely
that you need to pick better algorithms, or find better database
software.  (I'm assuming you're not running eBay or Google or some
such.)

  I've gone without a swap partition on desktop systems with
reasonably large memories (512 MB of RAM or more) with no noticeable
effects.  If you're running such a desktop system and you *need* swap,
something's wrong.  :)

  Which is not to say swap is useless.  There are always going to be
memory pages that rarely get used, and if you can gain some RAM by
putting those pages on disk, it's likely worth it.  But it's unlikely
you'll have more than a few tens of megabytes of such.  (Then again,
maybe GNOME and KDE have added enough bloat that 200 MB of dead code
is normal.  ;-)  )

  Swap space is also used for things like suspend-to-disk and kernel
core dumps, where swap needs to be at least the size of RAM.

  There's also the question of whether the kernel's memory manager
wants some amount of swap space to work with.  In the past, this was
accepted as "common knowledge".  These days, I'm not so sure.  I've
seen conflicting answers.  Given that the Linux kernel's memory
management subsystem has been overhauled rather a lot (compared to
other OSes), I suspect such information ages more quickly then most
are used to.

-- Ben



More information about the gnhlug-discuss mailing list