I have read here
(http://www.softpanorama.org/Internals/Filesystems/linux_swap_filesyst...
)
that swapping to a file is slower than swapping to a partition , based
on the following reasons
1) large files(swap file) will be somewhat fragmented forcing additional disk/head movement in some cases and that you will have to deal with metadata describing where on the disk the file blocks are. this eats up both in-system filesystem cache and causes additional disk activity while you load metadata that is not in cache is there any other reason that justifies this claim OR what exactly is the tradeoff between a swap partition and a swap file ??
september storm
This depends, are you using some type of faster raid setup, where the drives run in parallel? In 2.6 kernels, the swap is no longer slower/less efficient. If you have some type of raid for faster access, it could be better than a swap partition and a swap file is something you can recreate, move around, etc. more easily than adjusting a partition. Still, I prefer a swap partition over a file, just because I'm used to it. Most drives these days are not contiguous
anyway, so even a partition isn't what it used to be. Even still, I'll probably use a physical partition for swap for many years to come.
Doug Freyburber
My preference is based on error modes not on performance issues -
Using a swap file if it is not available until the file system
is mounted. If the file system is corrupted or lost the swap file
is not available. A swap file can get included in backups if you
are not careful about exclude lists. Also a swap file is
unavailable if the drive has a hardware problem or corrupt label.
If the file is deleted the inode stays active so the space stays
used but it goes away at the next reboot by which time you may
have forgotten about an accidental deletion. The swap file can
also be renamed making it unavailable at the next reboot.
Using a swap partition none of those issues apply. It's only
unavailable if the drive has hardware problems or if the label
is corrupted. The list of problems that make it unavailable is
much shorter.
No comments:
Post a Comment