node-bench no-op block import (#5869)

* start to try and implement noop

* txs as input

* better comment

* Add transfer reaping

* rename to avoid filter matching

* Update base weights based on results

* fix priority

* fix logic on reaping transfer

* Update bin/node/bench/src/import.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update bin/node/bench/src/main.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* add back size type (in-progress)

* bring back size type with custom

* update comment

* nit

* block type then size

* Use `transfer_keep_alive`

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
Shawn Tabrizi
2020-05-03 15:33:11 +02:00
committed by GitHub
parent 51db82bdb9
commit f37927d37d
6 changed files with 99 additions and 63 deletions
+34 -30
View File
@@ -26,7 +26,7 @@ use crate::core::{run_benchmark, Mode as BenchmarkMode};
use crate::tempdb::DatabaseType;
use import::{ImportBenchmarkDescription, SizeType};
use trie::{TrieReadBenchmarkDescription, TrieWriteBenchmarkDescription, DatabaseSize};
use node_testing::bench::{Profile, KeyTypes};
use node_testing::bench::{Profile, KeyTypes, BlockType};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
@@ -49,9 +49,13 @@ struct Opt {
/// Run with `--list` for the hint of what to filter.
filter: Option<String>,
/// Number of transactions for block import with `custom` size.
#[structopt(long)]
transactions: Option<usize>,
/// Mode
///
/// "regular" for regular becnhmark
/// "regular" for regular benchmark
///
/// "profile" mode adds pauses between measurable runs,
/// so that actual interval can be selected in the profiler of choice.
@@ -66,38 +70,38 @@ fn main() {
sc_cli::init_logger("");
}
let mut import_benchmarks = Vec::new();
for profile in [Profile::Wasm, Profile::Native].iter() {
for size in [
SizeType::Empty,
SizeType::Small,
SizeType::Medium,
SizeType::Large,
SizeType::Full,
SizeType::Custom,
].iter() {
let txs = match size {
SizeType::Custom => opt.transactions.unwrap_or(0),
_ => size.transactions()
};
for block_type in [
BlockType::RandomTransfersKeepAlive(txs),
BlockType::RandomTransfersReaping(txs),
BlockType::Noop(txs),
].iter() {
import_benchmarks.push((profile.clone(), size.clone(), block_type.clone()));
}
}
}
let benchmarks = matrix!(
profile in [Profile::Wasm, Profile::Native].iter() =>
(profile, size, block_type) in import_benchmarks.iter() =>
ImportBenchmarkDescription {
profile: *profile,
key_types: KeyTypes::Sr25519,
size: SizeType::Medium,
},
ImportBenchmarkDescription {
profile: Profile::Wasm,
key_types: KeyTypes::Sr25519,
size: SizeType::Empty,
},
ImportBenchmarkDescription {
profile: Profile::Native,
key_types: KeyTypes::Ed25519,
size: SizeType::Medium,
},
ImportBenchmarkDescription {
profile: Profile::Wasm,
key_types: KeyTypes::Sr25519,
size: SizeType::Full,
},
ImportBenchmarkDescription {
profile: Profile::Native,
key_types: KeyTypes::Sr25519,
size: SizeType::Full,
},
size in [SizeType::Small, SizeType::Large].iter() =>
ImportBenchmarkDescription {
profile: Profile::Native,
key_types: KeyTypes::Sr25519,
size: *size,
block_type: *block_type,
},
(size, db_type) in
[
@@ -145,4 +149,4 @@ fn main() {
let json_result: String = serde_json::to_string(&results).expect("Failed to construct json");
println!("{}", json_result);
}
}
}