Skip to content

Commit d5f262a

Browse files
yyoyoian-pixelclaude
authored andcommitted
tune: INFLIGHT_ACTIVE=4, upload overflow +4→+2
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d5dc27d commit d5f262a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/tunnel_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const INFLIGHT_OPTIMIST: usize = 1;
7373

7474
/// Maximum pipeline depth when data is actively flowing. Ramps up on
7575
/// data-bearing replies, drops back to IDLE after consecutive empties.
76-
const INFLIGHT_ACTIVE: usize = 2;
76+
const INFLIGHT_ACTIVE: usize = 4;
7777

7878
/// How many consecutive empty replies before dropping from active to idle depth.
7979
const INFLIGHT_COOLDOWN: u32 = 3;
@@ -1675,9 +1675,9 @@ async fn tunnel_loop(
16751675
}
16761676

16771677
// Can we read from the client? Yes if not closed, not eof, and
1678-
// we have room for more inflight ops (allow +1 extra for upload
1679-
// data that shouldn't wait for a slot — but not +4 which floods).
1680-
let can_read = !client_closed && !eof_seen && inflight.len() < max_inflight + 1;
1678+
// we have room for more inflight ops (+2 extra for upload data
1679+
// so it doesn't wait for a full pipeline drain).
1680+
let can_read = !client_closed && !eof_seen && inflight.len() < max_inflight + 2;
16811681

16821682
tokio::select! {
16831683
biased;
@@ -1904,8 +1904,8 @@ async fn tunnel_loop(
19041904
let (meta, reply_rx) = send_data_op(sid, data, &mut next_send_seq, &mut next_data_write_seq, mux);
19051905
consecutive_empty = 0;
19061906
inflight.push(wrap_reply(meta, reply_rx));
1907-
} else if inflight.len() < max_inflight + 1 {
1908-
// One extra slot for upload data so it doesn't
1907+
} else if inflight.len() < max_inflight + 2 {
1908+
// Two extra slots for upload data so it doesn't
19091909
// wait for a full pipeline drain.
19101910
let (meta, reply_rx) = send_data_op(sid, data, &mut next_send_seq, &mut next_data_write_seq, mux);
19111911
consecutive_empty = 0;

0 commit comments

Comments
 (0)