Hedge every syncer block download request

Remove the minimum data points from the syncer hedge configuragtion.
When there are no data points, hedge sends the second request
immediately.

Where there are less than 1/(1-latency_percentile) data points (20),
hedge delays the second request by the highest recent download time.

This change should improve genesis and post-restart sync latency.
This commit is contained in:
teor 2020-10-28 15:16:03 +10:00 committed by Deirdre Connolly
parent b4ce442cea
commit 656bd24ba7
1 changed files with 4 additions and 1 deletions

View File

@ -148,6 +148,9 @@ where
// making a less-fallible network service, and the Hedge layer
// tries to reduce latency of that less-fallible service.
//
// We hedge every request. If we don't have any recent timings,
// Hedge issues a second request with no delay.
//
// XXX add ServiceBuilder::hedge() so this becomes
// ServiceBuilder::new().hedge(...).retry(...)...
let block_network = Hedge::new(
@ -157,7 +160,7 @@ where
.timeout(BLOCK_DOWNLOAD_TIMEOUT)
.service(peers),
AlwaysHedge,
20,
0,
0.95,
2 * SYNC_RESTART_TIMEOUT,
);