-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Performance problem with get_slots_since in high forking #24878
Comments
Looks like we are issuing multiple get operations sequentially in |
Created facebook/rocksdb#9952 that makes the batch-version MultiGet API available in RocksDB's C API. |
The PR for rust-rocksdb: rust-rocksdb/rust-rocksdb#633 |
@yhchiang-sol - While the optimization to use In let frozen_bank_slots: Vec<u64> = frozen_banks
.keys()
.cloned()
.filter(|s| *s >= forks.root())
.collect(); When the network/node is healthy, frozen banks are getting rooted and thus pruned from When roots stop getting made, the pruning does not happen, and we begin to accumulate frozen banks in So, the optimization of For example, consider the following sequence where The initial idea was that since we had seen We actually encounter this kind of scenario that would break things around epoch boundaries, where we might have several forks in the new epoch (we've seen one per leader for the first several leaders) all building off the last slot in the previous epoch. Haven't given much thought to alternatives, but also maybe not worth spending additional cycles on the moment? Maybe we just take the gains we get with |
Look like a good opportunity here! RocksDB's batched multi_get() also comes with an optional boolean indicating whether the input keys are already sorted. If so, then internally RocksDB will skip the sorting.
And, luckily, I did port this optional flag to rust-rocksdb, so we can use it without waiting for another release!
If we also want to avoid repeated queries, then sorting before passing it to multi_get() makes a lot of sense. By doing this, we can solve two problems at once! |
…27686) #### Problem The current implementation of get_slots_since() invokes multiple rocksdb::get(). As a result, each get() operation may end up requiring one disk read. This leads to poor performance of get_slots_since described in #24878. #### Summary of Changes This PR makes get_slots_since() use the batched version of multi_get() instead, which allows multiple get operations to be processed in batch so that they can be answered with fewer disk reads.
Problem
When there are a lot of non-rooted slots. get_slots_since starts to take longer (100s of ms):
Proposed Solution
Seems like we might be doing some extra work here or could be more efficient in storing the delta. We store what we captured last and then start adding new slots to a new set which we can query for the next call.
The text was updated successfully, but these errors were encountered: