From c3db54b66492dd6c7e827c7688b8e50bc186a3c8 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Wed, 22 Feb 2023 11:47:09 +0300 Subject: [PATCH] Workload Tuning: actualize volblocksize It was a little bit obsolete and obscure. Signed-off-by: George Melikov --- .../Workload Tuning.rst | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/Performance and Tuning/Workload Tuning.rst b/docs/Performance and Tuning/Workload Tuning.rst index 3169b85..c44f39e 100644 --- a/docs/Performance and Tuning/Workload Tuning.rst +++ b/docs/Performance and Tuning/Workload Tuning.rst @@ -203,7 +203,7 @@ ZFS datasets use an internal recordsize of 128KB by default. The dataset recordsize is the basic unit of data used for internal copy-on-write on files. Partial record writes require that data be read from either ARC (cheap) or disk (expensive). recordsize can be set to any power of 2 -from 512 bytes to 128 kilobytes. Software that writes in fixed record +from 512 bytes to 1 megabyte. Software that writes in fixed record sizes (e.g. databases) will benefit from the use of a matching recordsize. @@ -233,10 +233,32 @@ must support the large_blocks feature. zvol volblocksize ~~~~~~~~~~~~~~~~~ -Zvols have a volblocksize property that is analogous to record size. The -default size is 8KB, which is the size of a page on the SPARC -architecture. Workloads that use smaller sized IOs (such as swap on x86 -which use 4096-byte pages) will benefit from a smaller volblocksize. +Zvols have a ``volblocksize`` property that is analogous to ``recordsize``. +Current default (16KB since v2.2) balances the metadata overhead, compression +opportunities and decent space efficiency on majority of pool configurations +due to 4KB disk physical block rounding (especially on RAIDZ and DRAID), +while incurring some write amplification on guest FSes that run with smaller +block sizes [#VOLBLOCKSIZE]_. + +Users are advised to test their scenarios and see whether the ``volblocksize`` +needs to be changed to favor one or the other: + +- sector alignment of guest FS is crucial +- most of guest FSes use default block size of 4-8KB, so: + + - Larger ``volblocksize`` can help with mostly sequential workloads and + will gain a compression efficiency + + - Smaller ``volblocksize`` can help with random workloads and minimize + IO amplification, but will use more metadata + (e.g. more small IOs will be generated by ZFS) and may have worse + space efficiency (especially on RAIDZ and DRAID) + + - It's meaningless to set ``volblocksize`` less than guest FS's block size + or :ref:`ashift ` + + - See :ref:`Dataset recordsize ` + for additional information Deduplication ~~~~~~~~~~~~~ @@ -760,3 +782,4 @@ AIO should be used to maximize IOPS when using files for guest storage. .. [#sqlite_ps_change] .. [#FS_CASEFOLD_FL] .. [#init_on_alloc] +.. [#VOLBLOCKSIZE]