How much swap?

ted leslie tleslie-RBVUpeUoHUc at public.gmane.org
Thu Oct 26 04:42:09 UTC 2006


i have lately set up some systems with 10-12-16 GB of ram and even
embarking on larger.
SUSE 10  seems to put the swap at 2GB (i guess as a max) once you are up
to these type of RAM numbers (this is in its standard install
configuration recommendation).
So I am thinking that there is generally never a need to go more the 2GB
of HD swap? (at least in Novell's opinion)
Now with ram being so darn cheap, how about a 16 GB system,
but put 2GB of that into a RAM based FS and mount that as your SWAP :)
kinda defeats the purpose, but at least Linux will have its swap
space :)





-tl

On Wed, 2006-10-25 at 15:09 -0400, Robert Brockway wrote:
> On Wed, 25 Oct 2006, Ian Petersen wrote:
> 
> > Chances are, there are a bunch of processes on your system that spend
> > most of their time idling.  If you have no swap, these idle processes
> > _must_ reside in real RAM, which eats away at the amount of RAM that
> > can be used for caching and buffering.  On the other hand, if you
> > allow the kernel to swap out mostly-idle processes, it has more room
> > for these speed-enhancing uses of physical memory.
> 
> Hi Ian.  You took the words right out of my mouth.  Ram being cheap is not 
> sufficient reason not to put swap in the system for exactly the reason 
> that you mention.
> 
> Allowing unused apps to swap and thus allowing the system to reclaim the 
> memory and use it for cache and buffering is an overall win for 
> performance, even after factoring in the need to swap apps back in from 
> time to time.
> 
> As for the original poster's query - the old "swap must equal 2x ram" 
> formula was derived from the swapping algorithms used on some versions of 
> Unix in the past.  This is not and has never been necessary on Linux[1].
> 
> Basically the amount of ram+swap should be higher than you would 
> reasonably expect the system to demand.  On systems with lots of ram (say 
> 4GB) I'll throw in a few GB of swap (disk is cheap too).  Watch out for 
> runaway processes that gobble lots of memory - having swap can prevent the 
> OOM killer[2] coming in to play and the OOM killer is nobody's friend.
> 
> On a side note I highly recommend setting per process limits.  See 
> limits.conf and ulimit.
> 
> [1] Actually there was one kernel which had a bug which meant that if swap 
> was not at least 2x ram the system would not swap at all.  This was 
> quickly fixed and was entirely unintentional.
> 
> [2] Out Of Memory killer.  ROARRR!!!!
> 
> Rob
> 

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list