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

Erigon 3: Prune canonical markers - CanonicalHash, HeaderNumber from chaindata #11634

Merged
merged 15 commits into from
Aug 18, 2024

Conversation

Giulio2002
Copy link
Contributor

@Giulio2002 Giulio2002 commented Aug 16, 2024

We prune CanonicalHash and HeaderNumber in chaindata. this leads to a -99% in these 2 tables and reduce their total size to 40 pages in TOTAL (from >500k pages).

Benchmarks:

Total time taken to query blocks from 1000000 to 3000000: 1720.1410 seconds (OLD)
Total time taken to query blocks from 1000000 to 3000000: 1747.4729 seconds (New)

Amortized delta cost: 0.1ms/req

Is the RPC working for those ranges? Yes.

How does it work?

Query canonical hash from snapshots by: viewHeaderByNumber -> header.Hash() if db hit is missed
Query header number from snapshots by: viewHeaderByHash -> header.Num64 if db hit is missed

@Giulio2002 Giulio2002 marked this pull request as draft August 16, 2024 00:15
@Giulio2002 Giulio2002 marked this pull request as ready for review August 17, 2024 16:01
@Giulio2002
Copy link
Contributor Author

@AskAlexSharov AskAlexSharov merged commit c78450c into main Aug 18, 2024
10 checks passed
@AskAlexSharov AskAlexSharov deleted the prune-markers branch August 18, 2024 02:41
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

Successfully merging this pull request may close these issues.

2 participants