fix(protocol): increase per-stream flow control window and channel buffers to improve high-RTT throughput
This commit is contained in:
@@ -625,7 +625,7 @@ async fn handle_client_connection(
|
||||
}
|
||||
|
||||
// Set up channel for data coming back from hub (capacity 16 is sufficient with flow control)
|
||||
let (back_tx, mut back_rx) = mpsc::channel::<Vec<u8>>(16);
|
||||
let (back_tx, mut back_rx) = mpsc::channel::<Vec<u8>>(128);
|
||||
let send_window = Arc::new(AtomicU32::new(INITIAL_STREAM_WINDOW));
|
||||
let window_notify = Arc::new(Notify::new());
|
||||
{
|
||||
|
||||
@@ -477,7 +477,7 @@ async fn handle_edge_connection(
|
||||
});
|
||||
|
||||
// Create channel for data from edge to this stream (capacity 16 is sufficient with flow control)
|
||||
let (data_tx, mut data_rx) = mpsc::channel::<Vec<u8>>(16);
|
||||
let (data_tx, mut data_rx) = mpsc::channel::<Vec<u8>>(128);
|
||||
let send_window = Arc::new(AtomicU32::new(INITIAL_STREAM_WINDOW));
|
||||
let window_notify = Arc::new(Notify::new());
|
||||
{
|
||||
|
||||
@@ -19,8 +19,9 @@ pub const FRAME_HEADER_SIZE: usize = 9;
|
||||
pub const MAX_PAYLOAD_SIZE: u32 = 16 * 1024 * 1024;
|
||||
|
||||
// Per-stream flow control constants
|
||||
/// Initial per-stream window size (256 KB). With 32KB frames, this allows ~8 frames in flight.
|
||||
pub const INITIAL_STREAM_WINDOW: u32 = 256 * 1024;
|
||||
/// Initial per-stream window size (4 MB). Sized for full throughput at high RTT:
|
||||
/// at 100ms RTT, this sustains ~40 MB/s per stream.
|
||||
pub const INITIAL_STREAM_WINDOW: u32 = 4 * 1024 * 1024;
|
||||
/// Send WINDOW_UPDATE after consuming this many bytes (half the initial window).
|
||||
pub const WINDOW_UPDATE_THRESHOLD: u32 = INITIAL_STREAM_WINDOW / 2;
|
||||
/// Maximum window size to prevent overflow.
|
||||
|
||||
Reference in New Issue
Block a user