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

Add blocks in batches #19003

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

Add blocks in batches #19003

wants to merge 1 commit into from

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Dec 9, 2024

These commits can be reviewed one at a time.

Purpose:

Simplify add_blocks_in_batches() to add all blocks in a single batch (this is a tiny performance boost). This is a test function.

Simplify FullNode.add_block_batch() by removing an unused (left over) parameter.

Current Behavior:

No change in behavior

New Behavior:

No change in behavior

Test

running

pytest -s -n 0 "chia/_tests/core/full_node/test_full_node.py::test_long_reorg[ConsensusMode.PLAIN-True]"

Before and after this change gives a small improvement from 42.86s -> 40.62s

@arvidn arvidn added Changed Required label for PR that categorizes merge commit message as "Changed" for changelog Tests Changes to tests labels Dec 9, 2024
@arvidn arvidn marked this pull request as ready for review December 9, 2024 14:53
@arvidn arvidn requested a review from a team as a code owner December 9, 2024 14:53
@arvidn arvidn requested a review from almogdepaz December 9, 2024 14:54
@almogdepaz
Copy link
Contributor

this is the same as
#19004 ?

@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Dec 10, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…ch (avoiding the pipeline stall every 64 blocks)
@arvidn arvidn force-pushed the add-blocks-in-batches branch from 63abf4e to 20d7681 Compare December 11, 2024 06:59
@arvidn
Copy link
Contributor Author

arvidn commented Dec 11, 2024

yes, there was overlap with that PR. I've rebased ths now

@github-actions github-actions bot removed the merge_conflict Branch has conflicts that prevent merge to main label Dec 11, 2024
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

)
await full_node.peak_post_processing_2(peak_fb, None, state_change_summary, ppp_result)
# vs is updated by the call to add_block_batch()
success, state_change_summary = await full_node.add_block_batch(blocks, PeerInfo("0.0.0.0", 0), fork_info, vs)
Copy link
Contributor

@almogdepaz almogdepaz Dec 12, 2024

Choose a reason for hiding this comment

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

we call add_blocks_in_batches sometimes with huge lists of of blocks since we expect it to batch them into validation, this seems to diverge more then what we do in the full node

also this doesn't add blocks in batches anymore, it just adds all the blocks so the name is misleading

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the number of blocks to be validated concurrently is limited by the size of the ThreadPoolExecutor and blocks are streamed into its job queue. So I don't think the size of the list is a problem, we'll do our best to maximize the available threads at all times, without stalling the pipeline every 64 blocks.

yes, I agree that this makes the name misleading. Do you have a suggestion for a better name? I think the name add_blocks() may be a bit too generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changed Required label for PR that categorizes merge commit message as "Changed" for changelog Tests Changes to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants