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 14:54] – niziak | linux:fs:zfs:tuning [2025/08/23 08:45] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== ZFS performance tuning tips ====== | ====== ZFS performance tuning tips ====== | ||
| + | |||
| + | Copy-paste snippet: | ||
| + | <code bash> | ||
| + | zfs set recordsize=1M hddpool | ||
| + | zfs set recordsize=1M nvmpool | ||
| + | zfs set compression=zstd hddpool | ||
| + | zfs set compression=zstd nvmpool | ||
| + | </ | ||
| ===== 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 46: | ||
| * less metadata | * less metadata | ||
| * less fragmentation | * less fragmentation | ||
| + | * 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 40: | Line 54: | ||
| * 16kB for MySQL/ | * 16kB for MySQL/ | ||
| * 128kB for rotational HDDs | * 128kB for rotational HDDs | ||
| + | |||
| + | Check real usage by histogram: | ||
| + | |||
| + | <code bash> | ||
| + | zpool iostat -r | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | ===== zvol for guest ===== | ||
| + | |||
| + | * match volblock size to guest block size | ||
| + | * do not use guest CoW filesystem on CoW (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 47: | Line 76: | ||
| <file conf / | <file conf / | ||
| options zfs l2arc_mfuonly=1 l2arc_noprefetch=0 | options zfs l2arc_mfuonly=1 l2arc_noprefetch=0 | ||
| + | |||
| </ | </ | ||
| Line 88: | Line 118: | ||
| echo 2 > / | echo 2 > / | ||
| cat / | cat / | ||
| + | |||
| </ | </ | ||
| Line 96: | Line 127: | ||
| zfs set recordsize=1M hddpool/ | zfs set recordsize=1M hddpool/ | ||
| zfs set recordsize=1M hddpool/vz | zfs set recordsize=1M hddpool/vz | ||
| + | |||
| </ | </ | ||
| Line 120: | Line 152: | ||
| zfs rename hddpool/ | zfs rename hddpool/ | ||
| zfs rename hddpool/ | zfs rename hddpool/ | ||
| + | |||
| </ | </ | ||
| Line 134: | Line 167: | ||
| # ONLY for SSD/NVM devices: | # ONLY for SSD/NVM devices: | ||
| zfs set logbias=throughput < | zfs set logbias=throughput < | ||
| + | |||
| </ | </ | ||
| Line 147: | Line 181: | ||
| time read miss miss% dmis dm% pmis pm% mmis mm% size | time read miss miss% dmis dm% pmis pm% mmis mm% size | ||
| 16: | 16: | ||
| + | |||
| </ | </ | ||
| Line 163: | Line 198: | ||
| Dnode cache size (hard limit): | Dnode cache size (hard limit): | ||
| Dnode cache size (current): | Dnode cache size (current): | ||
| + | |||
| </ | </ | ||
| Line 185: | Line 221: | ||
| echo "$[4 * 1024*1024*1024]" | echo "$[4 * 1024*1024*1024]" | ||
| echo " | echo " | ||
| + | |||
| </ | </ | ||
| Line 190: | Line 227: | ||
| Make options persistent: | Make options persistent: | ||
| - | < | + | <code etcmodprobedzfsconf> |
| options zfs zfs_prefetch_disable=1 | options zfs zfs_prefetch_disable=1 | ||
| options zfs zfs_arc_max=4294967296 | options zfs zfs_arc_max=4294967296 | ||
| 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 | ||
| + | |||
| </ | </ | ||