Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Co #10897: Storage benchmarking #4982

Merged
merged 4 commits into from
Feb 25, 2022
Merged
Changes from 1 commit
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
Next Next commit
Add storage benchmarking
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Feb 24, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c7b76e3bf0c44190e5ba960be44efc5a05b55a26
3 changes: 3 additions & 0 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -54,6 +54,9 @@ pub enum Subcommand {
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

#[clap(name = "benchmark-storage", about = "Benchmark storage speed.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: This CAN CORRUPT YOUR DB so please make a backup before using this on a real snapshot; paritytech/substrate#10897 (comment)

@ggwpez should the command help not mention something to this effect to help end users not "footgun" on this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the command as is,will also require the --storage-version flag, so you cannot just run it accidentally.
The corruption can only occur for RocksDB, but I agree to make it a bit more explicit.
Maybe even add a --i-used-a-backup flag?

BenchmarkStorage(frame_benchmarking_cli::StorageCmd),

/// Runs performance checks such as PVF compilation in order to measure machine
/// capabilities of running a validator.
HostPerfCheck,
16 changes: 16 additions & 0 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
@@ -475,6 +475,22 @@ pub fn run() -> Result<()> {
#[cfg(not(feature = "polkadot-native"))]
panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
},
Some(Subcommand::BenchmarkStorage(cmd)) => {
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;
set_default_ss58_version(chain_spec);

Ok(runner.async_run(|mut config| {
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config, None)?;
let db = backend.expose_db();
let storage = backend.expose_storage();

Ok((
cmd.run(config, client, db, storage).map_err(Error::SubstrateCli),
task_manager,
))
})?)
},
Some(Subcommand::HostPerfCheck) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(true);