Reviewed by: Prakash Surya <prakash.su...@delphix.com>
Reviewed by: George Wilson <george.wil...@delphix.com>

This project's goal is to make read-heavy channel programs and zfs(1m)
administrative commands faster by caching all the metadata that they will
need in the dbuf layer. This will prevent the data from being evicted, so
that any future call to i.e. zfs get all won't have to go to disk (very
much). There are two parts:

The dbuf_metadata_cache. We identify what to put into the cache based on
the object type of each dbuf.  Caching objset properties os
{version,normalization,utf8only,casesensitivity} in the objset_t. The reason
these needed to be cached is that although they are queried frequently,
they aren't stored in a dbuf type which we can easily recognize and cache in
the dbuf layer; instead, we have to explicitly store them. There's already
existing infrastructure for maintaining cached properties in the objset
setup code, so I simply used that.

Testing performance
Setup:
Disabled kmem_flags
Tuned dbuf_cache_max_bytes very low (128K)
Tuned zfs_arc_max very low (64M)
Created test pool with 400 filesystems, and 100 snapshots per filesystem.
Later on in testing, added 600 more filesystems (with no snapshots) to make
sure scaling didn't look different between snapshots and filesystems.

Results:

| Test                           | Time (trunk / diff) | I/Os (trunk / diff) |
+--------------------------------+---------------------+---------------------+
| zpool import                   |     0:05 / 0:06     |    12.9k / 12.9k    |
| zfs get all (uncached)         |     1:36 / 0:53     |    16.7k / 5.7k     |
| zfs get all (cached)           |     1:36 / 0:51     |    16.0k / 6.0k     |

Most cases are faster, and we do a reasonable amount less I/O in every case 
(except for zpool import where we weren't expecting an improvement). Great :)

Upstream bug: DLPX-28586

Reviewed at: http://reviews.delphix.com/r/34845/
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/599

-- Commit Summary --

  * 9337 zfs get all is slow due to uncached metadata

-- File Changes --

    M usr/src/uts/common/fs/zfs/dbuf.c (182)
    M usr/src/uts/common/fs/zfs/dmu.c (108)
    M usr/src/uts/common/fs/zfs/dmu_objset.c (8)
    M usr/src/uts/common/fs/zfs/sys/dbuf.h (14)
    M usr/src/uts/common/fs/zfs/sys/dmu.h (7)
    M usr/src/uts/common/fs/zfs/sys/dmu_objset.h (12)
    M usr/src/uts/common/fs/zfs/zfs_vfsops.c (52)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/599.patch
https://github.com/openzfs/openzfs/pull/599.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/599

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/discussions/T644dae5d5a17704c-Mf5be77bc517e7b5e42c4dfdc
Delivery options: https://openzfs.topicbox.com/groups

Reply via email to