Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
01af630
skeleton
sandreim Oct 25, 2023
7c22abe
wip
sandreim Nov 6, 2023
c3adc77
measure tput and fixes
sandreim Nov 6, 2023
31b0351
add network emulation
sandreim Nov 7, 2023
e4bb037
cleanup
sandreim Nov 7, 2023
a694924
Add latency emulation
sandreim Nov 7, 2023
7ca4dba
support multiple pov sizes
sandreim Nov 8, 2023
0430b5b
new metric in recovery and more testing
sandreim Nov 8, 2023
027bcd8
CLI update and fixes
sandreim Nov 9, 2023
5a05da0
peer stats
sandreim Nov 9, 2023
895e8d6
Switch stats to atomics
sandreim Nov 10, 2023
a2fb0c9
add more network metrics, new load generator
sandreim Nov 12, 2023
d1b9fa3
refactor
sandreim Nov 14, 2023
c5937ab
pretty cli + minor refactor + remove unused
sandreim Nov 15, 2023
d6c259d
update
sandreim Nov 15, 2023
050529b
remove comment
sandreim Nov 15, 2023
cb38be5
separate cli options for availability
sandreim Nov 17, 2023
24a736a
implement unified and extensible configuration
sandreim Nov 17, 2023
2843865
Prepare to swtich to overseer
sandreim Nov 24, 2023
fd4620e
Merge branch 'master' of github.com:paritytech/polkadot-sdk into sand…
sandreim Nov 24, 2023
b17a147
add mocked subsystems
sandreim Nov 27, 2023
4724d8c
full overseer based implementation complete
sandreim Nov 27, 2023
7aed30f
make clean
sandreim Nov 27, 2023
b51485b
more cleaning
sandreim Nov 27, 2023
7e46444
more cleaning
sandreim Nov 27, 2023
d3df927
proper overseer control
sandreim Nov 27, 2023
7557768
refactor CLI display of env stats
sandreim Nov 27, 2023
787dc00
Add grafana dashboards for DA read
sandreim Nov 28, 2023
cd18f8d
network stats fixes
sandreim Nov 28, 2023
e8506b3
move examples and grafana
sandreim Nov 28, 2023
cbb6772
Add readme
sandreim Nov 28, 2023
1a80870
fmt + readme updates
sandreim Nov 28, 2023
eb49ea0
update dashboard and sample
sandreim Nov 28, 2023
b249056
remove unused
sandreim Nov 28, 2023
7fbcdfc
Merge branch 'master' of github.com:paritytech/polkadot-sdk into sand…
sandreim Nov 28, 2023
fb34181
revert unneeded changes
sandreim Nov 28, 2023
3a716a5
add missing comments and minor fixes
sandreim Nov 29, 2023
a092b76
clippy
sandreim Nov 29, 2023
ca27370
zepter format features --fix
sandreim Nov 29, 2023
be814e5
fix markdown
sandreim Nov 29, 2023
11ce8f5
remove sleep till end of block
sandreim Nov 29, 2023
8d93abc
review
sandreim Nov 29, 2023
af141ee
Emulated network improvements
sandreim Dec 1, 2023
29d80fa
fix comment
sandreim Dec 1, 2023
70ac38e
Add cpu profiling
AndreiEres Dec 4, 2023
a06f2a5
Merge branch 'sandreim/subsystem-bench' into AndreiEres/cpu-profiling
AndreiEres Dec 5, 2023
b9f4dd9
Update polkadot/node/subsystem-bench/README.md
AndreiEres Dec 5, 2023
8736689
Update
AndreiEres Dec 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CLI update and fixes
Signed-off-by: Andrei Sandu <[email protected]>
  • Loading branch information
