[GTALUG] optimum swap size

Alvin Starr alvin at netvel.net
Wed Feb 27 13:47:39 EST 2019


As a side note.

I have found that at times it is better to have no swap space or a small 
swap space.

In the case of things like web servers, a sudden burst of activity can 
cause the web server to start to run into swap.
Once this starts the response to requests starts to slow and quickly the 
server can be just about ground to a halt.
If there is enough swap space the web server can go offline for a very 
long time.

In this case it is better so have a few requests fail quickly than to 
have the system go effectively offline for an extended period..

On 2/27/19 1:20 PM, David Collier-Brown via talk wrote:
>
> Linux is somewhat unusual in that it dynamically kills large processes 
> when it's running out of memory. You used to have to set limits to get 
> that behavior. Because of it, I run a moderately large swap (~8 GB) 
> and can watch large jobs drive swap usage up. Then /*I*/ decide if I 
> want them dead.
>
> --dave
>
> On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote:
>> On 2019-02-27 10:02 a.m., Gary via talk wrote:
>>> I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum
>>> size swap area that I should have?
>> I asked a question about this at a GTALUG Q&A a few years back.
>> Basically what I remember was:
>>
>> * are you frequently running out of memory? If not, don't change anything.
>>
>> * depending on what applications you're running, there are various
>> kernel parameters that govern swap behaviour. They're tuned for
>> "typical" performance.
>>
>> * The OOM killer (out-of-memory process killer) can sometimes kill a
>> task that's taking up what it thinks is too much memory. I sometimes get
>> that with very large (or very badly thought out) OpenSCAD renders, and
>> it can be annoying to have to work round it. OOM killer exists to keep
>> the system stable, and doesn't care if your work isn't happening.
>>
>> Swap is more of a thing on smaller machines such as a Raspberry Pi.
>> These days, you've always got enough memory + swap until you find that
>> one job for which you don't. For me, that was trying to build MySQL (for
>> someone else, I promise!) on a Raspberry Pi.
>>
>> cheers,
>>   Stewart
>>
>>
>> ---
>> Talk Mailing List
>> talk at gtalug.org
>> https://gtalug.org/mailman/listinfo/talk
> -- 
> David Collier-Brown,         | Always do right. This will gratify
> System Programmer and Author | some people and astonish the rest
> davecb at spamcop.net            |                      -- Mark Twain
>
> ---
> Talk Mailing List
> talk at gtalug.org
> https://gtalug.org/mailman/listinfo/talk

-- 
Alvin Starr                   ||   land:  (905)513-7688
Netvel Inc.                   ||   Cell:  (416)806-0133
alvin at netvel.net              ||

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20190227/aa011b35/attachment.html>


More information about the talk mailing list