Swap usage discussion

Alan Dayley plug-devel@lists.PLUG.phoenix.az.us
Fri Jun 18 08:40:03 2004


Ted Gould said:
>
> I understand what you're saying, but I think that there is an important
> thing to note here.  I'm pretty sure that Linux won't swap code pages
> into the swap partition, it 'swaps' them back to the local partition.
> This because the program shouldn't have changed, so the one on disk is
> just as good of a swap.  I'm not 100% sure on that one, but someone told
> me that once ;)

That would be interesting to confirm.  I had not heard that before.

> Alan, I think probably the moral of the story here is that any model you
> make of the filesystem is going to have to be amazingly complex.  You
> might be better gathering some data on a live system, and then using
> that.  I think that there are lots of people that can tell you what
> various things do at different levels, but I'm not sure anyone really
> understands: 'How does RedHat 7.3 running workload X use the swap?'  The
> filesystem guys are going to say it's a daemon issue and the daemon guys
> a kernel issue.

I am not sure how accurate the answer has to be.  Obviously you are
correct in that the real answer could only be found by sampling the
activities of a working system.  But, it may be good enough to point to a
few documented and expected behaviors and reach an educated guess on what
will happen to the media.

On the other hand, my research has found a recent discussion in the kernel
list and subsequently on slashdot about the merits of running a system
with no swap.  The opinion of many seems to be that as long as you are
careful with the amount of RAM you need, and you have enough for your
needs, as swap area on the hard drive is not needed.  You do risk an
immediate out of memory crash if a process gets out of hand but many
people accept that risk and have found they don't need it.

I'll keep reading.  Thanks for the discussion.

Alan