swap file vs. swap partition

Peter Arremann loony at loonybin.org
Sat Jul 30 21:31:31 UTC 2005


On Saturday 30 July 2005 15:02, Damian Menscher wrote:
> Interesting link, though the graph is labeled so poorly it's not clear
> what it even is supposed to mean.  I'm not convinced you interpreted it
> correctly.
>
> I used to think the data transfer rate would be faster on the outer
> cylinders, but then I benchmarked it.  There's no difference on the
> disks I checked (18G scsi disks).  Oh, and keep in mind that the
> relevant factor is seek speed, not data transfer speed, if you're using
> your disk as RAM.  Don't forget that the R stands for Random.
The way to interpret this is simple. If I do a seq. read of 1GB at the 
beginning of the disk, its gonna be faster than at the end - just like you 
said. All disk drives exhibit that behavior (or exactly the opposite in some 
drives if the mapping is to start from the inside.) 

The performance difference depends on disk type - it goes from 15% to 65%. 
Some disks that are meant for A/V processing even show smaller capacity so 
they will not loose as much performance toward the end of its capacity. 
If you throw in random seeks its even worse. If you need to randomly read 10 
sectors out of 500... And I got 50 sectors by track, then I need to do 
somewhere between 0 and 9 seeks after the first sector is read. If I have 
500sectors per track (just to make the math easy) then I would be guaranteed 
to have no seeks at all. 

The page size is another thing you have to consider. You never read just one 
sector but depending on your architecture 4K, 8K or even up to 4MB at the 
time. That's when you'll see quite a bit of performance difference. Of course 
in the end it means only a few percent but its an advantage :-) 

> (I did this for a project several months ago where I was adding 64 gig
> of swap space -- 8 gig on each of 8 drives.)
That's the smart thing to do if you got enough spindles... :)

Peter.




More information about the fedora-list mailing list