Skip to content

perf(consensus): Run broadcast routines out of process (backport #3180)#3477

Merged
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-3180
Jul 10, 2024
Merged

perf(consensus): Run broadcast routines out of process (backport #3180)#3477
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-3180

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 10, 2024

Run broadcast routines out of process. Right now each broadcast routine blocks the consensus mutex for roughly num_peers * process_creation_time, which is genuinely notable! This PR reduces the consensus blocking overhead to just be process_creation_time.

On the latest osmosis branch with improvements, thats 20s of blocking time out of 140s (over the course of 1 hour. This 140s includes block execution!)
image

Note that WAL write time should go significantly down with open PR's. For HasVote, this is a meaningful increase to consensus mutex lock time, so its worth reducing.


PR checklist

  • Tests written/updated - I can't think of any test to add
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments - I don't know of any related docs here
  • Title follows the Conventional Commits spec

This is an automatic backport of pull request #3180 done by [Mergify](https://mergify.com).

Run broadcast routines out of process. Right now each broadcast routine
blocks the consensus mutex for roughly `num_peers *
process_creation_time`, which is genuinely notable! This PR reduces the
consensus blocking overhead to just be `process_creation_time`.

On the latest osmosis branch with improvements, thats 20s of blocking
time out of 140s (over the course of 1 hour. This 140s includes block
execution!)

![image](https://github.com/cometbft/cometbft/assets/6440154/4c202988-a0d1-460e-89bc-7c1be11fd36f)

Note that WAL write time should go significantly down with open PR's.
For `HasVote`, this is a meaningful increase to consensus mutex lock
time, so its worth reducing.

---

#### PR checklist

- [x] Tests written/updated - I can't think of any test to add
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments - I don't know of any related docs here
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 110817b)

# Conflicts:
#	.changelog/unreleased/improvements/3180-lower-broadcasts-consensus-overhead.md
#	internal/consensus/reactor.go
@mergify mergify bot requested a review from a team as a code owner July 10, 2024 09:37
@mergify mergify bot added the conflicts label Jul 10, 2024
@mergify mergify bot requested a review from a team July 10, 2024 09:37
@mergify

This comment was marked as resolved.

@melekes
Copy link
Collaborator

melekes commented Jul 10, 2024

NOTE: the changelog entry is already in v1.x!

@melekes melekes merged commit 8b4bcb4 into v1.x Jul 10, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-3180 branch July 10, 2024 10:43
ValarDragon added a commit to osmosis-labs/cometbft that referenced this pull request Aug 19, 2024
…tbft#3180) (cometbft#3477)

Run broadcast routines out of process. Right now each broadcast routine
blocks the consensus mutex for roughly `num_peers *
process_creation_time`, which is genuinely notable! This PR reduces the
consensus blocking overhead to just be `process_creation_time`.

On the latest osmosis branch with improvements, thats 20s of blocking
time out of 140s (over the course of 1 hour. This 140s includes block
execution!)

![image](https://github.com/cometbft/cometbft/assets/6440154/4c202988-a0d1-460e-89bc-7c1be11fd36f)

Note that WAL write time should go significantly down with open PR's.
For `HasVote`, this is a meaningful increase to consensus mutex lock
time, so its worth reducing.

---

#### PR checklist

- [x] Tests written/updated - I can't think of any test to add
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments - I don't know of any related docs here
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#3180 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
ValarDragon added a commit to osmosis-labs/cometbft that referenced this pull request Aug 19, 2024
…tbft#318… (#135)

* perf(consensus): Run broadcast routines out of process (backport cometbft#3180) (cometbft#3477)

Run broadcast routines out of process. Right now each broadcast routine
blocks the consensus mutex for roughly `num_peers *
process_creation_time`, which is genuinely notable! This PR reduces the
consensus blocking overhead to just be `process_creation_time`.

On the latest osmosis branch with improvements, thats 20s of blocking
time out of 140s (over the course of 1 hour. This 140s includes block
execution!)

![image](https://github.com/cometbft/cometbft/assets/6440154/4c202988-a0d1-460e-89bc-7c1be11fd36f)

Note that WAL write time should go significantly down with open PR's.
For `HasVote`, this is a meaningful increase to consensus mutex lock
time, so its worth reducing.

---

#### PR checklist

- [x] Tests written/updated - I can't think of any test to add
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments - I don't know of any related docs here
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#3180 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* add back  has vote message broadcast

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
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