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

glutton: also increase parachain block length #4728

Merged
merged 23 commits into from
Jun 18, 2024

Conversation

sandreim
Copy link
Contributor

@sandreim sandreim commented Jun 7, 2024

Glutton currently is useful mostly for stress testing relay chain validators. It is unusable for testing the collator networking and block announcement and import scenarios. This PR resolves that by improving glutton pallet to also buff up the blocks, up to the runtime configured BlockLength.

How it works

Includes an additional inherent in each parachain block. The garbage argument passed to the inherent is filled with trash data. It's size is computed by applying the newly introduced block_length percentage to the maximum block length for mandatory dispatch class. After #4765 is merged, the length of inherent extrinsic will be added to the total block proof size.

The remaining weight is burnt in on_idle as configured by the storage percentage parameter.

TODO:

  • PRDoc
  • Readme update
  • Add tests

sandreim added 4 commits June 6, 2024 14:49
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim added T10-tests This PR/Issue is related to tests. T12-benchmarks This PR/Issue is related to benchmarking and weights. labels Jun 7, 2024
@sandreim sandreim requested a review from a team as a code owner June 7, 2024 10:19
@bkchr
Copy link
Member

bkchr commented Jun 7, 2024

The inherent calll is a no-op and the PoV size increase is negligible as a large zeroed buffer compresses nicely.

So, this is still a sub optimal solution. You want to benchmark something and come up with something that will again "cheat" in some way.

@sandreim
Copy link
Contributor Author

sandreim commented Jun 7, 2024

The inherent calll is a no-op and the PoV size increase is negligible as a large zeroed buffer compresses nicely.

So, this is still a sub optimal solution. You want to benchmark something and come up with something that will again "cheat" in some way.

That is a correct observation, PoV size is actually hard to control even without my change due to the compression. This is just a synthetic workload, from that perspective I consider it optimal solution for load testing. If we want real workload then glutton is not designed for it.

Later edit:

If we use random data in the inherent then we increase the PoV size further. I haven't checked yet to see if we hit max PoV size before max block size with this random data.

@bkchr
Copy link
Member

bkchr commented Jun 7, 2024

If we use random data in the inherent then we increase the PoV size further. I haven't checked yet to see if we hit max PoV size before max block size with this random data.

I mean we don't need to fill it perfectly. We also should not try to "predict" this, but using some more random data, would be a better reproduction.

@burdges
Copy link

burdges commented Jun 7, 2024

We definitely cannot pad with zeros since some compression occurs. Actual parablocks create Merkle proofs when they access state, so the bandwidth never winds up being independent from the computation. You could compute the Merkle root of some random data, but..

In fact, hash function compression functions have similar exucution times in the two modes: f(old_state,segment) -> new_state (blake2) or f(left,right) -> child (blake3). You could therefore just dump all this random data into blake2 once. Any big divergence from the real costs should be stuff we could better optimize anyways.

@sandreim
Copy link
Contributor Author

We definitely cannot pad with zeros since some compression occurs. Actual parablocks create Merkle proofs when they access state, so the bandwidth never winds up being independent from the computation. You could compute the Merkle root of some random data, but..

This is a synthetic workload, but yeah not going yo use zeroes afterall. I will use trash data to make sure the block length going up increases the PoV size. There will be a:” block_length” config percentage which tells how much of max block length we want to use. Extra weight left will be consumed proportionately to “storage” parameter. This way we can do up to max block length parachain blocks. If “block_length” is zero current behaviour is kept: tiny parachain blocks that fully stress the relay chain - 2s exec and 5MB PoV.

sandreim added 6 commits June 12, 2024 18:02
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim changed the title glutton: also increase parachain block size glutton: also increase parachain block length Jun 13, 2024
sandreim added 3 commits June 13, 2024 11:12
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
prdoc/pr_4728.prdoc Outdated Show resolved Hide resolved
prdoc/pr_4728.prdoc Outdated Show resolved Hide resolved
@paritytech-review-bot paritytech-review-bot bot requested a review from a team June 13, 2024 11:00
substrate/frame/glutton/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/glutton/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/glutton/src/lib.rs Show resolved Hide resolved
substrate/frame/glutton/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/glutton/src/lib.rs Show resolved Hide resolved
@ggwpez ggwpez mentioned this pull request Jun 13, 2024
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@paritytech-review-bot paritytech-review-bot bot requested a review from a team June 13, 2024 12:46
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 2/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6459568

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
substrate/frame/glutton/src/lib.rs Show resolved Hide resolved
substrate/frame/glutton/src/lib.rs Outdated Show resolved Hide resolved
sandreim added 4 commits June 17, 2024 17:24
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim enabled auto-merge June 17, 2024 14:41
sandreim added 3 commits June 17, 2024 20:11
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim added this pull request to the merge queue Jun 18, 2024
Merged via the queue into master with commit 1dc68de Jun 18, 2024
155 of 157 checks passed
@sandreim sandreim deleted the sandreim/glutton_bloat_block branch June 18, 2024 09:27
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
Glutton currently is useful mostly for stress testing relay chain
validators. It is unusable for testing the collator networking and block
announcement and import scenarios. This PR resolves that by improving
glutton pallet to also buff up the blocks, up to the runtime configured
`BlockLength`.

### How it works
Includes an additional inherent in each parachain block. The `garbage`
argument passed to the inherent is filled with trash data. It's size is
computed by applying the newly introduced `block_length` percentage to
the maximum block length for mandatory dispatch class. After
paritytech#4765 is merged, the
length of inherent extrinsic will be added to the total block proof
size.

The remaining weight is burnt in `on_idle` as configured by the
`storage` percentage parameter.


TODO:
- [x] PRDoc
- [x] Readme update
- [x] Add tests

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
sfffaaa pushed a commit to peaqnetwork/polkadot-sdk that referenced this pull request Dec 27, 2024
Glutton currently is useful mostly for stress testing relay chain
validators. It is unusable for testing the collator networking and block
announcement and import scenarios. This PR resolves that by improving
glutton pallet to also buff up the blocks, up to the runtime configured
`BlockLength`.

### How it works
Includes an additional inherent in each parachain block. The `garbage`
argument passed to the inherent is filled with trash data. It's size is
computed by applying the newly introduced `block_length` percentage to
the maximum block length for mandatory dispatch class. After
paritytech#4765 is merged, the
length of inherent extrinsic will be added to the total block proof
size.

The remaining weight is burnt in `on_idle` as configured by the
`storage` percentage parameter.


TODO:
- [x] PRDoc
- [x] Readme update
- [x] Add tests

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T10-tests This PR/Issue is related to tests. T12-benchmarks This PR/Issue is related to benchmarking and weights.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants