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: omit MVCCIterator.Stats() call during MVCCScan/MVCCGet #86084

Merged
merged 1 commit into from
Aug 13, 2022

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Aug 13, 2022

MVCCScan and MVCCGet attach iterator statistics to an active trace.
However, they would fetch the iterator statistics even if no trace was
active, which has a significant cost. This patch avoids fetching the
stats when there is no active trace.

name                                                                 old time/op    new time/op    delta
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24     3.59µs ± 0%    3.34µs ± 0%  -7.02%  (p=0.000 n=10+8)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24     7.43µs ± 1%    7.01µs ± 0%  -5.70%  (p=0.000 n=10+9)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24    4.62µs ± 1%    4.36µs ± 1%  -5.53%  (p=0.000 n=10+10)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24    10.4µs ± 1%    10.0µs ± 1%  -3.79%  (p=0.000 n=10+10)

Resolves #86083.
Touches #64503.

Release note: None

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

This change is Reviewable

@erikgrinaker erikgrinaker force-pushed the trace-iterator-stats-opt branch from c62395a to 79aec18 Compare August 13, 2022 15:42
`MVCCScan` and `MVCCGet` attach iterator statistics to an active trace.
However, they would fetch the iterator statistics even if no trace was
active, which has a significant cost. This patch avoids fetching the
stats when there is no active trace.

```
name                                                                 old time/op    new time/op    delta
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24     3.59µs ± 0%    3.34µs ± 0%  -7.02%  (p=0.000 n=10+8)
MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24     7.43µs ± 1%    7.01µs ± 0%  -5.70%  (p=0.000 n=10+9)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24    4.62µs ± 1%    4.36µs ± 1%  -5.53%  (p=0.000 n=10+10)
MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24    10.4µs ± 1%    10.0µs ± 1%  -3.79%  (p=0.000 n=10+10)
```

Release note: None
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 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jbowens)

@erikgrinaker
Copy link
Contributor Author

TFTR!

bors r=nicktrav

@craig
Copy link
Contributor

craig bot commented Aug 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 13, 2022

Build succeeded:

@craig craig bot merged commit dff8a8b into cockroachdb:master Aug 13, 2022
@blathers-crl
Copy link

blathers-crl bot commented Aug 13, 2022

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from c739468 to blathers/backport-release-21.2-86084: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


error creating merge commit from c739468 to blathers/backport-release-22.1-86084: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

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.

storage: MVCCGet showing significant MVCCIterator.Stats() CPU time
3 participants