From 69530f73aa76fbca6b0aa2fbf045f3c47fb1c005 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 15 Mar 2026 17:52:45 +0000 Subject: [PATCH] fix(protocol): increase per-stream flow control window and channel buffers to improve high-RTT throughput --- changelog.md | 6 ++++++ rust/crates/remoteingress-core/src/edge.rs | 2 +- rust/crates/remoteingress-core/src/hub.rs | 2 +- rust/crates/remoteingress-protocol/src/lib.rs | 5 +++-- ts/00_commitinfo_data.ts | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 7143bfc..cdf91b1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-03-15 - 4.5.1 - fix(protocol) +increase per-stream flow control window and channel buffers to improve high-RTT throughput + +- raise the initial stream window from 256 KB to 4 MB to allow more in-flight data per stream +- increase edge and hub mpsc channel capacities from 16 to 128 to better absorb throughput under flow control + ## 2026-03-15 - 4.5.0 - feat(remoteingress-core) add per-stream flow control for edge and hub tunnel data transfer diff --git a/rust/crates/remoteingress-core/src/edge.rs b/rust/crates/remoteingress-core/src/edge.rs index f44a09d..5d666bc 100644 --- a/rust/crates/remoteingress-core/src/edge.rs +++ b/rust/crates/remoteingress-core/src/edge.rs @@ -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::>(16); + let (back_tx, mut back_rx) = mpsc::channel::>(128); let send_window = Arc::new(AtomicU32::new(INITIAL_STREAM_WINDOW)); let window_notify = Arc::new(Notify::new()); { diff --git a/rust/crates/remoteingress-core/src/hub.rs b/rust/crates/remoteingress-core/src/hub.rs index c1b386b..b99e9a6 100644 --- a/rust/crates/remoteingress-core/src/hub.rs +++ b/rust/crates/remoteingress-core/src/hub.rs @@ -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::>(16); + let (data_tx, mut data_rx) = mpsc::channel::>(128); let send_window = Arc::new(AtomicU32::new(INITIAL_STREAM_WINDOW)); let window_notify = Arc::new(Notify::new()); { diff --git a/rust/crates/remoteingress-protocol/src/lib.rs b/rust/crates/remoteingress-protocol/src/lib.rs index 937a8d8..d897d6e 100644 --- a/rust/crates/remoteingress-protocol/src/lib.rs +++ b/rust/crates/remoteingress-protocol/src/lib.rs @@ -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. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index e86edae..19b40d0 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/remoteingress', - version: '4.5.0', + version: '4.5.1', description: 'Edge ingress tunnel for DcRouter - accepts incoming TCP connections at network edge and tunnels them to DcRouter SmartProxy preserving client IP via PROXY protocol v1.' }