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

crl-release-20.1: vfs: Add vfs.Prefetch, use it for reading ahead data blocks #733

Merged

Conversation

itsbilal
Copy link
Member

For sequential-like IO workload where we read
data blocks one after the other in quick succession,
signalling the OS to asynchronously bring them to
cache in advance can deliver significant savings in IOPS
dispatched. In IOPS-bound workloads such as backup on
an EBS disk, this delivers a 3x speedup. Presumably
aggregate queries and compactions will be faster
as well, though this hasn't been benchmarked in
practice yet.

This change maintains a counter for the number of data
block reads performed in a singleLevelIterator, and
when that count exceeds 2, a readahead system
call is made on Linux. RocksDB has almost
the exact same behaviour, including the same
min/max readahead sizes and read count thresholds.

Will address cockroachdb/cockroach#49710
when it lands in cockraoch.

For sequential-like IO workload where we read
data blocks one after the other in quick succession,
signalling the OS to asynchronously bring them to
cache in advance can deliver significant savings in IOPS
dispatched. In IOPS-bound workloads such as backup on
an EBS disk, this delivers a 3x speedup. Presumably
aggregate queries and compactions will be faster
as well, though this hasn't been benchmarked in
practice yet.

This change maintains a counter for the number of data
block reads performed in a singleLevelIterator, and
when that count exceeds 2, a readahead system
call is made on Linux. RocksDB has almost
the exact same behaviour, including the same
min/max readahead sizes and read count thresholds.

Will address cockroachdb/cockroach#49710
when it lands in cockraoch.
@itsbilal itsbilal self-assigned this Jun 10, 2020
@petermattis
Copy link
Collaborator

This change is Reviewable

Copy link
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for these manual backports, it is still nice for the PR title to be prefixed with release-20.1: as it reduces confusion.

LGTM

@itsbilal
Copy link
Member Author

Ah right. I usually do that, but I forgot this time and ended up confusing myself as well. Thanks for the reminder!

@itsbilal itsbilal changed the title vfs: Add vfs.Prefetch, use it for reading ahead data blocks crl-release-20.1: vfs: Add vfs.Prefetch, use it for reading ahead data blocks Jun 10, 2020
@itsbilal itsbilal merged commit 7928b15 into cockroachdb:crl-release-20.1 Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants