Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsystem-bench: adjust test config to Kusama #3583

Merged
merged 7 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! availability-read regression tests
//!
//! TODO: Explain the test case after configuration adjusted to Kusama
//! Availability read benchmark based on Kusama parameters and scale.
//!
//! Subsystems involved:
//! - availability-distribution
Expand All @@ -25,28 +25,19 @@

use polkadot_subsystem_bench::{
availability::{benchmark_availability_write, prepare_test, TestDataAvailability, TestState},
configuration::{PeerLatency, TestConfiguration},
configuration::TestConfiguration,
usage::BenchmarkUsage,
};

const BENCH_COUNT: usize = 3;
const WARM_UP_COUNT: usize = 20;
const WARM_UP_COUNT: usize = 30;
const WARM_UP_PRECISION: f64 = 0.01;

fn main() -> Result<(), String> {
let mut messages = vec![];

// TODO: Adjust the test configurations to Kusama values
let mut config = TestConfiguration::default();
config.latency = Some(PeerLatency { mean_latency_ms: 30, std_dev: 2.0 });
config.n_validators = 1000;
config.n_cores = 200;
config.max_validators_per_core = 5;
config.min_pov_size = 5120;
config.max_pov_size = 5120;
config.peer_bandwidth = 52428800;
config.bandwidth = 52428800;
config.connectivity = 75;
// A single node effort roughly n_cores * needed_approvals / n_validators = 60 * 30 / 300
config.n_cores = 6;
config.num_blocks = 3;
config.generate_pov_sizes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! availability-write regression tests
//!
//! TODO: Explain the test case after configuration adjusted to Kusama
//! Availability write benchmark based on Kusama parameters and scale.
//!
//! Subsystems involved:
//! - availability-recovery
Expand All @@ -26,7 +26,7 @@ use polkadot_subsystem_bench::{
benchmark_availability_read, prepare_test, DataAvailabilityReadOptions,
TestDataAvailability, TestState,
},
configuration::{PeerLatency, TestConfiguration},
configuration::TestConfiguration,
usage::BenchmarkUsage,
};

Expand All @@ -37,18 +37,9 @@ const WARM_UP_PRECISION: f64 = 0.01;
fn main() -> Result<(), String> {
let mut messages = vec![];

// TODO: Adjust the test configurations to Kusama values
let options = DataAvailabilityReadOptions { fetch_from_backers: true };
let mut config = TestConfiguration::default();
config.latency = Some(PeerLatency { mean_latency_ms: 100, std_dev: 1.0 });
config.n_validators = 300;
config.n_cores = 20;
config.min_pov_size = 5120;
config.max_pov_size = 5120;
config.peer_bandwidth = 52428800;
config.bandwidth = 52428800;
config.num_blocks = 3;
config.connectivity = 90;
config.generate_pov_sizes();

warm_up(config.clone(), options.clone())?;
Expand Down
38 changes: 28 additions & 10 deletions polkadot/node/subsystem-bench/src/lib/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,34 @@ pub struct PeerLatency {
pub std_dev: f64,
}

// Based on Kusama `max_validators`
fn default_n_validators() -> usize {
300
}

// Based on Kusama cores
fn default_n_cores() -> usize {
60
}

// Default PoV size in KiB.
fn default_pov_size() -> usize {
5120
5 * 1024
}

// Default bandwidth in bytes
// Default bandwidth in bytes, based stats from Kusama validators
fn default_bandwidth() -> usize {
52428800
42 * 1024 * 1024
}

// Default peer latency
fn default_peer_latency() -> Option<PeerLatency> {
Some(PeerLatency { mean_latency_ms: 30, std_dev: 2.0 })
}

// Default connectivity percentage
fn default_connectivity() -> usize {
100
90
}

// Default backing group size
Expand All @@ -63,6 +78,7 @@ fn default_needed_approvals() -> usize {
fn default_zeroth_delay_tranche_width() -> usize {
0
}

fn default_relay_vrf_modulo_samples() -> usize {
6
}
Expand All @@ -78,8 +94,10 @@ fn default_no_show_slots() -> usize {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TestConfiguration {
/// Number of validators
#[serde(default = "default_n_validators")]
pub n_validators: usize,
/// Number of cores
#[serde(default = "default_n_cores")]
pub n_cores: usize,
/// The number of needed votes to approve a candidate.
#[serde(default = "default_needed_approvals")]
Expand Down Expand Up @@ -111,10 +129,10 @@ pub struct TestConfiguration {
#[serde(default = "default_bandwidth")]
pub bandwidth: usize,
/// Optional peer emulation latency (round trip time) wrt node under test
#[serde(default)]
#[serde(default = "default_peer_latency")]
pub latency: Option<PeerLatency>,
/// Connectivity ratio, the percentage of peers we are not connected to, but ar part of
/// the topology.
/// Connectivity ratio, the percentage of peers we are connected to, but as part of the
/// topology.
#[serde(default = "default_connectivity")]
pub connectivity: usize,
/// Number of blocks to run the test for
Expand All @@ -124,8 +142,8 @@ pub struct TestConfiguration {
impl Default for TestConfiguration {
fn default() -> Self {
Self {
n_validators: Default::default(),
n_cores: Default::default(),
n_validators: default_n_validators(),
n_cores: default_n_cores(),
needed_approvals: default_needed_approvals(),
zeroth_delay_tranche_width: default_zeroth_delay_tranche_width(),
relay_vrf_modulo_samples: default_relay_vrf_modulo_samples(),
Expand All @@ -137,7 +155,7 @@ impl Default for TestConfiguration {
pov_sizes: Default::default(),
peer_bandwidth: default_bandwidth(),
bandwidth: default_bandwidth(),
latency: Default::default(),
latency: default_peer_latency(),
connectivity: default_connectivity(),
num_blocks: Default::default(),
}
Expand Down
Loading