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

Add burst mode for congestion control #20631

Merged
merged 4 commits into from
Dec 30, 2024
Merged

Add burst mode for congestion control #20631

merged 4 commits into from
Dec 30, 2024

Conversation

aschran
Copy link
Contributor

@aschran aschran commented Dec 13, 2024

Description

Burst mode allows budget to be exceeded up to the configured burst limit.

Test plan

added/updated unit tests


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@aschran aschran requested a review from halfprice December 13, 2024 23:15
@aschran aschran requested a review from mystenmark as a code owner December 13, 2024 23:15
Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:43pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 11:43pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 11:43pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Dec 20, 2024 11:43pm

@aschran aschran temporarily deployed to sui-typescript-aws-kms-test-env December 13, 2024 23:15 — with GitHub Actions Inactive
/// If >0, congestion control will allow transactions in total cost equaling the
/// configured amount to exceed the configured maximum accumulated cost per object.
/// As above, up to one transaction per object exceeding the burst limit will be allowed.
allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
Copy link
Contributor

Choose a reason for hiding this comment

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

when we discussed this last, we seemed to have settled on the mental model that the two params could be thought of as "the rate at which scheduling debt is paid down" and "the debt ceiling"

i think this model is much clearer, because i'm having trouble understanding your comments above even though I at least think I understand the system.

Copy link
Contributor Author

@aschran aschran Dec 20, 2024

Choose a reason for hiding this comment

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

it's slightly complicated by the requirement to maintain prior behavior when the new param is not set

  1. max_accumulated_txn_cost_per_object_in_commit
  • is always the rate at which debt is paid down
  • also the absolute limit, if it's the only thing set
  1. max_txn_cost_overage_per_object_in_commit
    if set with 1,
  • soft debt ceiling is 1
  • absolute limit is 1+2
    (this is how it is currently configured to work, with 2 == u64 max)
  1. allowed_txn_cost_overage_burst_per_object_in_commit
    if set with 1 and 2 (must be <= 2 per assert)
  • soft debt ceiling is 1+3
  • absolute limit is still 1+2

Copy link
Contributor

@halfprice halfprice left a comment

Choose a reason for hiding this comment

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

LGTM! But I see there is an open discussion with @mystenmark , so probably should wait for him to take a look again.

let absolute_limit = self
.max_accumulated_txn_cost_per_object_in_commit
.saturating_add(self.max_txn_cost_overage_per_object_in_commit);
if start_cost <= burst_limit && end_cost <= absolute_limit {
Copy link
Contributor

Choose a reason for hiding this comment

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

In a scenario where there is a consistent congestion, after the absolute_limit is hit and it starts to defer transactions, it won't wait until all the debts are paid off and then admit new transactions, but as soon as start_cost <= burst_limit is true, then it will admit new transactions, is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, we decided that method would be the hardest to attack.

PS. absolute_limit would never be hit with current settings, which have self.max_txn_cost_overage_per_object_in_commit set to u64::MAX

@@ -2226,6 +2232,8 @@ impl ProtocolConfig {

max_txn_cost_overage_per_object_in_commit: None,

allowed_txn_cost_overage_burst_per_object_in_commit: None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it expect that we don't set it yet in a protocol config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, as a matter of principle I try to configure protocol config in a separate PR from the one that adds the feature

@aschran aschran merged commit 1013f93 into main Dec 30, 2024
53 of 54 checks passed
@aschran aschran deleted the aschran/cc-bursts branch December 30, 2024 17:49
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.

3 participants