-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: ETH RPC: Use Block Cache for EthGetBlockByHash
#12359
Conversation
Tested this on a mainnet node With Caching enabled (fetch all txdata as well) First request
Second request
|
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.
Just a couple of comments.
Do you have any before metrics? |
@Stebalien Lemme get them for you. |
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.
Seems like a reasonable approach.
Without any caching 1st fetch
2nd fetch
Caching definitely helps here. Keep in mind that this is a snapshot synced node with splitstore pruning enabled. Difference should be even more pronounced on an archival node with no splitstore. |
2x savings actually aren't that large here... I wonder if that's just because the network is quiet right now. On the other hand, the cache is pretty small so it probably isn't harmful. |
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.
This seems fine but I am a little concerned about the large memory footprint of lotus just getting bigger, turn on the eth API and you have yet another blob in memory. Although thankfully it only grows if you use it.
I'm not sure exactly how much these take up but the JSON output of one of your example blocks is over 500Kb, so maybe they end up being something like 200Kb in memory, so perhaps 100Mb here when we cache 500 of them.
Closes #10520.
Part of #12293.