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
Improve Iterator Performance of Seeking with Prefix #1719
base: master
Are you sure you want to change the base?
Improve Iterator Performance of Seeking with Prefix #1719
Conversation
@jarifibrahim Would you please review this pr? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @NamanJain8 @ahsanbarkati should also review.
Thanks, @zzyalbert for raising the PR. I would need to verify though but I think that this would not work. It would be good if we could verify a few test cases like: |
Theoretically, both |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue was marked as stale and no activity has occurred since then, therefore it will now be closed. Please, reopen if the issue is still relevant. |
Hi @AlexMackowiak , the change looks great to me as far as correctness is concerned. Also, it would be useful for the case where the iterations are made upon the prefixes that have no keys. Thanks for the PR. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do some benchmarks here? One, where all the keys are present -- so we can see what overhead does this code bring. And 2. When the prefix is absent, so we can understand what gains we achieve?
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @jarifibrahim)
@zzyalbert / @AlexMackowiak, can you please add benchmarks for this? If that looks promising, then we can proceed further on the basis of them. I am happy to provide any help that you need to do that. |
@NamanJain8 Sorry for the delay, I had some pre-existing benchmark tests for the key-value store my company is building on top of badger. Running these against the two different implementations seems to look promising, especially for reading from large ranges with pagination. I have attached the raw benchmarking data below, let me know if you need anything else! |
@NamanJain8 Any update on merging here? Or even like a config option for this behavior? The benchmarks I took show that this change would be quite beneficial at least for my company's use case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Lol wrong page was open. But yes, this PR also lgtm.
Signed-off-by: thomassong <thomassong2012@gmail.com>
2ee9c97
to
2ec98c3
Compare
Signed-off-by: thomassong <thomassong2012@gmail.com>
When I was trying to change the db engine to badgerdb in some of my projects, I found the iterator Seek with prefix was pretty slow in the following situation:
Then I use
pprof
to found out the iterator was still runningparseItem
even if the current key was not match the prefix.So I fix this by skipping the
parseItem
process when the current key is not match the prefix.This change is