adding more ram

Mike Silbersack silby at silby.com
Wed Dec 10 00:41:32 PST 2003


On Wed, 10 Dec 2003 nbari at unixmexico.com wrote:

> Hi all.
>
> I have a server with 1GB of RAM and a swap partition of 2GB i will upgrade
> the memory server to 2GB so my questions are:
>
> should i fix the swap partition to have now 4GB of space ?
>
> what other changes do i have to make to my system after adding more ram ?
>
> regards.

Dan's advice seems good; swapping more than a gig of data would be awful.

I'm replying because I want to answer your real question. <g> The notion
of swap = 2 x ram is an old one, and is no longer applicable.  (Some)
older VM systems used very simplistic swapping mechanisms, which required
entire processes to be swapped, thereby requiring large amounts of swap
space.  FreeBSD (and other modern OSes) page out to the swap file in
increments of 4K pages, and do so in a flexible manner.  As a result, you
should always have *some* swap space to handle overload cases, but it's
not necessary to keep any specific ram to swap ratio.

(Actually, the term "swapping" is still used inside the FreeBSD kernel,
but it only applies to paging out the last 20K or so of a process's
memory.)

Now, to contradict myself, there *is* a reason that you might wish to have
a larger swapfile.  Taking a crashdump requires that the swap file must be
of the size RAM + 64K or so.  Hence, your present swap file might be
slightly too small to take a crashdump once you upgrade to 2G ram.
Whether this is an issue for you or not depends on how often your machine
crashes and whether you wish to debug it. :)

Mike "Silby" Silbersack


More information about the freebsd-hackers mailing list