[clug] to swap or not to swap that is the question

Richard richard_c at tpg.com.au
Tue Jun 29 12:24:22 GMT 2004


Kim Holburn wrote:

> Suppose you have a system with say 1G of RAM and swap of 2G.  How is 
> that better than say a system with 2G of RAM (or even 3G RAM).
>
> Is it because HD is so much slower that the wait causes everything to 
> slow down?

I'll throw in a comment here. I think the bottom line is that ideally 
the set of memory pages that are used should always be kept in RAM, and 
if you /really/ need them, then putting them in swap is better then not 
having them at all. Therefore, you should always have as much RAM as 
practical, and enough swap space to cope with bizarre spikes (HD space 
being cheap and all). You should never have swap space in preference to 
more RAM though.

I've heard of admins who are so insistent that everything should be in 
RAM at all times that they don't run any swap at all and use crashing 
processes as an indication to add more RAM. The theory runs that swap is 
only a short step from thrashing the disk, which will cause performance 
to nose dive, which is only a short step from crashing the process 
anyway. I think this a bit extreme.

That's my understanding at any rate.

Richard


More information about the linux mailing list