Skip to content

Commit

Permalink
approval-voting: Make tests deterministic (paritytech#3899)
Browse files Browse the repository at this point in the history
With random connectivity and latency is hard to actually figure it out a
delta in the benchmarking, so disable them in order to get full
deterministic behaviour when measuring performance.

At least on my machine with this configuration the results for
approval-throughput are really similar between subsequent runs:

```
CPU usage, seconds                     total   per block

approval-distribution                36.9025      3.6902
approval-distribution                36.7579      3.6758
approval-distribution                37.0418      3.7042
approval-distribution                37.0339      3.7034
approval-distribution                36.9342      3.6934
approval-distribution                36.7177       3.6718



approval-voting                      52.7756      5.2776
approval-voting                      52.5999      5.2600
approval-voting                      53.2158      5.3216
approval-voting                      53.2493      5.3249
approval-voting                      52.8524      5.2852
approval-voting                      52.8611      5.2861
approval-voting                      52.8210      5.2821
```

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
  • Loading branch information
alexggh authored and TarekkMA committed Aug 2, 2024
1 parent 596859c commit 97f9aa3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ TestConfiguration:
peer_bandwidth: 524288000000
bandwidth: 524288000000
num_blocks: 10
connectivity: 100
latency: null
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ TestConfiguration:
peer_bandwidth: 524288000000
bandwidth: 524288000000
num_blocks: 10
connectivity: 100
latency: null
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ TestConfiguration:
peer_bandwidth: 524288000000
bandwidth: 524288000000
num_blocks: 10
connectivity: 100
latency: null

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ TestConfiguration:
peer_bandwidth: 524288000000
bandwidth: 524288000000
num_blocks: 10
connectivity: 100
latency: null

17 changes: 9 additions & 8 deletions polkadot/node/subsystem-bench/src/lib/approval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,12 @@ impl PeerMessageProducer {
.expect("We can't handle unknown peers")
.clone();

self.network
.send_message_from_peer(
&peer_authority_id,
protocol_v3::ValidationProtocol::ApprovalDistribution(message.msg).into(),
)
.unwrap_or_else(|_| panic!("Network should be up and running {:?}", sent_by));
if let Err(err) = self.network.send_message_from_peer(
&peer_authority_id,
protocol_v3::ValidationProtocol::ApprovalDistribution(message.msg).into(),
) {
gum::warn!(target: LOG_TARGET, ?sent_by, ?err, "Validator can not send message");
}
}

// Queues a message to be sent by the peer identified by the `sent_by` value.
Expand Down Expand Up @@ -994,11 +994,12 @@ pub async fn bench_approvals_run(
"polkadot_parachain_subsystem_bounded_received",
Some(("subsystem_name", "approval-distribution-subsystem")),
|value| {
gum::info!(target: LOG_TARGET, ?value, ?at_least_messages, "Waiting metric");
gum::debug!(target: LOG_TARGET, ?value, ?at_least_messages, "Waiting metric");
value >= at_least_messages as f64
},
)
.await;

gum::info!("Requesting approval votes ms");

for info in &state.blocks {
Expand Down Expand Up @@ -1038,7 +1039,7 @@ pub async fn bench_approvals_run(
"polkadot_parachain_subsystem_bounded_received",
Some(("subsystem_name", "approval-distribution-subsystem")),
|value| {
gum::info!(target: LOG_TARGET, ?value, ?at_least_messages, "Waiting metric");
gum::debug!(target: LOG_TARGET, ?value, ?at_least_messages, "Waiting metric");
value >= at_least_messages as f64
},
)
Expand Down

0 comments on commit 97f9aa3

Please sign in to comment.