sandreim committed Nov 9, 2023
commit 027bcd862eef7d2f776ceb0d2bf3dc11ef490b5c
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions cumulus/pallets/xcmp-queue/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,11 @@ fn verify_fee_factor_increase_and_decrease() {
assert_eq!(DeliveryFeeFactor::<Test>::get(sibling_para_id), initial);

// Sending the message right now is cheap
let (_, delivery_fees) = validate_send::<XcmpQueue>(destination, xcm.clone())
.expect("message can be sent; qed");
let Fungible(delivery_fee_amount) = delivery_fees.inner()[0].fun else { unreachable!("asset is fungible; qed"); };
let (_, delivery_fees) =
validate_send::<XcmpQueue>(destination, xcm.clone()).expect("message can be sent; qed");
let Fungible(delivery_fee_amount) = delivery_fees.inner()[0].fun else {
unreachable!("asset is fungible; qed");
};
assert_eq!(delivery_fee_amount, 402_000_000);

let smaller_xcm = Xcm(vec![ClearOrigin; 30]);
Expand All @@ -422,19 +424,23 @@ fn verify_fee_factor_increase_and_decrease() {
assert_ok!(send_xcm::<XcmpQueue>(destination, xcm.clone())); // Size 520
assert_eq!(DeliveryFeeFactor::<Test>::get(sibling_para_id), FixedU128::from_float(1.05));

for _ in 0..12 { // We finish at size 929
for _ in 0..12 {
// We finish at size 929
assert_ok!(send_xcm::<XcmpQueue>(destination, smaller_xcm.clone()));
}
assert!(DeliveryFeeFactor::<Test>::get(sibling_para_id) > FixedU128::from_float(1.88));

// Sending the message right now is expensive
let (_, delivery_fees) = validate_send::<XcmpQueue>(destination, xcm.clone())
.expect("message can be sent; qed");
let Fungible(delivery_fee_amount) = delivery_fees.inner()[0].fun else { unreachable!("asset is fungible; qed"); };
let (_, delivery_fees) =
validate_send::<XcmpQueue>(destination, xcm.clone()).expect("message can be sent; qed");
let Fungible(delivery_fee_amount) = delivery_fees.inner()[0].fun else {
unreachable!("asset is fungible; qed");
};
assert_eq!(delivery_fee_amount, 758_030_955);

// Fee factor only decreases in `take_outbound_messages`
for _ in 0..5 { // We take 5 100 byte pages
for _ in 0..5 {
// We take 5 100 byte pages
XcmpQueue::take_outbound_messages(1);
}
assert!(DeliveryFeeFactor::<Test>::get(sibling_para_id) < FixedU128::from_float(1.72));
Expand Down
4 changes: 4 additions & 0 deletions polkadot/node/network/availability-recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license.workspace = true

[dependencies]
futures = "0.3.21"
tokio = "1.24.2"
schnellru = "0.2.1"
rand = "0.8.5"
fatality = "0.0.6"
Expand Down Expand Up @@ -36,3 +37,6 @@ sc-network = { path = "../../../../substrate/client/network" }

polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" }

[features]
subsystem-benchmarks = []
10 changes: 7 additions & 3 deletions polkadot/node/network/availability-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,9 @@ impl AvailabilityRecoverySubsystem {
.into_iter()
.cycle();

gum::debug!("Subsystem running");
loop {
let recv_req = req_receiver.recv(|| vec![COST_INVALID_REQUEST]).fuse();
pin_mut!(recv_req);
gum::debug!("waiting for message");

futures::select! {
erasure_task = erasure_task_rx.next() => {
match erasure_task {
Expand Down Expand Up @@ -729,6 +726,8 @@ impl AvailabilityRecoverySubsystem {
}
}
output = state.ongoing_recoveries.select_next_some() => {
// No caching for benchmark.
#[cfg(not(feature = "subsystem-benchmarks"))]
if let Some((candidate_hash, result)) = output {
if let Ok(recovery) = CachedRecovery::try_from(result) {
state.availability_lru.insert(candidate_hash, recovery);
Expand Down Expand Up @@ -829,5 +828,10 @@ async fn erasure_task_thread(
break
},
}

// In benchmarks this is a very hot loop not yielding at all.
// To update promehteus metrics for the task we need to yield.
#[cfg(feature = "subsystem-benchmarks")]
tokio::task::yield_now().await;
}
}
4 changes: 2 additions & 2 deletions polkadot/node/subsystem-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ polkadot-node-subsystem-types = { path = "../subsystem-types" }
polkadot-node-primitives = { path = "../primitives" }
polkadot-primitives = { path = "../../primitives" }
polkadot-node-network-protocol = { path = "../network/protocol" }
polkadot-availability-recovery = { path = "../network/availability-recovery" }
polkadot-availability-recovery = { path = "../network/availability-recovery", features=["subsystem-benchmarks"]}
color-eyre = { version = "0.6.1", default-features = false }
assert_matches = "1.5"
async-trait = "0.1.57"
Expand All @@ -38,7 +38,7 @@ env_logger = "0.9.0"
rand = "0.8.5"
parity-scale-codec = { version = "3.6.1", features = ["std", "derive"] }
tokio = "1.24.2"

clap-num = "1.0.2"
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
sp-keyring = { path = "../../../substrate/primitives/keyring" }
sp-application-crypto = { path = "../../../substrate/primitives/application-crypto" }
Expand Down
94 changes: 46 additions & 48 deletions polkadot/node/subsystem-bench/src/availability/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use super::*;

/// Peer response latency configuration.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct PeerLatency {
/// Min latency for `NetworkAction` completion.
pub min_latency: Duration,
Expand All @@ -36,15 +36,15 @@ pub struct TestConfiguration {
pub n_cores: usize,
/// The PoV size
pub pov_sizes: Vec<usize>,
/// This parameter is used to determine how many recoveries we batch in parallel
/// to simulate tranche0 recoveries.
pub max_parallel_recoveries: usize,
/// The amount of bandiwdht remote validators have.
/// The amount of bandiwdth remote validators have.
pub bandwidth: usize,
/// Optional peer emulation latency
pub latency: Option<PeerLatency>,
/// Error probability
pub error: usize,
/// Number of loops
/// In one loop `n_cores` candidates are recovered
pub num_loops: usize,
}

impl Default for TestConfiguration {
Expand All @@ -54,80 +54,78 @@ impl Default for TestConfiguration {
n_validators: 10,
n_cores: 10,
pov_sizes: vec![5 * 1024 * 1024],
max_parallel_recoveries: 6,
bandwidth: 60 * 1024 * 1024,
latency: None,
error: 0,
num_loops: 1,
}
}
}

impl TestConfiguration {
/// An unconstrained standard configuration matching Polkadot/Kusama
pub fn unconstrained_300_validators_60_cores(pov_sizes: Vec<usize>) -> TestConfiguration {
pub fn ideal_network(
num_loops: usize,
use_fast_path: bool,
n_validators: usize,
n_cores: usize,
pov_sizes: Vec<usize>,
) -> TestConfiguration {
Self {
use_fast_path: false,
n_validators: 300,
n_cores: 100,
use_fast_path,
n_cores,
n_validators,
pov_sizes,
max_parallel_recoveries: 100,
// HW specs node bandwidth
bandwidth: 60 * 1024 * 1024,
// No latency
latency: None,
error: 0,
}
}
pub fn unconstrained_1000_validators_60_cores(pov_sizes: Vec<usize>) -> TestConfiguration {
Self {
use_fast_path: false,
n_validators: 300,
n_cores: 60,
pov_sizes,
max_parallel_recoveries: 30,
// HW specs node bandwidth
bandwidth: 60 * 1024 * 1024,
bandwidth: 50 * 1024 * 1024,
// No latency
latency: None,
error: 0,
num_loops,
}
}

/// Polkadot/Kusama configuration with typical latency constraints.
pub fn healthy_network_300_validators_60_cores(pov_sizes: Vec<usize>) -> TestConfiguration {
pub fn healthy_network(
num_loops: usize,
use_fast_path: bool,
n_validators: usize,
n_cores: usize,
pov_sizes: Vec<usize>,
) -> TestConfiguration {
Self {
use_fast_path: true,
n_validators: 300,
n_cores: 60,
use_fast_path,
n_cores,
n_validators,
pov_sizes,
max_parallel_recoveries: 6,
// HW specs node bandwidth
bandwidth: 60 * 1024 * 1024,
bandwidth: 50 * 1024 * 1024,
latency: Some(PeerLatency {
min_latency: Duration::from_millis(1),
max_latency: Duration::from_millis(50),
max_latency: Duration::from_millis(100),
}),
error: 5,
error: 3,
num_loops,
}
}

/// Polkadot/Kusama configuration with degraded due to latencies.
/// TODO: implement errors.
pub fn degraded_network_300_validators_60_cores(pov_sizes: Vec<usize>) -> TestConfiguration {
pub fn degraded_network(
num_loops: usize,
use_fast_path: bool,
n_validators: usize,
n_cores: usize,
pov_sizes: Vec<usize>,
) -> TestConfiguration {
Self {
use_fast_path: false,
n_validators: 300,
n_cores: 100,
use_fast_path,
n_cores,
n_validators,
pov_sizes,
max_parallel_recoveries: 20,
// HW specs node bandwidth
bandwidth: 60 * 1024 * 1024,
// A range of latencies to expect in a degraded network
bandwidth: 50 * 1024 * 1024,
latency: Some(PeerLatency {
min_latency: Duration::from_millis(1),
min_latency: Duration::from_millis(10),
max_latency: Duration::from_millis(500),
}),
error: 30,
error: 33,
num_loops,
}
}
}
Loading