lkml.org 
[lkml]   [2004]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: why swap at all?
John Bradford wrote:

>Quote from Roger Luethi <rl@hellgate.ch>:
>
>
>>On Wed, 26 May 2004 02:38:23 -0400, Anthony DiSante wrote:
>>
>>
>>>Now I buy another 256MB of ram, so I have 512MB of real memory. Why not
>>>just disable my swap completely now? I won't have increased my memory's
>>>size at all, but won't I have increased its performance lots?
>>>
>>>Or, to make it more appealing, say I initially had 512MB ram and now I have
>>>1GB. Wouldn't I much rather not use swap at all anymore, in this case, on
>>>my desktop?
>>>
>>>
>>Swap serves another (often underrated) purpose: Graceful degradation.
>>
>>If you have a reasonably amount of swap space mounted, you will know
>>you are running out of RAM because your system will become noticeably
>>slower. If you have no swap whatsoever, your first warning will quite
>>possibly be an application OOM killed or losing data due to a failed
>>memory allocation.
>>
>>Think of the slowness of swap as a _feature_.
>>
>>
>
>There is a very negative side to this approach as well, especially if users
>allocate excessive swap space.
>
>A run-away process on a server with too much swap can cause it to grind to
>almost a complete halt, and become almost compltely unresponsive to remote
>connections.
>
>If the total amount of storage is just enough for the tasks the server is
>expected to deal with, then a run-away process will likely be terminated
>quickly stopping it from causing the machine to grind to a halt.
>
>
No. Something will be terminated, not necessarily the "evil"
process. A runaway process can have quite a few server processes
killed before it eventually dies. An attacker will of course
use processes that forks, so some remain and can keep
spending memory and process time.

ulimit is the way of limiting how much memory a user can use,
preventing this scenario. Not setting up swap isn't.

>If, on the other hand, there is excessive storage, it can continue running
>for a long time, often consuming a lot of CPU.
>
>When the excess storage is physical RAM, this might not be particularly
>disasterous, but if it's swap space, it's much more likely to cause a serious
>drop in performance.
>
>
>
Well, the process (or processes) can consume lots of cpu time
without swap too. It can cause server processes to get killed (or
not get memory they need) and it can cause slowdowns ny
evicting nearly all program code from memory.

>For a desktop system, it might not be a big deal, but when it's an ISP's server
>in a remote data centre, it can create a lot of unnecessary work.
>
>
>
Definitely use ulimit on such a machine.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.333 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site