evict balance cache based on time instead of blocks - #4699
Draft
MartinquaXD wants to merge 5 commits into
Draft
Conversation
|
This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently the time to cut auctions on arbitrum and bnb is significantly higher than on more used chains (~400ms vs. 200ms). The reason is that the cache currently evicts balances that have not been requested for 5 blocks which is like 1.5s on arbitrum for example. So when the autopilot run loop eventually finishes the balances have long been evicted and we need to re-fetch everything while building the auction.
Changes
Keep balances for 20s to definitely span at least 1 full auction so that the balances are always ready when building a new auction.
How to test
Temporarily deployed to arbitrum. As expected the time to build an auction dropped from ~400ms to ~50ms. On the flip side the total number of RPC requests trippled because it now actually continuously updates the balances the entire time.


If we also throttle the balance updates to once per second we are improving many metrics even more and even drop the number of RPC calls per second. With both changes applied we drop the total auction overhead from ~700ms to ~150ms.

