[Techtalk] Swap away

Nicoya Helm nicoya at nicoya.org
Sun Jun 15 14:29:35 UTC 2008


>-------- Original Message --------
>Subject: [Techtalk] Swap away
>From: "Gayathri Swaminathan" <gayathri.swa at gmail.com>
>Date: Sat, June 14, 2008 12:37 pm
>To: Techtalk <techtalk at linuxchix.org>

>Hi:

>A recent incident motivated me to research a bit on swapping.

>The question I was researching on was "How large should my swap be?"

>There is no single answer but only different views.

>The generalized unanimous answer is:

>In old days, 2.4.x kernels when physical memory was small 64-128MB we set
>swap to be roughly 1.5xphysical or 2xphysical, but in these days when we are
>able to buy 4GB physical RAM, it is really up to **one** to set their swap

>Added to this confusion 2.6.x kernels allow you to alter
>"/proc/sys/vm/swappiness"
>and tweak swap

>How do I know, how much swap I need?

>Thanks,
>Gayathri


As the responses from several list members illustrates, this greatly
depends on how you're using your swap.  A laptop that will be
hibernating often is a different situation from a 24x7 server.  

I'm by no means an expert on swap, and tuning swap seems to me an art
form since there are so many variables to consider.  In an effort to
simplify my life as a sys admin, unless it's a high-load production
server with applications whose behaviors are easily catered to with
swap/swapiness tuning, I follow these generic recommendations:

RAM/Swap
 --------------------------------------------
 1 GB - 2 GB / 1.5 times the size of RAM
 2 GB - 8 GB / Equal to the size of RAM
 more than 8GB / 0.75 times the size of RAM

I've seen this chart repeated in documentation from Novell re: their
Enterprise Server product as well as Oracle.  Anyone have any insight
into other distros? 

I tend not to tune my laptop or desktop unless a specific performance
issue arises. I just stick with the old-school no-brainer "double
physical" rule (unless disk space is an issue).  While the extra swap
may be wasted initially, if I add memory later I usually don't need to
adjust swap space.

~~~Nicoya...
---KC0VVR---
"It is never too late to be what you might have been." --George Eliot



More information about the Techtalk mailing list