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

perf(consensus/blockstore): Remove validate basic call from LoadBlock… #62

Merged
merged 1 commit into from
May 22, 2024

Conversation

ValarDragon
Copy link
Member

…Meta (backport cometbft#2964) (cometbft#2998)

Our gossip block parts routine calls Blockstore.LoadBlockMeta (as do things in blocksync). This currently takes some time due to ValidateBasic:

image

However note that we only save validated data to the blockstore. We only do it in:

Hence the validate basic time is wasted.

This should eventually just go to an LRU cache to even avoid the proto unmarshalling (as should ~everything in blockstore) but we want this anyway to reduce the computational overhead,

WRT live consensus, in main this only helps with catchup for live syncing nodes, I haven't checked on v0.47.x, but the cpuprofile suggests it may help with active block gossip time as well?


PR checklist



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

…Meta (backport cometbft#2964) (cometbft#2998)

Our gossip block parts routine calls `Blockstore.LoadBlockMeta` (as do
things in blocksync). This currently takes some time due to
ValidateBasic:

![image](https://github.com/cometbft/cometbft/assets/6440154/2f4471b0-0744-44de-ab94-4a9a4596712c)

However note that we only save validated data to the blockstore. We only
do it in:
- Commit:
https://github.com/cometbft/cometbft/blob/main/internal/consensus/state.go#L1867
- Blocksync after validation:
https://github.com/cometbft/cometbft/blob/main/internal/consensus/state.go#L1867

Hence the validate basic time is wasted.

This should eventually just go to an LRU cache to even avoid the proto
unmarshalling (as should ~everything in blockstore) but we want this
anyway to reduce the computational overhead,

WRT live consensus, in main this only helps with catchup for live
syncing nodes, I haven't checked on v0.47.x, but the cpuprofile suggests
it may help with active block gossip time as well?

---

#### PR checklist

- [x] Tests written/updated
- [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
- [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#2964 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Anton Kaliaev <[email protected]>
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label May 18, 2024
@PaddyMc PaddyMc added S:backport/v25 backport to the osmo-v25/v0.37.4 branch and removed Stale labels May 21, 2024
@PaddyMc PaddyMc merged commit c73455f into osmo/v0.37.4 May 22, 2024
17 of 18 checks passed
mergify bot pushed a commit that referenced this pull request May 22, 2024
…Meta (backport cometbft#2964) (cometbft#2998) (#62)

* perf(consensus/blockstore): Remove validate basic call from LoadBlockMeta (cometbft#2998) (#62)

Co-authored-by: Anton Kaliaev <[email protected]>
(cherry picked from commit c73455f)
PaddyMc pushed a commit that referenced this pull request May 23, 2024
…Meta (backport cometbft#2964) (cometbft#2998) (#62) (#66)

* perf(consensus/blockstore): Remove validate basic call from LoadBlockMeta (cometbft#2998) (#62)

Co-authored-by: Anton Kaliaev <[email protected]>
(cherry picked from commit c73455f)

Co-authored-by: Dev Ojha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S:backport/v25 backport to the osmo-v25/v0.37.4 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants