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

storage: use RangeKeyChanged() in pebbleMVCCScanner #86110

Merged
merged 1 commit into from
Aug 14, 2022

Conversation

erikgrinaker
Copy link
Contributor

This patch uses RangeKeyChanged() in pebbleMVCCScanner to detect
MVCC range keys and enable point key synthesis. This shows a ~5% speedup
for large scans with no range keys, but a minor regression for point
gets with range keys -- the latter caused by having to call both
HasPointAndRange() and RangeKeyChanged(), while previously only the
first was called.

name                                                                  old time/op    new time/op    delta
MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=0-24        5.62µs ± 2%    5.68µs ± 1%    ~     (p=0.058 n=10+8)
MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=1-24        12.2µs ± 3%    12.3µs ± 1%    ~     (p=0.113 n=10+9)
MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=0-24      38.9µs ± 1%    38.5µs ± 1%  -0.78%  (p=0.019 n=9+9)
MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=1-24      72.1µs ± 2%    72.7µs ± 2%  +0.83%  (p=0.043 n=10+10)
MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=0-24    2.85ms ± 1%    2.72ms ± 1%  -4.63%  (p=0.000 n=9+10)
MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=1-24    5.46ms ± 1%    5.48ms ± 1%    ~     (p=0.065 n=9+10)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24      3.34µs ± 1%    3.33µs ± 2%    ~     (p=0.591 n=10+10)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24      6.84µs ± 2%    7.00µs ± 1%  +2.35%  (p=0.000 n=10+8)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24     4.31µs ± 3%    4.28µs ± 2%    ~     (p=0.225 n=10+10)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24     9.56µs ± 2%    9.83µs ± 3%  +2.82%  (p=0.000 n=10+10)

Touches #82559.

Release note: None

@erikgrinaker erikgrinaker self-assigned this Aug 14, 2022
@erikgrinaker erikgrinaker requested a review from a team as a code owner August 14, 2022 19:11
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jbowens)

@erikgrinaker
Copy link
Contributor Author

bors r=nicktrav

This patch uses `RangeKeyChanged()` in `pebbleMVCCScanner` to detect
MVCC range keys and enable point key synthesis. This shows a ~5% speedup
for large scans with no range keys, but a minor regression for point
gets with range keys -- the latter caused by having to call both
`HasPointAndRange()` and `RangeKeyChanged()`, while previously only the
first was called.

```
name                                                                  old time/op    new time/op    delta
MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=0-24        5.62µs ± 2%    5.68µs ± 1%    ~     (p=0.058 n=10+8)
MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=1-24        12.2µs ± 3%    12.3µs ± 1%    ~     (p=0.113 n=10+9)
MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=0-24      38.9µs ± 1%    38.5µs ± 1%  -0.78%  (p=0.019 n=9+9)
MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=1-24      72.1µs ± 2%    72.7µs ± 2%  +0.83%  (p=0.043 n=10+10)
MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=0-24    2.85ms ± 1%    2.72ms ± 1%  -4.63%  (p=0.000 n=9+10)
MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=1-24    5.46ms ± 1%    5.48ms ± 1%    ~     (p=0.065 n=9+10)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24      3.34µs ± 1%    3.33µs ± 2%    ~     (p=0.591 n=10+10)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24      6.84µs ± 2%    7.00µs ± 1%  +2.35%  (p=0.000 n=10+8)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24     4.31µs ± 3%    4.28µs ± 2%    ~     (p=0.225 n=10+10)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24     9.56µs ± 2%    9.83µs ± 3%  +2.82%  (p=0.000 n=10+10)
```

Release note: None
@craig
Copy link
Contributor

craig bot commented Aug 14, 2022

Canceled.

@erikgrinaker
Copy link
Contributor Author

bors r=nicktrav

@craig
Copy link
Contributor

craig bot commented Aug 14, 2022

Build succeeded:

@craig craig bot merged commit ec5847d into cockroachdb:master Aug 14, 2022
@erikgrinaker erikgrinaker deleted the mvcc-scan-rangekeychanged branch August 16, 2022 08:25
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.

3 participants