Rich Freeman on 20 Jun 2014 18:17:58 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] How much swap do you need?

On Fri, Jun 20, 2014 at 9:11 PM, Eric Lucas <> wrote:
> Just put 8gb of RAM in my laptop. (was: 4)  The system has a 4gb swap
> partition.
> I was going to search the PLUG archives and maybe ask on the list about how
> much swap I need now.  A little 'Google' research led me to this at
> serverfault which I think this is a very good anaylsis:

If you want to use suspend then you need more swap than RAM.  If not,
then it really doesn't matter, in theory.

> I'm running a VM or two (via: Vagrant) and may experiment with Docker - so
> more RAM helps.  Apparently, keeping the swap is a good idea.  I'm kind of
> surprised but also convinced.

So, while in theory Linux should only be helped by having access to
swap, in practice it doesn't always work out that way.  I disabled
swap on my system because I could never find a swappiness value that
really worked well.  In theory swap should just give the kernel more
options so that it can do the right thing, but in practice I have
found that just as often it uses those options to do the wrong thing.

But, on this system I usually have RAM to spare.  I don't think it
makes any difference if you plan to run containers - it doesn't matter
where the processes are running - swap is best used for stuff that
isn't actually being used.

The one area I could see swap being universally beneficial is when
some application has a memory leak.  Swap would let the kernel have
someplace to dump the unused pages, and there should be no penalty
since it will never be read anyway.  This will buy you time before you
hit the OOM killer.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --