From owner-freebsd-questions Mon Oct 8 15:18:26 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-31-203-60.mmcable.com [65.31.203.60]) by hub.freebsd.org (Postfix) with SMTP id 7B92137B406 for ; Mon, 8 Oct 2001 15:18:22 -0700 (PDT) Received: (qmail 92448 invoked by uid 100); 8 Oct 2001 22:18:16 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15298.9768.941595.251630@guru.mired.org> Date: Mon, 8 Oct 2001 17:18:16 -0500 To: swear@blarg.net (Gary W. Swearingen) Cc: questions@freebsd.org Subject: Re: ideal swap partition space... In-Reply-To: <7ypu7ygeso.u7y@localhost.localdomain> References: <15297.5510.364245.686083@guru.mired.org> <7ypu7ygeso.u7y@localhost.localdomain> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ 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 Gary W. Swearingen types: > 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. :-) Patches are appreciated :-). > 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.) I'm quoting the dumpon man page. Patches to the handbook are appreciated as well. > > 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. The author was Matt Dillon. There may be someone who knows more about the FreeBSD VM system, but I couldn't identify them. > 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? Yes, you should. Remember, FreeBSD doesn't just swap pages out when it has to, it moves them to swap if they're idle and unused. So the amount you "need to page" is only part to the actual amount of swap the system will use to optimize performance. > 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. Yup. I'm one of them. I used to do LISP development, and habitally set swap to 4x main memory, because LISP compiles chewed up what was immense amounts of memory for the time. > 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. I'd say that's a a good assumption. Under those conditions, I'd say that's ideal. > With the same RAM but need for 768 MB of VM, I'd be just as comfortable > having 1x swap as 2x. While you may be just as comfortable, but your performance might well suffer. Again quoting the tuning man page: "Configuring too little swap can lead to inefficiencies in the VM page scanning code". > 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. You could ask Matt, but I suspect that if he meant someting like that, he would have said it. http://www.mired.org/home/mwm/ Q: How do you make the gods laugh? A: Tell them your plans. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message