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

dynamic block time modifications #983

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

cmwaters
Copy link
Contributor

Description

Some data from a 4 validator network under transaction load with a 5 second target height:

Chain: simple-xUmLu2
Block Time:
        Average: 5.00s
        Min: 4.67s
        Max: 5.31s
        Standard Deviation: 0.112s

Transactions:
        Bytes per Block: 10219.52
        Transactions per Block: 9.98

Would be good to test this under "realistic" network environments i.e. most likely with testground.


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use
    unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

@cmwaters
Copy link
Contributor Author

cmwaters commented Mar 20, 2023

It looks like the volatility is worse when one reduces the target time down to 2 seconds

Chain: simple-t4oShG
Block Time:
        Average: 2.00s
        Min: 1.15s
        Max: 2.92s
        Standard Deviation: 0.566s

Transactions:
        Bytes per Block: 4096.00
        Transactions per Block: 4.00

EDIT: Maybe I just got lucky the first run. It seems the standard deviation is around 0.5s

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

dooope thanks 🙂

Comment on lines -674 to +671
elapsed := cs.CommitTime.Sub(cs.StartTime)
nst := cs.config.TargetHeightDuration - elapsed
if nst < time.Millisecond*1 || elapsed < 0 {
nst = time.Millisecond * 1
}
cs.eventCollector.WritePoint("consensus", map[string]interface{}{
"elapsed_info": []interface{}{cs.Height, cs.Round, elapsed, nst},
})
cs.StartTime = cs.CommitTime.Add(nst)
cs.StartTime = cs.config.NextStartTime(cs.StartTime)
Copy link
Member

Choose a reason for hiding this comment

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

thanks for refactoring this back, I was meaning to move the logic back to NextStartTime

Comment on lines -970 to +976
TimeoutPropose: 3000 * time.Millisecond,
TimeoutPropose: 2000 * time.Millisecond,
TimeoutProposeDelta: 500 * time.Millisecond,
TimeoutPrevote: 1000 * time.Millisecond,
TimeoutPrevoteDelta: 500 * time.Millisecond,
TimeoutPrecommit: 1000 * time.Millisecond,
TimeoutPrecommitDelta: 500 * time.Millisecond,
TargetHeightDuration: 3500 * time.Millisecond,
TargetHeightDuration: 3000 * time.Millisecond,
Copy link
Member

Choose a reason for hiding this comment

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

are these needed for the e2e test to pass or just arbitrary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to make it smaller / quicker. Have not strong feelings on what these are set to

@evan-forbes
Copy link
Member

when increasing the target time, the volatility seems to decrease! I'm seeing ~.2s in variation for 6s target time, but could just be my machine

@cmwaters
Copy link
Contributor Author

when increasing the target time, the volatility seems to decrease! I'm seeing ~.2s in variation for 6s target time, but could just be my machine

Yeah I think we need to look over a longer range of time (and ideally with 100 nodes and a semi-decent load to see if those factors make an influence)

@cmwaters cmwaters merged commit 7845254 into evan/dynamic-timeout-commits Mar 21, 2023
@cmwaters cmwaters deleted the cal/dynamic-timeout-commits branch March 21, 2023 09:29
evan-forbes added a commit that referenced this pull request Apr 20, 2023
…#965)

* feat!: consider time already elapsed when waiting after the commit

* chore: minor doc changes

* chore: try a different default config time

* chore: try increasing the config again

* fix: use appropriate default time

* fix: docs

* chore: simplify addition and rename

* chore: revert pointless go mod tidy change

* chore: consistent config

* chore: replace config comments

* chore: fix a few remaining round -> height name changes

* fix: lingering compile errors from merge

* fix: silly bug

* fix: use correct next start time

* dynamic block time modifications (#983)

* chore: remove event collector

* Update test/maverick/consensus/state.go

Co-authored-by: Callum Waters <[email protected]>

* Update test/maverick/consensus/state.go

Co-authored-by: Callum Waters <[email protected]>

* chore: formatting

---------

Co-authored-by: Callum Waters <[email protected]>
cmwaters pushed a commit that referenced this pull request Sep 20, 2023
* Add `CMT_HOME` (or remove it?) (#983)

Closes #982

Added `CMT_HOME` everywhere `CMTHOME` is used.

### Notes to reviewers

This could be fixed the opposite way, by removing the only reference to `CMT_HOME` in the code, and also the reference in `UPGRADING.md` (two lines of code).

However, the reference in `UPGRADING.md`, which is part of our documentation, is already present in `v0.34.x` (not in `v0.37.x` though!). That's why this PR introduces `CMT_HOME` to work in equal conditions as `CMTHOME`.

If reviewers lean toward removing `CMT_HOME` from the doc in `v0.34.x` (and unreleased `v0.38.x` and `main`), I can do it easily.

---

#### PR checklist

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments

(cherry picked from commit b7be568)

# Conflicts:
#	cmd/cometbft/commands/root_test.go

* Revert "Add `CMT_HOME` (or remove it?) (#983)"

* Add `CMT_HOME` (or remove it?) (#983)

Closes #982

Added `CMT_HOME` everywhere `CMTHOME` is used.

This could be fixed the opposite way, by removing the only reference to `CMT_HOME` in the code, and also the reference in `UPGRADING.md` (two lines of code).

However, the reference in `UPGRADING.md`, which is part of our documentation, is already present in `v0.34.x` (not in `v0.37.x` though!). That's why this PR introduces `CMT_HOME` to work in equal conditions as `CMTHOME`.

If reviewers lean toward removing `CMT_HOME` from the doc in `v0.34.x` (and unreleased `v0.38.x` and `main`), I can do it easily.

---

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments

---------

Co-authored-by: Sergio Mena <[email protected]>
cmwaters added a commit that referenced this pull request Jun 7, 2024
…#965)

* feat!: consider time already elapsed when waiting after the commit

* chore: minor doc changes

* chore: try a different default config time

* chore: try increasing the config again

* fix: use appropriate default time

* fix: docs

* chore: simplify addition and rename

* chore: revert pointless go mod tidy change

* chore: consistent config

* chore: replace config comments

* chore: fix a few remaining round -> height name changes

* fix: lingering compile errors from merge

* fix: silly bug

* fix: use correct next start time

* dynamic block time modifications (#983)

* chore: remove event collector

* Update test/maverick/consensus/state.go

Co-authored-by: Callum Waters <[email protected]>

* Update test/maverick/consensus/state.go

Co-authored-by: Callum Waters <[email protected]>

* chore: formatting

---------

Co-authored-by: Callum Waters <[email protected]>
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