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

feat(congestion_control) - Make the parameters part of the runtime config #11307

Merged
merged 11 commits into from
May 17, 2024

Conversation

wacban
Copy link
Contributor

@wacban wacban commented May 14, 2024

This is part one of making the congestion control configurable. Here I'm introducing the Config and Control classes for congestion control and some refactoring. In the next part I'll actually make it properly configurable based on protocol versions. I decided to split it into smaller PRs because it's large enough as is and I'm a bit tired for today ;)

@wacban
Copy link
Contributor Author

wacban commented May 14, 2024

@jakmeier Can you have a quick look please? Finishing it will be time consuming so I want to avoid that if you have some better suggestions.

The idea is as follows:

  • CongestionInfo is only for storing and keeping track of the congestion metrics
  • ExtendedCongestionInfo mostly unchanged
  • CongestionControl implements the actual logic and relies on both CongestionInfo and CongestionControlConfig

Base automatically changed from waclaw-cc to master May 14, 2024 14:23
Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 91.48352% with 31 lines in your changes are missing coverage. Please review.

Project coverage is 71.08%. Comparing base (cb2859d) to head (b5fd9d2).
Report is 11 commits behind head on master.

Files Patch % Lines
core/parameters/src/parameter_table.rs 45.00% 0 Missing and 11 partials ⚠️
runtime/runtime/src/congestion_control.rs 50.00% 10 Missing ⚠️
core/primitives/src/congestion_info.rs 96.72% 9 Missing ⚠️
...me-params-estimator/src/costs_to_runtime_config.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11307      +/-   ##
==========================================
+ Coverage   71.00%   71.08%   +0.08%     
==========================================
  Files         782      783       +1     
  Lines      156476   156831     +355     
  Branches   156476   156831     +355     
==========================================
+ Hits       111099   111487     +388     
+ Misses      40553    40516      -37     
- Partials     4824     4828       +4     
Flag Coverage Δ
backward-compatibility 0.24% <0.00%> (-0.01%) ⬇️
db-migration 0.24% <0.00%> (-0.01%) ⬇️
genesis-check 1.39% <0.00%> (-0.02%) ⬇️
integration-tests 37.13% <40.93%> (-0.02%) ⬇️
linux 68.83% <32.41%> (-0.23%) ⬇️
linux-nightly 70.52% <90.10%> (+0.03%) ⬆️
macos 52.24% <30.02%> (-0.31%) ⬇️
pytests 1.61% <0.00%> (-0.02%) ⬇️
sanity-checks 1.40% <0.00%> (-0.02%) ⬇️
unittests 65.52% <91.20%> (+0.07%) ⬆️
upgradability 0.29% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jakmeier
Copy link
Contributor

Yeah this looks very reasonable to me and makes testing things much nicer. Plus, of course, future changes to the parameter values.

And yes, it's going to take some time to get everything in place with the new parameters and such. But it should be manageable. If you get stuck anywhere, don't hesitate to ping me on Zulip, as I'm quite familiar with the runtime parameter setup.

@wacban wacban requested a review from jakmeier May 15, 2024 15:31
@wacban wacban marked this pull request as ready for review May 15, 2024 15:31
@wacban wacban requested a review from a team as a code owner May 15, 2024 15:31
Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

Generally looks good to me so far to make congestion control configurable.

But the part about making it a runtime parameter is still incomplete. Personally, I would rather not do it in separate PRs in this case, because reviewing it much harder if we first merge it in "the wrong way" and are supposed to fix it later. It's just to easy to use the wrong config in some places.

core/parameters/src/config.rs Outdated Show resolved Hide resolved
core/parameters/src/config.rs Outdated Show resolved Hide resolved
core/parameters/src/config.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
core/primitives/src/congestion_info.rs Outdated Show resolved Hide resolved
@wacban wacban requested a review from jakmeier May 17, 2024 09:29
Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

Looking good now.

To pass CI, you will also need to update all the old protocol version runtime config snapshot JSON files. In case you don't know already, running the test with cargo insta test --accept allows you to update all the files once.

I think the same test also updates parameters.snap, which should already show the new parameters with the dummy values.

core/parameters/res/runtime_configs/142.yaml Show resolved Hide resolved
# 0.25
reject_tx_congestion_threshold: {
old : { numerator: 1, denominator: 1 },
new : { numerator: 25, denominator: 100 }
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe reduce it?

Suggested change
new : { numerator: 25, denominator: 100 }
new : { numerator: 1, denominator: 4 }

But I don't know, maybe percentage is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally I like % a bit more

core/parameters/src/config.rs Outdated Show resolved Hide resolved
core/parameters/src/config.rs Outdated Show resolved Hide resolved
@wacban wacban added this pull request to the merge queue May 17, 2024
Merged via the queue into master with commit 985bdce May 17, 2024
29 checks passed
@wacban wacban deleted the waclaw-cc-config branch May 17, 2024 15:10
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.

2 participants