From 11c7fdf9ca3fca4111a1b4ca820d238e40e69283 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 5 Apr 2021 18:31:14 +0200 Subject: [PATCH] Adjust number of slots in sync requests channel (#8492) --- client/network/src/block_request_handler.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/client/network/src/block_request_handler.rs b/client/network/src/block_request_handler.rs index 148bc01302f7f..b54fe3992c11e 100644 --- a/client/network/src/block_request_handler.rs +++ b/client/network/src/block_request_handler.rs @@ -121,14 +121,9 @@ impl BlockRequestHandler { client: Arc>, num_peer_hint: usize, ) -> (Self, ProtocolConfig) { - // Rate of arrival multiplied with the waiting time in the queue equals the queue length. - // - // An average Polkadot node serves less than 5 requests per second. The 95th percentile - // serving a request is less than 2 second. Thus one would estimate the queue length to be - // below 10. - // - // Choosing 20 as the queue length to give some additional buffer. - let (tx, request_receiver) = mpsc::channel(20); + // Reserve enough request slots for one request per peer when we are at the maximum + // number of peers. + let (tx, request_receiver) = mpsc::channel(num_peer_hint); let mut protocol_config = generate_protocol_config(protocol_id); protocol_config.inbound_queue = Some(tx);