From 11f4ac9ea772925a573013020b05f130a644b95b Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Wed, 25 May 2016 21:05:00 -0500 Subject: [PATCH] FAQ: Update swap recommendation We can use getconf PAGESIZE so the block size is correct on all architectures. We want primarycache=metadata so that swap data is not held in RAM. We want logbias=throughput, according to ryao, to speed eviction. --- FAQ.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/FAQ.md b/FAQ.md index af035c4..1054167 100644 --- a/FAQ.md +++ b/FAQ.md @@ -235,14 +235,16 @@ $ zpool add -o ashift=12 tank mirror sdc sdd You may use a zvol as a swap device but you'll need to configure it appropriately. -* Set the volume block size to match your systems page size, for x86_64 systems that is 4k. This tuning prevents ZFS from having to perform read-modify-write options on a larger block while the system is already low on memory. -* Set the `sync=always` property. Data written to the volume will be flushed immediately to disk freeing up memory as quickly as possible. +* Set the volume block size to match your systems page size. This tuning prevents ZFS from having to perform read-modify-write options on a larger block while the system is already low on memory. +* Set the `logbias=throughput` and `sync=always` properties. Data written to the volume will be flushed immediately to disk freeing up memory as quickly as possible. +* Set `primarycache=metadata` to avoid keeping swap data in RAM via the ARC. * Disable automatic snapshots of the swap device. ``` -$ zfs create -V 4G -b 4K rpool/swap -$ zfs set com.sun:auto-snapshot=false rpool/swap -$ zfs set sync=always rpool/swap +$ zfs create -V 4G -b $(getconf PAGESIZE) \ + -o logbias=throughput -o sync=always \ + -o primarycache=metadata \ + -o com.sun:auto-snapshot=false rpool/swap ``` ### Using ZFS on Xen Hypervisor or Xen Dom0