From bac50e2e9229f3f92868cbb4ca075a6ed09224d3 Mon Sep 17 00:00:00 2001 From: Robert Klotzner Date: Mon, 30 Aug 2021 10:57:16 +0200 Subject: [PATCH 1/2] Requests timeout rather frequently on Rococo. Increase timeout a bit to accomodate for that. --- node/network/collator-protocol/src/collator_side/mod.rs | 4 ++++ node/network/collator-protocol/src/validator_side/mod.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/node/network/collator-protocol/src/collator_side/mod.rs b/node/network/collator-protocol/src/collator_side/mod.rs index 49eb2ed86391..776636c3f42c 100644 --- a/node/network/collator-protocol/src/collator_side/mod.rs +++ b/node/network/collator-protocol/src/collator_side/mod.rs @@ -70,6 +70,10 @@ const COST_APPARENT_FLOOD: Rep = /// the transfer should be possible within 0.1 seconds. 400 milliseconds should therefore be /// plenty and should be low enough for later validators to still be able to finish on time. /// +/// NOTE: We choose a smaller timeout here, as all validators in the backing group will need the +/// PoV anyway, so a parallel upload is not necessarily wasteful here. The situation is differently +/// on the validator side, where we pick a slightly larger timeout. +/// /// There is debug logging output, so we can adjust this value based on production results. const MAX_UNSHARED_UPLOAD_TIME: Duration = Duration::from_millis(400); diff --git a/node/network/collator-protocol/src/validator_side/mod.rs b/node/network/collator-protocol/src/validator_side/mod.rs index 3f77e499de08..be61f3b1192e 100644 --- a/node/network/collator-protocol/src/validator_side/mod.rs +++ b/node/network/collator-protocol/src/validator_side/mod.rs @@ -80,12 +80,15 @@ const BENEFIT_NOTIFY_GOOD: Rep = /// This is to protect from a single slow collator preventing collations from happening. /// /// With a collation size of 5MB and bandwidth of 500Mbit/s (requirement for Kusama validators), -/// the transfer should be possible within 0.1 seconds. 400 milliseconds should therefore be +/// the transfer should be possible within 0.1 seconds. 600 milliseconds should therefore be /// plenty, even with multiple heads and should be low enough for later collators to still be able /// to finish on time. /// +/// We pick a larger timeout here, as parallel downloads here are purely wasteful (we will only +/// ever second one collation per block). +/// /// There is debug logging output, so we can adjust this value based on production results. -const MAX_UNSHARED_DOWNLOAD_TIME: Duration = Duration::from_millis(400); +const MAX_UNSHARED_DOWNLOAD_TIME: Duration = Duration::from_millis(600); // How often to check all peers with activity. #[cfg(not(test))] @@ -1187,7 +1190,7 @@ where tracing::debug!( target: LOG_TARGET, ?relay_parent, - "Fetch for collation took too long, starting parallel download for next collator as well." + "Fetching collation took too long, starting parallel download for next collator as well." ); dequeue_next_collation_and_fetch(&mut ctx, &mut state, relay_parent, collator_id).await; } From 92dbcec8d303dcdf4176e27790176fe62c1db2fe Mon Sep 17 00:00:00 2001 From: Robert Klotzner Date: Mon, 30 Aug 2021 14:43:44 +0200 Subject: [PATCH 2/2] Fix tests. --- node/network/collator-protocol/src/validator_side/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node/network/collator-protocol/src/validator_side/mod.rs b/node/network/collator-protocol/src/validator_side/mod.rs index be61f3b1192e..68847f5bcb9b 100644 --- a/node/network/collator-protocol/src/validator_side/mod.rs +++ b/node/network/collator-protocol/src/validator_side/mod.rs @@ -88,7 +88,10 @@ const BENEFIT_NOTIFY_GOOD: Rep = /// ever second one collation per block). /// /// There is debug logging output, so we can adjust this value based on production results. +#[cfg(not(test))] const MAX_UNSHARED_DOWNLOAD_TIME: Duration = Duration::from_millis(600); +#[cfg(test)] +const MAX_UNSHARED_DOWNLOAD_TIME: Duration = Duration::from_millis(60); // How often to check all peers with activity. #[cfg(not(test))]