sounder 8, JS on Swap

Matt Zimmerman mdz at canonical.com
Sun Sep 12 12:30:02 CDT 2004


On Sun, Sep 12, 2004 at 05:59:48PM +0800, John wrote:

> Rather than repeat my argument here, see:
> http://lists.debian.org/debian-boot/2004/08/msg00016.html
> 
> No, I've not done benchmarks. It seems so clear to me I wonder that 
> anyone would challenge my argument in that manner.

Swap partitions are faster than swap files for the simple reason that they
do not require metadata to record where their various pieces are stored on
disk.  They start at an offset, and continue for a defined length.  Unless
the filesystem has special extensions which optimize for this type of file
(e.g., VxFS QIO), the file will be stored discontiguously (requiring
additional seeks and reads to find its pieces on the disk), and also more
reads and writes to update its metadata, the filesystem journal, etc.

Using a swap file doesn't guarantee that the swap data will be stored closer
to other frequently-used data, though it certainly increases the chances.  I
don't think that it would be a good tradeoff, however, to give up
contiguousness in exchange for closeness to other data.

I would expect a change from a swap partition to a swap file of equal size
on the same disk to result in a net loss regardless of its location, on
typical Linux filesystems (especially ext3, which is our default).  I would
welcome an actual benchmark, but I don't know of an existing one which would
cover this, and it would be non-trivial to come up with an accurate test.

-- 
 - mdz




More information about the sounder mailing list