[CentOS] Re: Swap Considerations

Thu Mar 1 17:12:02 UTC 2007
Les Mikesell <lesmikesell at gmail.com>

Mike McCarty wrote:
>>
>> Might be a little slower with file system overhead, but it is not a 
>> problem to
>> do so.
> 
> I have heard that, with ext3, the extra time to use a file
> has mostly been removed.
> 
>> Is there some reason you want to use a file? IMHO a 2 gig swap 
>> partition takes
>> the same space as a 2 gig swap file.
> 
> Yes, I'd like to experiment with various amounts of swap,
> and see what best fits my system. I don't want to repartition
> over and over, and reinstall repeatedly. ISTM that if I can
> fix the size of swap by using a file it would be more easily
> tuned.

What kind of a system are you using where this even matters?  If you've 
swapped out 2 gigs and have to wait for programs to reload as they run 
the machine will be so unresponsive that you'd probably reboot instead 
of waiting for it to recover.  It doesn't hurt to swap out memory from 
programs that aren't active and you want to survive the nightly updatedb 
runs, etc. that hopefully happen when interactive speed doesn't matter, 
but if you are swapping enough that performance of the swap space 
matters you should fix it some other way.  Remember what Seymour Cray 
said about virtual memory: "Memory is like an orgasm.  It's a lot better 
when you don't have to fake it".  And that hasn't changed.

> But I hope the tuning isn't markedly different for using
> a swap partition and a swap file. Near a min or max, any
> smoothly changing function has a derivative near zero,
> so if the sweet point isn't very far away, it shouldn't
> make much difference to actual performance.

You should be able to add a file as extra swap space if you need it in 
addition to any partition(s) you have configured.

-- 
   Les Mikesell
    lesmikesell at gmail.com