Skip to content

fix(pipeline): idle poll flood, data streak breaks, tuning#1309

Merged
therealaleph merged 5 commits into
therealaleph:mainfrom
yyoyoian-pixel:tune/optimist-elevation-stun-defaults
May 19, 2026
Merged

fix(pipeline): idle poll flood, data streak breaks, tuning#1309
therealaleph merged 5 commits into
therealaleph:mainfrom
yyoyoian-pixel:tune/optimist-elevation-stun-defaults

Conversation

@yyoyoian-pixel
Copy link
Copy Markdown
Contributor

@yyoyoian-pixel yyoyoian-pixel commented May 19, 2026

Summary

Fixes the v1.9.28+ pipelining regression where the request counter rapidly increases, Instagram videos fail to load, and 15 deployments is slower than 6 with the old code.

Tuning changes

  • INFLIGHT_OPTIMIST 2 (unchanged): optimistic starting depth stays at 2
  • INFLIGHT_ACTIVE 4 (unchanged): max pipeline depth stays at 4
  • Upload overflow +4 → +2: tighter cap on extra in-flight upload ops
  • MAX_ELEVATED 30-per-deployment → 10 total: flat elevation cap across all deployments
  • block_stun default truefalse: STUN/TURN traffic allowed by default

Pipeline regression fixes

  1. Escalating keepalive backoff (20ms→80ms→200ms→500ms→2s) when pipeline drains to zero in-flight. The pre-pipelining serial loop had this; the new loop sent polls with zero delay, flooding idle sessions.
  2. Suppress refill timer at IDLE depth with consecutive empties — the keepalive path with backoff handles that; the refill timer was scheduling empty polls every ~1s regardless.
  3. Stale empty-poll replies don't break data streaks — a poll queued before data started flowing returns empty as expected. Previously it incremented consecutive_empty and reset consecutive_data mid-stream, causing premature depth drops that killed video streaming throughput (Instagram).
  4. Reduce upload overflow +4→+2 — upload reads were inflating request count beyond the pipeline depth budget.

Root cause

The old serial loop (pre-v1.9.28) sent one request at a time with escalating backoff (20ms→80ms→200ms→500ms→30s). Idle sessions cost essentially zero requests. The new pipelined loop had no backoff on empty keepalive polls and kept the refill timer firing every 1s at all depths, generating continuous empty requests across all sessions. With 15 deployments × many sessions × no backoff = quota exhaustion.

Test plan

  • Verify request counter growth rate is comparable to pre-v1.9.28 on idle sessions
  • Confirm Instagram videos load and stream without stalling
  • Verify 15 deployments performs at least as well as 6 deployments with old code
  • Check pipeline ramps up to depth 4 on sustained data flows
  • Verify elevation cap limits total elevated sessions to 10

🤖 Generated with Claude Code

@yyoyoian-pixel yyoyoian-pixel changed the title tune: optimist=1, max elevation=2, STUN enabled by default tune: optimist=1, max inflight=2, elevation=10 total, STUN enabled May 19, 2026
@yyoyoian-pixel yyoyoian-pixel changed the title tune: optimist=1, max inflight=2, elevation=10 total, STUN enabled fix(pipeline): idle poll flood, data streak breaks, tuning May 19, 2026
@github-actions github-actions Bot added the type: fix fix: PR — auto-applied by release-drafter label May 19, 2026
@yyoyoian-pixel yyoyoian-pixel force-pushed the tune/optimist-elevation-stun-defaults branch 3 times, most recently from 7952f6a to d5f262a Compare May 19, 2026 17:11
@yyoyoian-pixel yyoyoian-pixel changed the title fix(pipeline): idle poll flood, data streak breaks, tuning fix(pipeline): tuning codefull, fixes the full mode multi deployment quota May 19, 2026
@yyoyoian-pixel yyoyoian-pixel changed the title fix(pipeline): tuning codefull, fixes the full mode multi deployment quota fix(pipeline): idle poll flood, data streak breaks, tuning May 19, 2026
@yyoyoian-pixel yyoyoian-pixel force-pushed the tune/optimist-elevation-stun-defaults branch from cb9f42d to dd56f9c Compare May 19, 2026 17:18
yyoyoian-pixel and others added 5 commits May 19, 2026 19:22
- INFLIGHT_OPTIMIST 2→1: reduce initial pipeline depth
- MAX_ELEVATED_PER_DEPLOYMENT 30→2: tighten elevation cap
- block_stun default true→false: allow STUN/TURN by default

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- MAX_ELEVATED_PER_DEPLOYMENT → MAX_ELEVATED_TOTAL = 10: flat cap
  across all deployments instead of multiplied per script
- INFLIGHT_ACTIVE 4→2: lower max pipeline depth

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three root-cause fixes for the v1.9.28+ pipelining regression where
request count explodes and Instagram videos fail to load:

1. Escalating keepalive backoff (20ms→80ms→200ms→500ms→2s) when the
   pipeline drains to zero in-flight and consecutive empties grow.
   The pre-pipelining serial loop had this; the new loop sent polls
   with zero delay, flooding idle sessions.

2. Suppress refill timer at IDLE depth with consecutive empties — the
   keepalive path with backoff handles that; the refill timer was
   scheduling new polls every 1s regardless.

3. Stale empty-poll replies no longer break active data streaks. A
   poll queued before data started flowing returns empty as expected;
   now it won't increment consecutive_empty or reset consecutive_data
   during a streak — fixing premature depth drops that killed video
   streaming throughput.

4. Reduce can_read overflow from +4 to +1 extra in-flight slot to
   stop upload reads from inflating request count beyond the pipeline
   depth budget.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yyoyoian-pixel yyoyoian-pixel force-pushed the tune/optimist-elevation-stun-defaults branch from dd56f9c to e1014ef Compare May 19, 2026 17:23
Copy link
Copy Markdown
Owner

@therealaleph therealaleph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally on current head e1014ef57ff5ab58046c15435afde5f2dc54ede0.

Passed:

  • cargo test --lib
  • cargo build --release
  • cargo build --bin mhrv-rs-ui --release --features ui
  • JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" ANDROID_HOME="$HOME/Library/Android/sdk" ./gradlew :app:assembleDebug

Approved for merge.


Answered via LLM, Supervised @therealaleph

@therealaleph therealaleph merged commit 7407f34 into therealaleph:main May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix fix: PR — auto-applied by release-drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants