From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 10 23:07:34 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2833516A4CE; Wed, 10 Dec 2003 23:07:34 -0800 (PST) Received: from VARK.homeunix.com (adsl-68-121-111-46.dsl.pltn13.pacbell.net [68.121.111.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAF5F43D09; Wed, 10 Dec 2003 23:07:31 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: from VARK.homeunix.com (localhost [127.0.0.1]) by VARK.homeunix.com (8.12.9/8.12.9) with ESMTP id hBB77FHj028339; Wed, 10 Dec 2003 23:07:15 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.homeunix.com (8.12.9/8.12.9/Submit) id hBB77FhF028338; Wed, 10 Dec 2003 23:07:15 -0800 (PST) (envelope-from das@FreeBSD.ORG) Date: Wed, 10 Dec 2003 23:07:14 -0800 From: David Schultz To: Mike Silbersack Message-ID: <20031211070714.GA28221@VARK.homeunix.com> Mail-Followup-To: Mike Silbersack , nbari@unixmexico.com, freebsd-isp@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG References: <20571.148.243.211.1.1071036438.squirrel@mail.unixmexico.com> <20031210023427.T14579@odysseus.silby.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031210023427.T14579@odysseus.silby.com> cc: nbari@unixmexico.com cc: freebsd-isp@FreeBSD.ORG cc: freebsd-hackers@FreeBSD.ORG Subject: Re: adding more ram X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2003 07:07:34 -0000 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. 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.