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

Don't even bother dispatching common RPC calls. #231

Closed
Yawning opened this issue Mar 28, 2022 · 2 comments
Closed

Don't even bother dispatching common RPC calls. #231

Yawning opened this issue Mar 28, 2022 · 2 comments

Comments

@Yawning
Copy link
Contributor

Yawning commented Mar 28, 2022

You know what's better than deduplication (#117)? Not hitting up the db for literally everything.

It isn't a particularly big stretch to assume that most of the queries will want information that is recent. A lot of the requests can omit hitting up the database if the gateway maintained a small cache of the n-most recent blocks (along with hashes and other metadata). As each gateway is currently (See: #84) stuck indexing everything, the cache can be updated as it indexes as well.

In the future, instances that do not have an indexer could either use a scanning-tolerant cache replacement policy, or use the same logic as long as the gateway always has an idea of what the most recently indexed block is.

@Yawning
Copy link
Contributor Author

Yawning commented Mar 30, 2022

This is partially done by implementing a block cache. Transactions could also be cached, which I will do in a followup PR.

TODO:

  • QueryTransaction
  • GetTransactionRecipt
  • GetLogs

@Yawning
Copy link
Contributor Author

Yawning commented Mar 31, 2022

Fixed by #242 and #244

@Yawning Yawning closed this as completed Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant