Questions re swap-on-zfs

Adam Vande More amvandemore at gmail.com
Thu Dec 5 02:31:32 UTC 2013


On Tue, Dec 3, 2013 at 1:58 AM, <Ivailo.TANUSHEFF at raiffeisen.bg> wrote:

> Hello there :)
>
> I had similar issues with a test box (FreeBSD 9.1) I used few months ago
> with not so much free RAM - the box had 1-3GB total RAM as far as I
> remember.
> After digging I have found that the problem was actually a swap deadlock
> :)
> What I mean: when you heavily utilize the system, for example building
> ports or something, the system tries to swap some memory, used by the ZFS.
> The problem is, that the swap is actually on the ZFS itself and uses the
> same memory.
> I am not sure I describe this precisely, but the overall result is that
> the system uses more and more swap space just to be able to swap something
> relatively small. It ends up crashing the system several times


Well yes.  When you put swap on ZFS under duress they are in contention for
the same memory reserves.  Since ZFS consumes memory thinking the kernel
should be holding back whatever is needed for swap and swap thinks it's the
last defense and guarded, you will run into problems using swap-on-ZFS.  To
put it in terms of a famous quote:  I am not able rightly to apprehend the
kind of confusion of ideas that could provoke such a question.

Such an issue can be programmed around, but you're still left with an
abundance of memory contention issues.  I suppose this is why Oracle and
other ZFS devs have left this as 'unsupported'.

A filesystem backed swap device is rarely a good idea.

-- 
Adam


More information about the freebsd-fs mailing list