Skip to content

interface: parallel header-chunks download #10033

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SomberNight
Copy link
Member

We request chunks concurrently. This makes header-sync much faster
when we are many blocks behind.

(the first commit is a preparatory refactor)

notes:

  • all chunks are downloaded from the same interface, just for simplicity
  • we request up to 10 chunks concurrently (so 10*2016 headers)
    • more chunks: higher memory requirements
    • more chunks: higher concurrency => syncing needs fewer network round-trips
    • if a chunk does not connect, bandwidth for all later chunks is wasted
    • we can tweak the constant or make it dynamic or make it a configvar, etc, later
  • without this, we progress the chain tip by around 1 chunk per second
    • 52k blocks (1 year on mainnet) takes around 26 seconds
    • this is probably not that interesting for mainnet,
      but for testnet3, that sometimes has 200x the block-rate of mainnet,
      it is extremely useful

We request chunks concurrently. This makes header-sync much faster
when we are many blocks behind.

notes:
- all chunks are downloaded from the same interface, just for simplicity
- we request up to 10 chunks concurrently (so 10*2016 headers)
  - more chunks: higher memory requirements
  - more chunks: higher concurrency => syncing needs fewer network round-trips
  - if a chunk does not connect, bandwidth for all later chunks is wasted
  - we can tweak the constant or make it dynamic or make it a configvar, etc, later
- without this, we progress the chain tip by around 1 chunk per second
  - 52k blocks (1 year on mainnet) takes around 26 seconds
  - this is probably not *that* interesting for mainnet,
    but for testnet3, that sometimes has 200x the block-rate of mainnet,
    it is extremely useful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant