Optimizing chain initialization
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?
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.
Downloading the chain should involve the following assumptions:
- You are connecting to a trusted peer
- You are only connecting to one peer
- You may have some existing blocks downloaded
- You don't know how many blocks need to be fetched
After downloading the blocks the blockchain should "replay" from last head block.
- in theory it could be replaying while downloading
- in practice downloading should be 100x faster than replaying
- 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.
Hope the fast-sync will be released soon
@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.
OBE (Overcome By Events)