zfs/lib/libzfs
Christian Schwarz 63f8a472af Shared L2ARC - Proof of Concept
(I will give a talk on this PoC at the OpenZFS Developer Summit 2022.)

The ARC dynamically shares DRAM capacity among all currently imported zpools.
However, the L2ARC does not do the same for block capacity: the L2ARC vdevs of
one zpool only cache buffers of that zpool. This can be undesirable on systems
that host multiple zpools because it inhibits dynamic sharing of the cache
device capacity which is desirable if the need for L2ARC varies among zpools
over time, or if the set of zpools that are imported in the system varies over
time.

Shared L2ARC addresses this need by decoupling the L2ARC vdevs from the
zpools that store actual data. The mechanism that we use is to place the L2ARC
vdevs into a special zpool, and to adjust the L2ARC feed thread logic to use
that special zpool's L2ARC vdevs for all zpools' buffers.

High-level changes:

* Reserve "NTNX-fsvm-local-l2arc" as a magic zpool name.
  We call this "the l2arc pool".
  All other pools are called "primary pools".
* Make l2arc feed thread feed ARC buffers from any zpool to the l2arc zpool.
  (Before this patch, the l2arc feed thread would only feed ARC buffers to
  l2arc devices if they are for the same spa_t).
* Change the locking to ensure that the l2arc zpool cannot be removed while
  there are ongoing reads initiated by arc_read on one of the primary pools.

This is sufficient and retains correctness of the ARC because nothing
about the fundamental operation of L2ARC changes. The only thing that changes
is that the L2ARC data is stored on vdevs outside the primary pool.

Proof Of Concept => Production
==============================

This commit is a proof-of-concept.
It works, it results in the desired performance improvement, and it's stable.
But to make it production ready, more work needs to be done.

(1) The design is based on a version of ZFS that does not support
encryption nor Persisent L2ARC. I'm no expert in either of these features.
Encryption might work just fine as long as the l2arc feed thread can access
the encryption keys for l2arc_apply_transforms.
But Persistent L2ARC definitely needs more design work
(multiple L2ARC headers?).

(2) Remove hard-coded magic name; use a property instead.
Make it opt-in so that existing setups are not affected.
Example:
  zpool create -o share_l2arc_vdevs=on my-l2arc-pool

(3) Coexistence with non-shared L2ARC; also via property.
Make it opt-in so that existing setups are not affected.
Example:
  zpool set use_shared_l2arc=on my-data-pool

Signed-off-by: Christian Schwarz <christian.schwarz@nutanix.com>
2022-10-20 11:31:59 +00:00
..
os Fix unsafe string operations 2022-09-27 16:47:24 -07:00
.gitignore Clean up lib dependencies 2020-07-10 14:26:00 -07:00
Makefile.am Replace EXTRA_DIST with dist_noinst_DATA 2022-05-26 09:24:50 -07:00
THIRDPARTYLICENSE.openssl Fix typos in lib/ 2019-09-02 17:53:27 -07:00
THIRDPARTYLICENSE.openssl.descrip Encryption patch follow-up 2017-10-11 16:54:48 -04:00
libzfs.abi Add membar_sync abi change 2022-10-04 09:54:58 -07:00
libzfs.pc.in Spruce up pkg-config files for libzfs/libzfs_core 2020-09-04 11:11:18 -07:00
libzfs.suppr Library ABI tracking with abigail 2020-11-17 09:18:52 -08:00
libzfs_changelist.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_config.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_crypto.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
libzfs_dataset.c Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
libzfs_diff.c Cleanup: Switch to strlcpy from strncpy 2022-09-27 16:35:29 -07:00
libzfs_impl.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_import.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_iter.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_mount.c Make zfs-share service resilient to stale exports 2022-09-09 10:54:16 -07:00
libzfs_pool.c Shared L2ARC - Proof of Concept 2022-10-20 11:31:59 +00:00
libzfs_sendrecv.c Handle possible null pointers from malloc/strdup/strndup() 2022-10-06 17:18:40 -07:00
libzfs_status.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_util.c Enforce "-F" flag on resuming recv of full/newfs on existing dataset 2022-09-27 16:34:27 -07:00