Swap space

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Tue Nov 1 08:10:37 PST 2005


Bob Johnson <fbsdlists at gmail.com> writes:

> On 11/1/05, Ian Lord <mailing-lists at msdi.ca> wrote:
> > Hi,
> >
> > I just bought 4 servers with 4 gigs of ram, the documentation
> > proposes to use 2 to 3 times the amount of ram for swap... I don't
> > think 12 gigs of swap would be useful lol, but do I really need to
> > put 4 gigs of ram. (It might be useful for kernel dump but...)
> >
> 
> That's the original reason for the suggestion.  You need more than
> twice the amount of RAM if you need to capture a dump for debugging. 
> If you won't ever be doing that, you may not need so much swap.

Not quite:
>From dumpon(8) on 5-STABLE:

     For most systems the size of the specified dump device must be at
     least the size of physical memory.  Even though an additional
     header is added to the dump, the BIOS for a platform typically
     holds back some memory, so it is not usually necessary to size
     the dump device larger than the actual amount of RAM available in
     the machine.

> My experience is that if you have much more than twice the RAM size
> swapped out, things start to get so sluggish that it is better to find
> a way to reduce your memory requirement or provide more physical
> memory.  Of course, that is characteristic of MY usage and may not
> apply at all to your usage, but it may be the reason that 3xRAM is the
> upper limit of what is routinely recommended.

Interactive single-user use will probably act like that nearly all the
time.  High page fault rates will always slow the system down.  It's
not necessary the case that a system will maintain high paging rates
when it's gone deep into swap, but the exceptions are rather special
cases.  

> > What do you guys do with swap space in this scenario ?
> 
> Provide what you think you will need.  It depends on what you expect
> to be doing with your memory.  A busy mail server that will be using
> huge amounts of temporary storage to manipulate the messages may not
> need a lot of swap, simply because you might prefer to throttle
> incoming mail when the system gets heavily loaded rather than get deep
> into swap and slow the system down.

That's an interesting example, but it's still just an example; it
won't necessarily apply to all mail servers, especially configurations
that use a lot of short-lived files.

The basic advice is quite sound, so I'll reiterate it:  Provide what
you think you might ever need.  If in doubt, err on the side of
caution.

> I configured my new 4GB servers with 4GB of swap.  That's more than I
> expect to ever need, but I have oodles of disk space.   If you have
> multiple drives, you may want to spread that out among the drives for
> more efficiency (but to do a dump you need enough contiguous space on
> one drive).

For ordinary desktop or server use, I think it's always a good idea to
have enough swap for a kernel dump.  It's cheap insurance.


More information about the freebsd-questions mailing list