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.
Richard Laager 2016-05-25 21:05:00 -05:00
parent 52151325a4
commit 11f4ac9ea7
1 changed files with 7 additions and 5 deletions

12
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