meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:fs:zfs:tuning [2025/03/04 15:25] – niziak | linux:fs:zfs:tuning [2026/03/20 07:51] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== ZFS performance tuning tips ====== | ====== ZFS performance tuning tips ====== | ||
| + | |||
| + | Copy-paste snippet: | ||
| + | <code bash> | ||
| + | zfs set recordsize=1M rpool | ||
| + | zfs set recordsize=16M hddpool | ||
| + | zfs set recordsize=1M nvmpool | ||
| + | zfs set compression=zstd rpool | ||
| + | zfs set compression=zstd hddpool | ||
| + | zfs set compression=zstd nvmpool | ||
| + | </ | ||
| + | |||
| + | **Note:** '' | ||
| + | See more in [[linux: | ||
| + | |||
| ===== zil limit ===== | ===== zil limit ===== | ||
| ZFS parameter [[https:// | ZFS parameter [[https:// | ||
| + | |||
| + | <file ini / | ||
| + | options zfs zil_slog_bulk=67108864 | ||
| + | options zfs l2arc_write_max=67108864 | ||
| + | </ | ||
| See similar for L2ARC: [[https:// | See similar for L2ARC: [[https:// | ||
| Line 33: | Line 52: | ||
| * less metadata | * less metadata | ||
| * less fragmentation | * less fragmentation | ||
| - | * zvol: huge overhead if guest is using small block sizes | + | * zvol: huge overhead if guest is using small block sizes - try to match guest FS block size to volblock - do not set 4kB volblock size ! |
| Note: '' | Note: '' | ||
| Line 49: | Line 68: | ||
| </ | </ | ||
| + | |||
| ===== zvol for guest ===== | ===== zvol for guest ===== | ||
| Line 54: | Line 74: | ||
| * do not use guest CoW filesystem on CoW (ZFS) | * do not use guest CoW filesystem on CoW (ZFS) | ||
| * do not use qcow2 files on ZFS | * do not use qcow2 files on ZFS | ||
| + | * use 2 zvols per guest FS - one for storage and second one for journal | ||
| ===== Tune L2ARC for backups ===== | ===== Tune L2ARC for backups ===== | ||
| Line 70: | Line 91: | ||
| * [[https:// | * [[https:// | ||
| - | ===== I/O scheduler ===== | ||
| - | If whole device is managed by ZFS (not partition), ZFS sets scheduler to '' | ||
| - | ==== official recommendation ==== | ||
| - | For rotational devices, there is no sense to use advanced schedulers '' | ||
| - | |||
| - | Only possible scheduler to consider is '' | ||
| - | |||
| - | There is a discussion on OpenZFS project to do not touch schedulers anymore and let it to be configured by admin: | ||
| - | |||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ==== my findings ==== | ||
| - | |||
| - | There is huge benefit to use '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | * kernel '' | ||
| - | * kvm processes have prio '' | ||
| - | * kvm process during vzdump have '' | ||
| - | |||
| - | ===== HDD ===== | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | <code bash> | ||
| - | cat / | ||
| - | echo 2 > / | ||
| - | cat / | ||
| - | |||
| - | |||
| - | </ | ||
| - | |||
| - | Use huge record size - it can help on SMR drives. Note: it only make sense for ZFS file system. Cannot be applied on ZVOL. | ||
| - | |||
| - | <code bash> | ||
| - | zfs set recordsize=1M hddpool/ | ||
| - | zfs set recordsize=1M hddpool/vz | ||
| - | |||
| - | |||
| - | </ | ||
| - | |||
| - | NOTE: SMR drives behaves correctly for sequential writes, but long working ZFS or LVM thin spread writes into lots of random location causing unusable IOPS. So never use SMR. | ||
| - | |||
| - | For ZVOLs: [[https:// | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | **Note: | ||
| - | |||
| - | **Note: | ||
| - | < | ||
| - | |||
| - | Warning: volblocksize (8192) is less than the default minimum block size (16384). | ||
| - | To reduce wasted space a volblocksize of 16384 is recommended. | ||
| - | |||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | zfs create -s -V 40G hddpool/ | ||
| - | dd if=/ | ||
| - | zfs rename hddpool/ | ||
| - | zfs rename hddpool/ | ||
| - | |||
| - | |||
| - | </ | ||
| - | |||
| - | Use '' | ||
| ===== Postgresql ===== | ===== Postgresql ===== | ||
| Line 163: | Line 115: | ||
| # apt install zfsutils-linux | # apt install zfsutils-linux | ||
| - | # arcstat | + | # zarcstat |
| time read miss miss% dmis dm% pmis pm% mmis mm% size | time read miss miss% dmis dm% pmis pm% mmis mm% size | ||
| 16: | 16: | ||
| - | |||
| - | |||
| </ | </ | ||
| <code bash> | <code bash> | ||
| - | # arc_summary | + | # zarcsummary -s arc |
| ARC size (current): | ARC size (current): | ||
| Line 183: | Line 133: | ||
| Dnode cache size (hard limit): | Dnode cache size (hard limit): | ||
| Dnode cache size (current): | Dnode cache size (current): | ||
| - | |||
| - | |||
| </ | </ | ||
| Line 191: | Line 139: | ||
| * '' | * '' | ||
| * '' | * '' | ||
| - | * '' | + | * '' |
| Proxmox recommends following [[https:// | Proxmox recommends following [[https:// | ||
| < | < | ||
| Line 206: | Line 155: | ||
| echo "$[4 * 1024*1024*1024]" | echo "$[4 * 1024*1024*1024]" | ||
| echo " | echo " | ||
| - | |||
| - | |||
| </ | </ | ||
| Line 217: | Line 164: | ||
| options zfs zfs_arc_min=134217728 | options zfs zfs_arc_min=134217728 | ||
| options zfs zfs_arc_meta_limit_percent=75 | options zfs zfs_arc_meta_limit_percent=75 | ||
| - | |||
| - | |||
| </ | </ | ||