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

P2P sync ahead while applying received blocks #1225

Merged
merged 8 commits into from
Jun 5, 2023
Merged

Conversation

heifner
Copy link
Member

@heifner heifner commented Jun 2, 2023

Continue syncing the next sync-fetch-span while apply current range of synced blocks. It is prevented from running too far ahead of head by sync-fetch-span. It does queue up to double the amount of blocks during syncing than before this PR.

Before this PR:

[ sync blks A ]             [ sync blks B ]             [ sync blks C ]
    [ apply blocks A.. ... ]    [ apply blocks B.. ... ]    [ apply blocks C.. ... ]

After this PR:

[ sync blks A ][ sync blks B ][ sync blks C ]       [ sync blks D ]         [ sync blks E ]
    [ apply blocks A.. ... ][ apply blocks B.. ... ][ apply blocks C.. ... ][ apply blocks D.. ... ]

On my machine syncing into EOS mainnet, I was able to maintain 100% CPU while syncing.

Includes a fix for excessive handshake messages during syncing.

Resolves #1072

@heifner heifner requested review from greg7mdp and vladtr June 2, 2023 16:46
@heifner heifner added the OCI Work exclusive to OCI team label Jun 2, 2023
@heifner heifner added this to the Leap v5.0.0-rc1 milestone Jun 2, 2023
@greg7mdp
Copy link
Contributor

greg7mdp commented Jun 4, 2023

Why do we use c->peer_lib_num at line 1851, and last_handshake_recv.last_irreversible_block_num 8 lines below?

@heifner
Copy link
Member Author

heifner commented Jun 5, 2023

Why do we use c->peer_lib_num at line 1851, and last_handshake_recv.last_irreversible_block_num 8 lines below?

peer_lib_num is only valid to access from the connection strand, so can't use it on line 1859.

plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
@greg7mdp

This comment was marked as resolved.

@heifner heifner merged commit d04757a into main Jun 5, 2023
@heifner heifner deleted the GH-1072-sync-ahead branch June 5, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P2P Improve sync behavior
3 participants