Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2003 23:07:14 -0800
From:      David Schultz <das@FreeBSD.ORG>
To:        Mike Silbersack <silby@silby.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: adding more ram
Message-ID:  <20031211070714.GA28221@VARK.homeunix.com>
In-Reply-To: <20031210023427.T14579@odysseus.silby.com>
References:  <20571.148.243.211.1.1071036438.squirrel@mail.unixmexico.com> <20031210023427.T14579@odysseus.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 10, 2003, Mike Silbersack wrote:
> 
> On Wed, 10 Dec 2003 nbari@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031211070714.GA28221>