Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illumos 6322 ZFS indirect block predictive prefetch #5040

Conversation

kernelOfTruth
Copy link
Contributor

For quite some time I was thinking about possibility to prefetch ZFS indirection tables while doing sequential reads or writes. Recent changes in predictive prefetcher made that much easier to do. My
tests on zvol with 16KB block size on 5x striped and 2x mirrored pool of 10 disks show almost double throughput on sequential read, and almost tripple on sequential rewrite. While for read alike effect
can be received from increasing maximal prefetch distance (though at higher memory cost), for rewrite there is no other solution so far.

Porting notes:
Change from upstream in module/zfs/dbuf.c in 'int dbuf_read' due to commit 'Handle block pointers with a corrupt logical size'
5f6d0b6

difference from upstream in module/zfs/dmu_zfetch.c , uint32_t zfetch_max_idistance -> unsigned int zfetch_max_idistance

Variables have been initialized at the beginning of the function (void dmu_zfetch) to resemble the order of occurence and account for C99, C11 mode errors.

Authored by: Alexander Motin [email protected]
Reviewed by: Matthew Ahrens [email protected]
Reviewed by: Paul Dagnelie [email protected]
Approved by: Robert Mustacchi [email protected]
Ported-by: kernelOfTruth [email protected]
OpenZFS-issue: https://www.illumos.org/issues/6322
OpenZFS-commit: illumos/illumos-gate@cb92f41

For quite some time I was thinking about possibility to prefetch ZFS indirection tables while doing sequential reads or writes. Recent changes in predictive prefetcher made that much easier to do. My
tests on zvol with 16KB block size on 5x striped and 2x mirrored pool of 10 disks show almost double throughput on sequential read, and almost tripple on sequential rewrite. While for read alike effect
can be received from increasing maximal prefetch distance (though at higher memory cost), for rewrite there is no other solution so far.

Porting notes:
Change from upstream in module/zfs/dbuf.c in 'int dbuf_read' due to commit 'Handle block pointers with a corrupt logical size'
openzfs@5f6d0b6

difference from upstream in module/zfs/dmu_zfetch.c , uint32_t zfetch_max_idistance -> unsigned int zfetch_max_idistance

Variables have been initialized at the beginning of the function (void dmu_zfetch) to resemble the order of occurence and account for C99, C11 mode errors.

Authored by: Alexander Motin <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Ported-by: kernelOfTruth [email protected]
OpenZFS-issue: https://www.illumos.org/issues/6322
OpenZFS-commit: illumos/illumos-gate@cb92f41
@kernelOfTruth
Copy link
Contributor Author

kernelOfTruth commented Aug 29, 2016

instead of

        zstream_t *zs;
    int64_t pf_start, ipf_start, ipf_istart, ipf_iend;
    int64_t pf_ahead_blks, max_blks, iblk;
    int epbs, max_dist_blks, pf_nblks, ipf_nblks, i;
    uint64_t end_of_access_blkid;
    end_of_access_blkid = blkid + nblks;

the following can also be used (the compiler did not complain), to show that iblk appears later

    zstream_t *zs;
    int64_t pf_start, ipf_start, ipf_istart, ipf_iend;
    int64_t pf_ahead_blks, max_blks;
    int epbs, max_dist_blks, pf_nblks, ipf_nblks, i;
    uint64_t end_of_access_blkid;
    int64_t iblk;
    end_of_access_blkid = blkid + nblks;

@kernelOfTruth
Copy link
Contributor Author

http://build.zfsonlinux.org/builders/CentOS%207.1%20x86_64%20%28TEST%29/builds/2272/steps/shell_11/logs/stdio

Test: /usr/share/zfs/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos (run as root) [00:02] [FAIL]
program finished with exit code 1
elapsedTime=4906.119565

http://build.zfsonlinux.org/builders/Debian%208%20x86_64%20%28TEST%29/builds/2205/steps/shell_11/logs/stdio

Test: /usr/share/zfs/zfs-tests/tests/functional/history/history_006_neg (run as root) [00:00] [FAIL]
Test: /usr/share/zfs/zfs-tests/tests/functional/history/history_008_pos (run as root) [00:00] [FAIL]
program finished with exit code 1
elapsedTime=4680.021718

@behlendorf
Copy link
Contributor

Nice, this LGTM. The testing failures are all known unrelated spurious test failures.

@behlendorf behlendorf added this to the 0.7.0 milestone Aug 30, 2016
@behlendorf behlendorf added the Type: Performance Performance improvement or performance problem label Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Performance Performance improvement or performance problem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants