From owner-freebsd-questions Mon Oct 8 11:33: 9 2001 Delivered-To: freebsd-questions@freebsd.org Received: from lists.blarg.net (lists.blarg.net [206.124.128.17]) by hub.freebsd.org (Postfix) with ESMTP id 73F9837B405 for ; Mon, 8 Oct 2001 11:33:05 -0700 (PDT) Received: from thig.blarg.net (thig.blarg.net [206.124.128.18]) by lists.blarg.net (Postfix) with ESMTP id 175ABBD18; Mon, 8 Oct 2001 11:33:05 -0700 (PDT) Received: from localhost.localdomain ([206.124.139.115]) by thig.blarg.net (8.9.3/8.9.3) with ESMTP id LAA04637; Mon, 8 Oct 2001 11:33:04 -0700 Received: (from jojo@localhost) by localhost.localdomain (8.11.6/8.11.3) id f98Ia7m98179; Mon, 8 Oct 2001 11:36:07 -0700 (PDT) (envelope-from swear@blarg.net) To: Mike Meyer Cc: swear@blarg.net (Gary W. Swearingen), questions@freebsd.org Subject: Re: ideal swap partition space... References: <15297.5510.364245.686083@guru.mired.org> From: swear@blarg.net (Gary W. Swearingen) Date: 08 Oct 2001 11:36:07 -0700 In-Reply-To: <15297.5510.364245.686083@guru.mired.org> Message-ID: <7ypu7ygeso.u7y@localhost.localdomain> Lines: 70 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Meyer writes: > Gary W. Swearingen types: > > "default" writes: > > > I'm curious about setting up the amount of space for the swap partition... > > > is there any ideal amount for FreeBSD? > > Yes. None. > > Only under some conditions. If you want to get core dumps after a > panic, then the dump device needs to be at least 64K bigger than > memory. You might as well use that device for swap, as you can't use > it for anything else while the system is running. I consider that far from ideal. :-) From Handbook 24.2.6. Tuning the FreeBSD VM system: You should have at least 2x the swap space as you have main memory, and possibly even more if you do not have a lot of memory. The two-times rule, stated strictly, even for those who's programs fill a small fraction of their RAM. Continuing: If you want to be able to accommodate a crash dump, your first swap partition must be at least as large as main memory and /var/crash must have sufficient free space to hold the dump. Disagrees with what Mike and dumpon(8) says (main mem + 64 KB). (And it looks like we need a new rule of thumb for /var too.) > If you can't afford enough real RAM to hold everything, you'll have to > swap. According to the tuning man page, "The kernel's VM paging > algorithms are tuned to perform best when there is at least 2x swap > versus main memory." If one believes that and cares more about performance of the VM algorithms (whatever that might mean, assuming the author knew) than about the extra disk space, then >2x would be good advice. It's a good thing to discuss in the tuning man page, but I'd leave it out of general advice because it doesn't seem important enough (if right). If one doesn't need to page, then paging performance isn't an issue. If one needs to page only 0.5x RAM, are we to believe that it makes a performance difference if we have 1x or >2x swap? I suspect that the tuning(7) author didn't go into enough detail with the above statement or didn't understand what "best" means. Such things are usually much too complex to state in one word. Of course, with today's drives, people don't mind wasting huge chunks of disk if there's the least possibility it might help performance. Let's consider an extreme (but fairly commom these days) case: I have 512 MB of RAM and never need more than 128 MB of virtual memory and need my VM system to run as fast as possible and I won't set my system up to dump core for debugging (or whatever). Is my system going to run faster with 1 GB of swap than with 512 MB or 256 or 128 or 64 or zero? I'll admit the possibility, but find it doubtful enough to assume that no swap would be just as fast as 2x or 10x swap. With the same RAM but need for 768 MB of VM, I'd be just as comfortable having 1x swap as 2x. I suspect that "performs best at 2x" is only implying that the VM system will, for example, page 1.8xRAM in 2xRAM swap faster than it pages 0.9xRAM in 1xRAM swap or something along those lines - some measure of efficiency, not raw speed, and the comparitive efficiency should be of zero concern to the user who only needs to page 0.9xRAM. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message