Skip to content

Commit

Permalink
Adjust number of slots in sync requests channel (paritytech#8492)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored and KalitaAlexey committed Jul 9, 2021
1 parent aa94e7a commit 11c7fdf
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions client/network/src/block_request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,9 @@ impl<B: BlockT> BlockRequestHandler<B> {
client: Arc<dyn Client<B>>,
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);
Expand Down

0 comments on commit 11c7fdf

Please sign in to comment.