-
Notifications
You must be signed in to change notification settings - Fork 71
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
[5.0 -> main] Support throttling block syncing to peers #1742
Merged
+924
−237
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add necessary custom topology for p2p_sync_throttle_test.
Clarify variable names in p2p throttled sync test and tweak numbers. Fix p2p throttled test to actually function (waitForBlock has a hidden default timeout). Bump up timeout in block_log_util_test.
Remove exponential backoff in throttle and utilize existing retry mechanism.
Fix parsing and overflow problems and address peer review comments. Extend throttle test to add another throttle prefix.
Added additional code comments. Addressed peer review comment.
Update connections_manager::add method. Clean up cruft and rename connection data structure back to 'connections'.
Loading status checks…
…call.
Address peer review comments.
Loading status checks…
Loading status checks…
Add mock_connection constructor required by clang14.
…peers." This reverts commit df6d948.
Loading status checks…
Loading status checks…
Split prometheus statistics out of connection_monitor into connection_statistics_monitor.
Loading status checks…
Loading status checks…
Remove dependency on python requests package. Remove locale-aware parsing of sync throttle rate. Prevent transmitting peer from throttling while not in sync mode. Add timeouts to throttle sync test.
This reverts commit caa703d.
Loading status checks…
[5.0] Support throttling block syncing to peers
Loading status checks…
…tle-main
jgiszczak
approved these changes
Oct 10, 2023
dimas1185
approved these changes
Oct 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Peer to peer listen ports may now apply a block sync throttle. Each occurrence of
p2p-listen-endpoint
has an independent throttle specification. Here's the updated help text:Parsing of the rate cap accepts fractional numbers expressed as decimals. The throttle rate is in bytes per second. Per the help text, shorthand suffixes are supported, and transactions and blocks being propagated across the peer to peer network between synchronized nodes are not throttled. Only blocks transmitted to a syncing node are throttled. A throttle of
0
or0B/s
means unthrottled, and is the default.The limit for specifying a rate cap is 30 characters, including the colon field separator. This is sufficient characters to specify any value in the 64 bit range of
size_t
with room left for a suffix. If the rate cap does not parse or the value multiplied by the suffix exceeds 18,446,744,073,709,551,615 an exception will be thrown and the node will not start.IPv6 addresses are supported for listen endpoints. They must be in square bracket format:
[<ipv6 address>]:port
optionally followed by:<rate-cap>
.Note
Inbound connections from IPs which are configured
p2p-peer-address
es are exempt from throttle rate caps. Care should be taken in NAT environments to avoid inadvertently exempting connections due to overlapping subnets.Throttling is stable even at exceptionally low byterates, but of course on a busy network if the throttle is less than the average block size on the network, clients using that listen port will never catch up to the head block. Such configurations are allowed but not recommended.
Suggested network topology
Together with #1411 which allows multiple listen endpoints, an edge node for public peering might be configured as follows:
Merges
release/5.0
intomain
including #1741Resolves #1295.