Skip to content
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

Support cache to retrieve ethereum logs #450

Closed
crystalin opened this issue Aug 20, 2021 · 3 comments
Closed

Support cache to retrieve ethereum logs #450

crystalin opened this issue Aug 20, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@crystalin
Copy link
Collaborator

Motivation

Currently the eth_getLogs is heavily used by some projects, sometime querying up to thousands of blocks in 1 request frequently (they could definitely improve it).
This has a huge impact on rpc nodes.

Suggested Solution

Because the blocks are constant, we should cache the ethereum logs so that requesting those would have a minimal cost.

I suggest to implement it directly there:
https://github.com/paritytech/frontier/blob/a9ec7ddd002b398937d5dae4d2b581a717b118b7/client/rpc/src/eth.rs#L352

Providing a new function like get_all_logs which would retrieve all the logs of a block and cache it.
This would allow to still use the cache even when there are filters.

Ideally, this on-the-fly cache would use an LRU eviction to ensure the most queries blocks would stay.

@crystalin crystalin added the enhancement New feature or request label Aug 20, 2021
@crystalin
Copy link
Collaborator Author

Some tracing for the getLogs:
image

(You can open with speedscope.app , thread 27918 of
perf.getLogs.txt

@arthur-cw
Copy link

hey @crystalin, this is interesting, do you have any idea on how to do it?

@crystalin
Copy link
Collaborator Author

crystalin commented Feb 18, 2022

@arthur-cw This is already included in frontier
#540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants