This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
adds keep-alive-interval to repair QUIC transport config #33866
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ use { | |
log::error, | ||
quinn::{ | ||
ClientConfig, ConnectError, Connecting, Connection, ConnectionError, Endpoint, | ||
EndpointConfig, ReadError, ReadToEndError, RecvStream, SendStream, ServerConfig, | ||
TokioRuntime, TransportConfig, VarInt, WriteError, | ||
EndpointConfig, IdleTimeout, ReadError, ReadToEndError, RecvStream, SendStream, | ||
ServerConfig, TokioRuntime, TransportConfig, VarInt, WriteError, | ||
}, | ||
rcgen::RcgenError, | ||
rustls::{Certificate, PrivateKey}, | ||
|
@@ -46,7 +46,13 @@ const CONNECT_SERVER_NAME: &str = "solana-repair"; | |
const CLIENT_CHANNEL_BUFFER: usize = 1 << 14; | ||
const ROUTER_CHANNEL_BUFFER: usize = 64; | ||
const CONNECTION_CACHE_CAPACITY: usize = 3072; | ||
|
||
// Transport config. | ||
// Repair randomly samples peers, uses bi-directional streams and generally has | ||
// low to moderate load and so is configured separately from other protocols. | ||
const KEEP_ALIVE_INTERVAL: Duration = Duration::from_secs(4); | ||
const MAX_CONCURRENT_BIDI_STREAMS: VarInt = VarInt::from_u32(512); | ||
const MAX_IDLE_TIMEOUT: Duration = Duration::from_secs(10); | ||
|
||
const CONNECTION_CLOSE_ERROR_CODE_SHUTDOWN: VarInt = VarInt::from_u32(1); | ||
const CONNECTION_CLOSE_ERROR_CODE_DROPPED: VarInt = VarInt::from_u32(2); | ||
|
@@ -195,11 +201,15 @@ fn new_client_config(cert: Certificate, key: PrivateKey) -> Result<ClientConfig, | |
} | ||
|
||
fn new_transport_config() -> TransportConfig { | ||
let max_idle_timeout = IdleTimeout::try_from(MAX_IDLE_TIMEOUT).unwrap(); | ||
let mut config = TransportConfig::default(); | ||
// Disable datagrams and uni streams. | ||
config | ||
.datagram_receive_buffer_size(None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment this to disable datagrams? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
.keep_alive_interval(Some(KEEP_ALIVE_INTERVAL)) | ||
.max_concurrent_bidi_streams(MAX_CONCURRENT_BIDI_STREAMS) | ||
.max_concurrent_uni_streams(VarInt::from(0u8)) | ||
.datagram_receive_buffer_size(None); | ||
.max_idle_timeout(Some(max_idle_timeout)); | ||
config | ||
} | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see definitions for these in
sdk/src/quic.rs
. Can you add comments about why new definitions are needed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones in sdk are used for tpu, which has very different properties than repair. In particular tpu packets are only forwarded to the upcoming leaders which we know in advance who they are, it is a uni-directional traffic, and has a very different load and latency tolerance. Repair is bi-directional request-response, peers are randomly sampled, etc.
I pretty much rather not to reuse the same parameters at this stage until this code is stable and repair over quic protocol is fully rolled out over mainnet. Until then reusing same parameters can introduce regressions on one protocol while trying to optimize another protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just add some code comments on the reasoning will help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.