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

[Compatible] Fix block producer long async cycle #13654

Merged
merged 5 commits into from
Sep 19, 2023

Conversation

nholland94
Copy link
Member

@nholland94 nholland94 commented Jul 19, 2023

This PR fixes a long async cycle observed on block producers. The cycle occurs whenever a block producer is staking from a non-genesis epoch ledger. The cause of the long async cycle was that we would make a complete in-memory copy of a db ledger when preparing consensus block data for the next block, rather than taking only the subset of accounts necessary to generate the proof. Making an entire in-memory copy of a db ledger was implemented calling a non-batching version of Mina_ledger.Ledger.Db.foldi, which took a very long time to load all of the data from the ledger. The performance of this ledger operation seems to vary across software versions, as the cycles we have seen in berkeley with a smaller ledger are much larger than anything we've seen on compatible versions running with the full mainnet ledger.

There are some followup tasks to further remove existing usages of Mina_ledger.Ledger.Db.foldi from the code, but this fix tackles the most immediate issue.

Fixes #13576

@nholland94 nholland94 requested review from a team as code owners July 19, 2023 07:35
@nholland94 nholland94 changed the base branch from develop to compatible July 19, 2023 07:35
@nholland94
Copy link
Member Author

!ci-build-me

@deepthiskumar
Copy link
Member

!ci-build-me

@deepthiskumar deepthiskumar changed the title Fix block producer long async cycle [Compatible] Fix block producer long async cycle Jul 25, 2023
@deepthiskumar
Copy link
Member

#13576

@ghost-not-in-the-shell
Copy link
Contributor

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor

I've tested it on devnet. The log shows that this branch would reduce the long async cycle for block producers. Previously after producing a block there would be a 5-15 seconds long async cycle. The node using this branch would only have a long async cycle of less than 1 sec.

@nholland94
Copy link
Member Author

!ci-build-me

@ghost-not-in-the-shell
Copy link
Contributor

!ci-build-me

@nholland94 nholland94 merged commit fd36ec1 into compatible Sep 19, 2023
35 of 38 checks passed
@nholland94 nholland94 deleted the fix/block-producer-long-async-cycle branch September 19, 2023 22:53
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.

None yet

4 participants