Date: Tue, 29 Oct 1996 12:24:25 +1100 (EST) From: Douglas Thomas Crosher <dtc@scrooge.ee.swin.oz.au> To: current@freebsd.org Subject: Re: Request to add this to FAQ re: swap space Message-ID: <199610290124.MAA25150@scrooge.ee.swin.oz.au> In-Reply-To: <199610290016.TAA00994@dyson.iquest.net> from "John S. Dyson" at Oct 28, 96 07:16:00 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> How much disk should I allocate for swap? > > Each OS has different algorithms for swap memory allocation. FreeBSD > takes maximum advantage of available RAM by fairly agressively pushing > seldom used pages out to disk. The algorithm that is used by FreeBSD > also requires that every anonymous page in a process be backed by an > equivalent amount of swap space. Additionally, due to the way that > the algorithm works, the swap space needs to be at least as a very > minimum, the size of physical ram. But, ignore that statement, because > in practical terms, the minimum amount of swap space should be MUCH larger... ... > The best formula to use is to calculate the size of all of the processes > that you plan to run, and use that value (with a practical minimum of > 2 times RAM.) Figure that a heavily used X windows workstation can easily ... > comfortable. And remember, you need swap space for every anonymous page > in a process. ... > So, to make it simple: > > swap-space = min(2*RAM, sum of the sizes of all processes); > > as usual, add some space in for expansion and for process growth. My experience is that freebsd can use significantly more swap space than the maximum virtual size of processes. I see this when a process is continuously mapping and unmapping anonymous pages from a large mmaped region. E.g. A single process using 140M of virtual memory + a few other small processes can use up 192M. Perhaps: swap-space = min(2*RAM, 2*sum of the sizes of all processes); And: ... The algorithm that is used by FreeBSD also requires that every anonymous page in a process be backed by at least an equivalent amount of swap space, and perhaps significantly more. ... Regards Douglas Crosher
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610290124.MAA25150>