eos icon indicating copy to clipboard operation
eos copied to clipboard

Optimizing chain initialization

Open coreylederer opened this issue 8 years ago • 5 comments

How fast can we download the blockchain to a node? (non-producing node?, producing node?)

  • Dan would like the download of the blockchain to be similar to when you connect to steamit.
  • Want to measure download from disk vs download from memory.
  • Do we need a specific daemon to manage that capability?

coreylederer avatar Mar 26 '18 17:03 coreylederer

It should be in a separate plug-in, listening on a separate port and running in a separate thread, or thread-per-connection. This could be integrated with the existing nodeos or in a separate process.

If it were within the same process, the p2p listen socket could be used, but it would delegate servicing to the new plugin, and get the socket back after the transfer is complete.

We could use zlib for streaming compression. A simple protocol would be to indicate how many blocks the client should expect, or if a maximum number of connections is reached reject the client request and have it failover to another server. If no server is able to provide the fast download, the client falls back to the current block request strategy.

pmesnier avatar Mar 26 '18 17:03 pmesnier

Downloading the chain should involve the following assumptions:

  1. You are connecting to a trusted peer
  2. You are only connecting to one peer
  3. You may have some existing blocks downloaded
  4. You don't know how many blocks need to be fetched

After downloading the blocks the blockchain should "replay" from last head block.

  1. in theory it could be replaying while downloading
  2. in practice downloading should be 100x faster than replaying
  3. therefore the maximum gain from replaying while downloading should be small

I would add this "fast-sync" as a separate plugin from the existing P2P code.
Fast-sync should be able to hand-off to the P2P code when it is complete.

bytemaster avatar Mar 26 '18 19:03 bytemaster

Hope the fast-sync will be released soon

garfee avatar Oct 24 '18 19:10 garfee

@wanderingbort @heifner This seems like we have either decided on different options for faster sync or that it will likely be very different than this write-up. If I don't hear anything from you I will mark as OBE and close.

brianjohnson5972 avatar Oct 30 '18 12:10 brianjohnson5972

OBE (Overcome By Events)

brianjohnson5972 avatar Nov 01 '18 14:11 brianjohnson5972