zfs/lib
ednadolski-ix 3bd4df3841
Improve ZFS objset sync parallelism
As part of transaction group commit, dsl_pool_sync() sequentially calls
dsl_dataset_sync() for each dirty dataset, which subsequently calls
dmu_objset_sync().  dmu_objset_sync() in turn uses up to 75% of CPU
cores to run sync_dnodes_task() in taskq threads to sync the dirty
dnodes (files).

There are two problems:

1. Each ZVOL in a pool is a separate dataset/objset having a single
   dnode.  This means the objsets are synchronized serially, which
   leads to a bottleneck of ~330K blocks written per second per pool.

2. In the case of multiple dirty dnodes/files on a dataset/objset on a
   big system they will be sync'd in parallel taskq threads. However,
   it is inefficient to to use 75% of CPU cores of a big system to do
   that, because of (a) bottlenecks on a single write issue taskq, and
   (b) allocation throttling.  In addition, if not for the allocation
   throttling sorting write requests by bookmarks (logical address),
   writes for different files may reach space allocators interleaved,
   leading to unwanted fragmentation.

The solution to both problems is to always sync no more and (if
possible) no fewer dnodes at the same time than there are allocators
the pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15197
2023-11-06 10:38:42 -08:00
..
libavl cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libefi Fix multiplication converted to larger type 2022-10-28 09:30:37 -07:00
libicp Add generic implementation handling and SHA2 impl 2023-03-02 13:52:21 -08:00
libnvpair nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libshare Fix nfs_truncate_shares without /etc/exports.d 2023-10-31 13:57:54 -07:00
libspl Add VERIFY0P() and ASSERT0P() macros. 2023-09-19 17:21:55 -07:00
libtpool Add <limits.h> header 2022-11-28 13:24:17 -08:00
libunicode cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libuutil ABI files: sync with new Ubuntu release in CI 2023-03-10 16:23:01 -08:00
libzfs zvol: Implement zvol threading as a Property 2023-10-31 09:50:32 -07:00
libzfs_core Fix occasional rsend test crashes 2023-09-20 16:39:38 -07:00
libzfsbootenv nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libzpool Improve ZFS objset sync parallelism 2023-11-06 10:38:42 -08:00
libzstd cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libzutil Fix ZED auto-replace for VDEVs using by-id paths 2023-10-20 09:29:02 -07:00
Makefile.am autoconf: use include directives instead of recursing down lib 2022-05-10 10:18:11 -07:00