Recommended SWAP space for large amounts of ram (8GB)

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Sep 14 13:56:08 UTC 2011


On 14/09/2011 13:34, Jonathan Vomacka wrote:
> Each operating system seems to have different documentation regarding
> what a decent swap size is for systems with large amounts of RAM. My
> system only has 8GB of RAM. Some people have gone with the general idea
> that 2X the amount of RAM is sufficient but for systems with large
> amounts of memory 1X the amount of RAM is fine. I was also told that
> anything over 2GB of SWAP space will cause performance issues on the
> system and that it is not recommended.
> 
> Either from the FreeBSD docs, or based on personal experiences, what is
> the recommended swap space for a 8GB system? Your opinions are greatly
> appreciated

The old rule of thumb of swap = 2 x RAM dates back to the days when
128MB RAM was a big deal.  Nowadays, you're likely to have that much in
your phone, and systems with 128GB RAM are not unknown.

In these days of plentiful RAM, the new rule of thumb is "if you're
swapping, then you're doing it wrong."  You don't need anything like as
much swap nowadays, at least, not as compensation for lack of RAM.  You
may need swap to back eg. tmpfs filesystems.  You don't need swap
nowadays for system dumps -- any partition with ephemeral data (or no
data at all) can be used for dumping, and given that minidump capability
exists now, you don't even need to supply the 1 x RAM + delta required
for a full dump.

That swap > 2GB resulted in performance problems was certainly true
once, but I doubt very much that it is still the case in HEAD or the
upcoming 9.0-RELEASE, nor probably in {7,8}-STABLE.  IIRC the problem
was due to avoiding integer overflow in some calculations deep inside
the VM system, which is usually not a hugely difficult problem to fix.

My recommendation: for systems with 1GB RAM or more, and that don't make
heavy use of memory filesystems and the like, then 2GB swap is ample,
and you can probably get away with as little as 1GB at need.

	Cheers,

	Matthew

-- 
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110914/59fde54f/signature.pgp


More information about the freebsd-questions mailing list