Which is faster, a swap file or a swap partition?
This is a question that comes up on a fairly regular basis on IRC chatrooms, mailing lists, etc. which has widely varying answers depending on the source.
While updating our courseware a few days back, I decided to start digging into the issue and found a couple of very interesting reads.
The most common claim is that a swap partition is faster than a swap
file because in older versions of the Linux kernel experienced some filesystem overhead when accessing the swap file.
Ever since the release of 2.5.23 of the Linux kernel, however, this is no longer the case.
http://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.23
(search for the line: "[PATCH] direct-to-BIO I/O for swapcache pages")
In case the highly-technical explanation of how swap files are now handled is less-than-enlightening, perhaps a description from number two Linux kernel developer himself (Andrew Morton) can help clear the muddy waters:
http://lkml.org/lkml/2005/7/7/326
I still haven't had time to come up with and perform any decent performance comparison, so for now I'll take Andrew Morton's word for it...
This is a question that comes up on a fairly regular basis on IRC chatrooms, mailing lists, etc. which has widely varying answers depending on the source.
While updating our courseware a few days back, I decided to start digging into the issue and found a couple of very interesting reads.
The most common claim is that a swap partition is faster than a swap
file because in older versions of the Linux kernel experienced some filesystem overhead when accessing the swap file.
Ever since the release of 2.5.23 of the Linux kernel, however, this is no longer the case.
http://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.23
(search for the line: "[PATCH] direct-to-BIO I/O for swapcache pages")
In case the highly-technical explanation of how swap files are now handled is less-than-enlightening, perhaps a description from number two Linux kernel developer himself (Andrew Morton) can help clear the muddy waters:
http://lkml.org/lkml/2005/7/7/326
I still haven't had time to come up with and perform any decent performance comparison, so for now I'll take Andrew Morton's word for it...
