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

[core/state] Prefetch Trie Nodes Concurrently #372

Merged
merged 88 commits into from Nov 21, 2023
Merged

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Nov 1, 2023

Why this should be merged

Context: ethereum/go-ethereum#28266

How this works

This change modifies core/state/trie_prefetcher.go to prefetch trie nodes in parallel. In addition to this tweak, prefetching is no longer aborted (wait until all keys on a trie are prefetched) and we now prefetch tries during block building.

How this was tested

  • Existing unit tests
  • Run on the Avalanche Network

Open Questions

  • What should the default max prefetch concurrency be? (32 seems low given the size of this data, see example below): [core/state] Prefetch Tries Concurrently (Aggressive=48) #375 -> start with 16
  • Should we scale up copies faster? -> use the same scale up approach as bounded workers
  • Why are there any skipped prefetch tasks?: 947cad8
  • How many trie copies are created per block -> add metric
  • Should we reserve a trie just for copying? -> a fetch on an unpopulated path could take 7ms (7 levels), and likely one copy per 7ms
  • Should we reduce tasks per copy? -> could take 50ms per group (if broke into sections of 3, would only take 16-20ms), also add a metric for this
  • does a lock get grabbed when multiple threads fetch the same node? -> no
  • update the base trie to one with the most populated keys from prefetching (approx): [core/state] Return Best Trie Copy #396
  • Limit copies per subfetcher (could ensure no single trie is copied too many times, while still being less than disk concurrency)?
  • Nits: [core/state] Prefetch Trie Nits #398

aaronbuchwald
aaronbuchwald previously approved these changes Nov 20, 2023
darioush
darioush previously approved these changes Nov 21, 2023
utils/bounded_workers.go Outdated Show resolved Hide resolved
core/state/trie_prefetcher.go Outdated Show resolved Hide resolved
darioush
darioush previously approved these changes Nov 21, 2023
aaronbuchwald
aaronbuchwald previously approved these changes Nov 21, 2023
miner/worker.go Show resolved Hide resolved
miner/worker.go Show resolved Hide resolved
miner/worker.go Show resolved Hide resolved
core/state/trie_prefetcher.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Status: Backlog 🗄
Development

Successfully merging this pull request may close these issues.

None yet

5 participants