ZFS What value of sync is better for a swap on zvol?

sync=disabled or sync=always; logbias=throughput?
I saw
Fixit# zfs create -V 2G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none zroot/swap
in the freebsd wiki.
https://wiki.freebsd.org/RootOnZFS#ZFS_Swap_Volume
and I also saw $ zfs create -V 4G -b $(getconf PAGESIZE) \
-o logbias=throughput -o sync=always \
-o primarycache=metadata \
-o com.sun:auto-snapshot=false rpool/swap

in the FAQ of openzfsopenzfs, but it's for linux.
https://openzfs.github.io/openzfs-d....html#using-a-zvol-for-a-swap-device-on-linux
 
no log, no sync, no cache, no checksum - if the system is already under memory pressure you just want to get that data on there as fast as possible with the lowest overhead - disks are already abysmally slow compared to RAM.
Yes, also NVMe/PCIe is already an order of magnitude slower, let alone SAS/SATA SSDs or - god beware- spinning rust (just don't use that for swap!)

compression is debateable - on a halfway decent CPU compression usually gives better throughput as those slow disks have to deal with less data. I'd say if this system isn't some glorified doorstopper nicked from a museum junkyard, always use compression
 
Back
Top