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

Update consensus runtime transaction benchmark #2990

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

NingLin-P
Copy link
Member

@NingLin-P NingLin-P commented Aug 28, 2024

This PR updates the consensus runtime benchmark (the extrinsic weight) with the benchmark result on following hardware:

  • Intel i7-6700 CPU @ 3.40GHz
  • Dual-channel Samsung DDR4 2133 (M378A2K43BB1-CPB, 4 sticks)
  • Samsung MZVLB512HAJQ-00000 512G NVMe SSD (PCIe 3.0 x4, two drives in RAID 1 using mdadm)
  • Fujitsu D3401-H1 motherboard

See the diff in each weight.rs file for the change of weight when running on the reference machine.

Also, the benchmark of set_pot_slot_iterations in the pallet-subspace seems missing so there is no weight generated for this extrinsic and I simply use the previous set_pot_slot_iterations weight cc @nazar-pc

Code contributor checklist:

.saturating_add(T::DbWeight::get().writes(13_u64))
// Measured: `1751`
// Estimated: `10166`
// Minimum execution time: 150_394_000 picoseconds.
Copy link
Member

Choose a reason for hiding this comment

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

Any idea why this has almost doubled in time?

Copy link
Member Author

Choose a reason for hiding this comment

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

My guess is:

  • CPU changed, the previous benchmarks were running on mac chip
  • The benchmark hasn't run for a while and there are maybe some changes in the code that bring more weight.

Copy link
Member Author

Choose a reason for hiding this comment

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

The benchmark hasn't run for a while and there are maybe some changes in the code that bring more weight.

This does seem related, I run the benchmark on my machine and it is Weight::from_parts(119_000_000, 10166) now.

Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

4vcpu (2 cores) and 8GB RAM

Is not a reference machine, it is a very rough high-level guideline. Such description can correspond to machines with 5x discrepancy in performance. We need to have an actual CPU and RAM specs defined here at least for benchmarking purposes. We also want physical machine here, not VM, such that we avoid interference of shared resources in order to get reproducible benchmarking results.

7R13 is OEM-only server CPU, not really representative of consumer chips.

Also, the benchmark of set_pot_slot_iterations in the pallet-subspace seems missing so there is no weight generated for this extrinsic and I simply use the previous set_pot_slot_iterations weight

Why not adding corresponding benchmark then?

@@ -17,7 +17,7 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
#![warn(rust_2018_idioms, missing_debug_implementations)]
Copy link
Member

Choose a reason for hiding this comment

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

Why removing lint, was it not possible to fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

Simply adding a #[derive(Debug)] can fix it but I don't think this lint is necessary.

@NingLin-P
Copy link
Member Author

Is not a reference machine, it is a very rough high-level guideline. Such description can correspond to machines with 5x discrepancy in performance. We need to have an actual CPU and RAM specs defined here at least for benchmarking purposes. We also want physical machine here, not VM, such that we avoid interference of shared resources in order to get reproducible benchmarking results.
7R13 is OEM-only server CPU, not really representative of consumer chips.

I agree, do you have any idea how we can get "We need to have an actual CPU and RAM specs defined here at least for benchmarking purposes" done? cc @nazar-pc @dariolina

Why not adding corresponding benchmark then?

I did look at the PR that brings this extrinsic and its weight but didn't see the benchmark there, is it deleted by accident and I need to write one?

@nazar-pc
Copy link
Member

I agree, do you have any idea how we can get "We need to have an actual CPU and RAM specs defined here at least for benchmarking purposes" done? cc @nazar-pc @dariolina

Yes, we need to take a reasonable physical machine and then possibly constrain (with something like taskset is probably fine) to a certain number physical and logical cores. There are machines on Hetzner and from other providers that have consumer-grade CPUs like AMD 3600/3700/7700 or Intel 6700/7700/8700/9900/12500/13500 depending on which generation we care about. They have plenty of options there.

I did look at the PR that brings this extrinsic and its weight but didn't see the benchmark there, is it deleted by accident and I need to write one?

There was likely none added from the very beginning, but the worst-case should be trivial there, so worth adding corresponding benchmark.

@dariolina
Copy link
Member

Looking at our telemetry, the most basic consumer one ppl use is Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz with 2.8% users

@nazar-pc
Copy link
Member

Looking at our telemetry, the most basic consumer one ppl use is Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz with 2.8% users

Yes, among the most popular options. However, we also have 27% of Other+Unknown.

@NingLin-P NingLin-P force-pushed the update-consensus-benchmark branch from 4e1fd3f to 90fb06a Compare September 9, 2024 15:06
@NingLin-P NingLin-P force-pushed the update-consensus-benchmark branch from 90fb06a to 0f6f9d9 Compare September 9, 2024 15:08
@NingLin-P
Copy link
Member Author

Force pushed to rebase on main and update the benchmark result from the reference CPU Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz

@nazar-pc
Copy link
Member

nazar-pc commented Sep 9, 2024

What memory type and speed was it? What SSD (ideally model)?

@NingLin-P
Copy link
Member Author

What memory type and speed was it? What SSD (ideally model)?

截屏2024-09-10 04 02 32

Perhaps @DaMandal0rian has more precise info.

@dariolina dariolina added the need to audit This change needs to be audited label Sep 10, 2024
@DaMandal0rian
Copy link
Member

What memory type and speed was it? What SSD (ideally model)?

截屏2024-09-10 04 02 32 Perhaps @DaMandal0rian has more precise info.

@NingLin-P @nazar-pc here are the hardware details:
https://gist.github.com/DaMandal0rian/21a01da49ee820c3e59bce7f8c2d0166

@NingLin-P NingLin-P added this pull request to the merge queue Sep 13, 2024
Merged via the queue into main with commit 83e13b5 Sep 13, 2024
9 checks passed
@NingLin-P NingLin-P deleted the update-consensus-benchmark branch September 13, 2024 10:09
@NingLin-P NingLin-P removed the need to audit This change needs to be audited label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants