Swap Space

Jerry McAllister jerrymc at msu.edu
Thu Jan 6 15:18:09 UTC 2011

On Thu, Jan 06, 2011 at 09:42:36AM +0000, Matthew Seaman wrote:

> On 05/01/2011 22:33, Jeff Whitman wrote:
> > I'm finding conflicting data on this.  Some say 0, some say 1 times RAM,
> > others say stay with 2 x RAM.
> Standard advice is 2x RAM -- but that dates back to the days when
> servers would have quantities of RAM measured in Megabytes rather than
> Gigabytes.

Of course, in those days disk space was measured in MBytes too.
>                             Also, there's a maximum of -- I think -- 8GB
> swap above which the performance of swap is degraded, due to algorithmic
> limits in the way memory pages are mapped onto disk pages.

I don't know about an 8GB limit for swap performance.  I suppose
it is possible.    So, the following formula from Mathew is probably 
a good new rule of thumb.

> You need 1 x RAM + a few kB in order to support getting a crashdump. Or
> at least, you did before the days of minidumps.  Not sure what the
> requirements are for getting system dumps nowadays.  Swap space used for
> crashdumps should be a raw partition, not a file.


> On the other hand, for good performance you should not be using any
> significant amounts of swap in normal usage.  You will need some swap,
> as the OS tends to use a small amount even when not under memory
> pressure.  You should have swap to act as a buffer in case your machine
> suddenly starts using up more memory than you expect, either because of
> memory leaks, or due to demand spikes or through any number of other
> possible causes.
> Therefore, I think the best advice for a modern large memory system
> would be:
>     If RAM > 8GB, then SWAP = 8GB[*]
>     If RAM < 8GB, then SWAP = 1 x RAM + delta
> where delta is perhaps a Megabyte or so.  Just rounding the partition
> size up to the next cylinder boundary should be enough (which happens
> automatically with most partitioning schemes).
> 	Cheers,
> 	Matthew
> [*] In this case, if you need crashdumps, you should dedicate another
> otherwise unused partition of the correct size as your dumpdev.
> -- 
> Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
>                                                   Flat 3
> PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
> JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

More information about the freebsd-questions mailing list