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

Client grace period is configurable. #2837

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

christos-h
Copy link
Contributor

Motivation

The grace period, which is the amount of time we wait for validators to respond after achieving a quorum, is hard coded to 20% which is not optimal for all client use-cases, i.e. when optimising for low latency.

Proposal

Make the grace period configurable as a client option.

Test Plan

Tested manually. 20% improvement (when set to 0) in performance in non-ideal networks, that is, networks which have one or more validators which are slower than a quorum.

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

@christos-h christos-h marked this pull request as draft November 7, 2024 13:42
@christos-h christos-h force-pushed the grace-period-is-configurable branch from b333caf to c12fbb0 Compare November 7, 2024 13:48
@christos-h
Copy link
Contributor Author

christos-h commented Nov 7, 2024

I'm torn on making a GracePeriod struct or not:

struct GracePeriod(f64);

impl Default for GracePeriod {
   fn default() -> Self {
      Self(0.1)
   }
}

// etc...

@christos-h christos-h force-pushed the grace-period-is-configurable branch from c12fbb0 to 9b0c33f Compare November 7, 2024 13:52
@christos-h christos-h marked this pull request as ready for review November 7, 2024 14:10
@@ -161,7 +159,7 @@ where
&& (highest_key_score >= committee.quorum_threshold()
|| highest_key_score + remaining_votes < committee.quorum_threshold())
{
end_time = Some(Instant::now() + start_time.elapsed().mul_f64(GRACE_PERIOD));
end_time = Some(Instant::now() + start_time.elapsed().mul_f64(grace_period));
Copy link
Contributor

Choose a reason for hiding this comment

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

We could do this only in the first case (i.e. if we did reach a quorum).

FYI I created #2836 for this.

@@ -135,6 +135,9 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
Don't include any messages in blocks, and don't make any decision whether to accept or reject

* `--restrict-chain-ids-to <RESTRICT_CHAIN_IDS_TO>` — A set of chains to restrict incoming messages from. By default, messages from all chains are accepted. To reject messages from all chains, specify an empty string
* `--grace-period <GRACE_PERIOD>` — The amount of time we wait for additional validators to contribute to the result, as a fraction of how long it took to reach a quorum

Default value: `0.1`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please let's keep the current value 0.2.

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