Swapping to a large sparse file

John Morris jmorris at beau.org
Sat Jan 17 02:11:36 UTC 2015


On Fri, 2015-01-16 at 14:26 -0700, jd1008 wrote:

> In older "traditional" practices, swap space was normally
> about twice the ram size. Today, with some systems having
> 64 and even 128GB and even larger RAM, it becomes interesting
> how big swap space should be. Where is the cutoff for performance?
> Paging in and out 128GB memory space could prove to be itself a
> performance bottleneck on very busy or memory bound servers.

My advice is don't bother unless you know you need it.  I find 512MB or
1GB to be plenty of swap.  You need some swap just so the system can
ditch memory that was used once to initialize code but isn't accessed
again and other similar things that can be safely tossed to swap and
forgot about.  But if the system is actually swapping hundreds of
megabytes in and out you will quickly be in a world of pain.  Plus most
of the time when that sort of memory pressure hits it is a runaway
process that the OOM killer will eventually take out and having a lot of
swap only increases how long you suffer with an almost totally
unresponsive machine until that happens.  If you are swapping and it
isn't a runaway process or an exception to process a one off huge
dataset it is a sign you need to bite the bullet and get more ram.  If
you know you are going to need a lot of swap to get through some script
you banged out that allocates memory like mad, just add an extra
swapfile on a temporary basis and drop it when you are done.  You are
allowed to have multiple swap files, partitions or any combination of
them within sensible limits.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20150116/6e0b44b0/attachment.sig>


More information about the users mailing list