adding more ram

David Schultz das at FreeBSD.ORG
Wed Dec 10 23:07:34 PST 2003


On Wed, Dec 10, 2003, Mike Silbersack wrote:
> 
> 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.

The real reason that 2 * sizeof(RAM) is often an overestimate on
FreeBSD is that FreeBSD overcommits swap (as others have pointed
out.)  Many (most?) other systems do not overcommit, including
Solaris.  Some systems, such as Tru64 (and Linux???) support both.
For these systems, 2 * sizeof(RAM) is sometimes even an underestimate.

These days overcommit is actually not very sensible.  Even though
it tends to overestimate space requirements, disk capacity has
outstripped RAM capacity to such an extent that the cost is
nominal.  The advantage of being more conservative is that you
never have to kill processes to save the kernel from deadlock.
(Wes recently added a simple feature that improved the situation,
but randomly killing processes is still a kludge.)

Unfortunately, getting non-overcommit right is hard.  In addition
to checking available space every time you allocate pageable
memory (including things like lazily copied map entries), you also
need to be careful to reserve enough space for stacks for each
application thread, etc.


More information about the freebsd-isp mailing list