Rich Freeman on 11 Apr 2013 16:19:31 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] RAID for swap?


On Thu, Apr 11, 2013 at 6:57 PM, Walt Mankowski <waltman@pobox.com> wrote:
> First of all, let me say that I've never used RAID or LVM except as a
> user, and I've never encrypted my swap partition.  I have, however,
> used both swap files and I've found them to be a lot more flexible
> than swap partitions.  I'm curious why you're concerned about the
> performance hit for swap files vs partitions, but you're not worried
> about the performance hit for encrypting your entire swap partition.
> I'd think the encryption would be slower.  I'd also expect that the
> physical disk access would be so much slower than either that you'd
> barely notice the effect of either.

Well, I'd have thought that other things like journaling/etc would
still have hit.  However, it turns out that recent kernels just locate
the blocks on the disk and just treat it the same as a swap partition
anyway, so there is no real cost to a swap file.  I'm not sure if that
holds true for swap on btrfs/ZFS - normally those filesystems never
overwrite files in place and it sounds like the swap file mechanism is
designed to do that.

The one big caveat is that you don't want your file to be fragmented.
So, allocate it all at once, and make sure you don't do it by writing
zeros unless you have sparse files disabled.  Writing to any
fragmented file incurs a performance hit (especially if it is on top
of striped RAID and the fragments are on many stripes -
read/write/read on every modification).

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug