How much swap?
david thornton
david-FkEgs2FKm2NvBvnq28/GKQ at public.gmane.org
Tue Oct 31 22:51:40 UTC 2006
Cringe.
Do any of you gals/guys examine memory usage on long lived linux boxes?
(I used the term long lived in the windows sense of the term , ie more
than 2 weeks :P )
98% of boxes I've managed have never used swap. Never.
of the 2% that I have seen use swap:
1% are Oracle boxes often running more than one instance . I'm pretty
green on the oracle side but what I undestand Oracle is a good OS
citizen. You tell it how much you expect to use ( using some solid /
simple math) it then allocates as much as it needs , for now. Then as
needs rise , it uses upto as much as you originally told it to use.
Note: This might exceed Physical memory.. result? Swap. and that's ok in
that situ. Things run smoothly.
1% are boxes in serious trouble about to fall over go boom. Hullo poor
servlets/jsp in tomcat containers?
A colloary to this observation: physical memory usage run at 99.XX %
most of time ... this is due to agreesive disk caching as far as I know.
So, I've done servers with the 2XRAM swap and servers with nearly zero (
512 MB) (I'd never do that on an Oracle machine). The time the extra
swap buys me on a faulting app is negligble.
So what do you guys/gals see? Does swap help you when things go pear shaped?
David
ted leslie wrote:
>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
>
>
--
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