-
Notifications
You must be signed in to change notification settings - Fork 303
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
Adds bench for scan_pubkeys() #2095
Adds bench for scan_pubkeys() #2095
Conversation
6d05c36
to
7395541
Compare
7395541
to
e6ae343
Compare
Nice! |
Yep 😥
Yes. I'll do this in a follow up PR. |
I'm having second thoughts on this now. In order to make a benchmark for the different buffer sizes, there are a number of internals we need to split out and make public for the bench. I'm not sure that's really worth it. Instead, we can do our normal A/B testing with performance numbers in PRs to justify changes to the buffer sizes. With that said, I did write the benchmark to see how it would look, and here are the results: benchmark results
These are the results on a dev box, with just the File IO numbers. I benchmarked the following buffer sizes:
Probably the most useful results are with 1,000 and 10,000 accounts in the file, as that's most similar to mnb. We see with these tests that the smaller buffers all perform better than the larger buffers. Even though 4 KiB is the fastest in the benchmark, I'm not sure how this would fare in a real validator running on mnb. Maybe 64 KiB is the right tradeoff? When I made the buffer size 256 KiB in the previous PR, I only tests 256 KiB, 512 KiB, and ~30 MiB. So it makes sense I saw the fastest times with 256 KiB. |
Agree. No need to commit to the changes for support varing buffer size to master. It is fine to keep them separately in the experimental branch. |
103.76 µs (4k) vs 220.00 µs (64K) almost 2x. Yes. The number should be highly dependent on the account's sizes. I am okay with 64KiB. Maybe we can take some sample storage files from mainnet and benchmark on those storages... |
Problem
There are no benchmarks for how fast/slow the append vec file io is compared to mmap.
Summary of Changes
Add a benchmark for
scan_pubkeys()
.We recently pushed a change to optimize this function for file io, but it was not straightforward to know how large the scan buffer should be. This benchmark was used to inform the buffer size.
Example benchmark results
Running the benchmark on a shared dev box, I saw these results from a run: