FreeBSD Install config
paul at freebsd-services.com
Fri Dec 21 11:40:36 GMT 2001
--On Thursday, December 20, 2001 23:55:11 +0000 AMAKAWA Shuhei
<sa264 at cam.ac.uk> wrote:
> At Thu, 20 Dec 2001 21:21:34 -0000,
> Paul Richards wrote:
>> > Then comes swap. The 2 * (amount of ram) rule has been around for
>> > years and is still pretty spot-on. If you're like me and also have
>> > /tmp mounted on swap you can make it slightly bigger. Also can't hurt
>> > to increase size anyway, diskspace is cheap and running out of swap
>> > isn't something you want to run into.
>> I think the 2 * rule is overkill these days. If I remember correctly it
>> started with Sun but my memories hazy.
>> Anyway, it's not relevant at all to FreeBSD or the current situation with
>> memory being one of the cheapest components of the system.
>> You don't really need swap at all, it's only there to provide support for
>> swapping out programs from "expensive" memory to "cheaper" disk so you
>> can run more programs than you otherwise could. If you're box is
>> swapping these days then just put more memory in it :-)
> Doesn't too small a swap adversely affect the FreeBSD swap
> performance? I'm not exceedingly familiar with FreeBSD VM/swap
> subsystem though..
> Anyway, it's always a good idea to have a decent amount of swap
> space. If your program is continuously swapping in and out, then
> you probably need more memory. But if your program requires nearly
> (but less than) all your memory and if you have big enough swap,
> then idle processes will be swapped out and your busy program will
> run happily without continuously swapping. If you don't have enough
> or any swap, you'll be in trouble.
(I've used the term swapping a lot here, but strictly speaking what we're
talking about is paging. If your system is really swapping i.e. whole
processes are getting flushed out to swap, then you really need to put a
lot more physical memory in your box because the VM system is taking
desperate measures to try and cope with the memory load)
With FreeBSD's VM architecture the total memory available to processes is
RAM + SWAP.
If you exceed the total memory available then your processes start to die,
so it's a simple question of how you make up the total memory in your
You could have a 512M DIMM, or you could have 256M DIMM and 256M of swap,
in both cases the amount of memory available to processes is 512M, but in
the latter case pages have to be shuffled between the "fast" and "slow"
parts of the total memory available. It's a bit like having another layer
of cache, those pages that are currently being "hit" are moved into the
faster memory, just like having them in the cache.
So, the rule for determining how much swap you need should be based on your
calculations as to what the maximum memory usage of the system will ever
be. If you do those calculations when you're building the box then you
should just put enough memory in to match that figure, since memory is very
cheap these days.
I'm not advocating having no swap since with the sizes of disks these days
you might as well throw 256 or 512M at a swap partition, and then when you
unexpectedly load the box more than you originally intended you have that
as a fallback, rather than have your processes die, but figures like 2 x
real memory are way out of date, and with the sizes of DIMMs these days
you'll just waste a lot of disk space.
> Actually, even if your system has abundant memory, some idle pages
> will be swapped out, thereby making some small number of pages
> available to other processes.
FreeBSD doesn't swap out idle pages unless it runs out of physical memory
so if your system has abundant memory then you'll *never* see any swapping.
FreeBSD Services Ltd
More information about the Ukfreebsd