Repository navigation
Fix parakeet batch=1 throughput collapse from flush_pending early reset - #8666
Merged
Merged
Conversation
The early `self._flush_pending = False` inside `_flush_batch()` (added in PR #8535) allowed the 2ms flush timer to fire between individual request arrivals, producing batch=1 flushes instead of accumulating requests during GPU processing. Production data showed 72.8% batch=1 (avg 1.6 files/batch) causing LB 504 timeouts. Fix: remove the early reset so `_flush_pending` only resets in `_guarded_flush()`'s `finally` block, keeping the gate held during the entire GPU inference cycle. Requests accumulate while GPU is busy. Adds regression test simulating staggered arrivals with GPU latency. Updates TestMaxInflight2 to verify accumulation behavior. Closes #8664 Co-Authored-By: Claude Opus 4.6 <[email protected]>
beastoin
force-pushed
the
fix/parakeet-flush-pending-batch1-8664
branch
from
June 30, 2026 04:21
d4e730c to
ec1c84a
Compare
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Collaborator
Author
|
lgtm |
This was referenced Jun 30, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes batch=1 throughput collapse introduced in PR #8535. Production data showed 72.8% of GPU batches containing only 1 file (avg 1.6 files/batch), causing LB 504 timeouts.
Root cause: The early
self._flush_pending = Falsereset inside_flush_batch()(line 273) allowed the 2ms flush timer to fire between individual request arrivals, producing batch=1 flushes instead of accumulating requests during GPU processing.Fix: Remove the early reset so
_flush_pendingonly resets in_guarded_flush()'sfinallyblock. This keeps the gate held during the entire GPU inference cycle, letting requests accumulate while GPU is busy.Changes
batch_engine.py: Remove early_flush_pending = Falseon line 273test_flush_pending_batch1.py: New regression test — simulates staggered arrivals (20ms interval) with GPU latency (300ms), asserts batch accumulationtest_parakeet_batch_engine.py: Replacetest_two_batches_inflight_concurrently(which depended on early reset) withtest_sequential_batching_accumulates_requeststest.sh: Wire new regression test into CIRED/GREEN evidence
batches=[1, 1, 10], batch1_count=2 → FAILbatches=[1, 11], batch1_count=1 → PASSTest evidence
All 25 parakeet batch engine tests pass (24 existing + 1 new regression test). 239 total parakeet tests pass.
Changed-path coverage
batch_engine.py:_flush_batch— removed early_flush_pending=Falseresetbatches=[1, 11], avg=6.0Risks
_guarded_flushcall. This is the pre-VRAM-aware dynamic batch sizing for parakeet #8535 behavior and is correct: the semaphore still allowsmax_inflight=2concurrent GPU batches whensubmit()triggers immediate flush (queue >= max_batch_size).Closes #8664
by AI for @beastoin