Skip to content

Parakeet: flush_pending early reset causes batch=1 throughput collapse #8664

Closed

Description

@beastoin

Summary

PR #8535 (VRAM-aware batch sizing) introduced an early _flush_pending = False reset on line 273 of batch_engine.py that causes 72.8% of GPU batches to contain only 1 file, down from 8-12 before.

Root Cause

_flush_batch() line 273 sets self._flush_pending = False immediately after popping requests from _pending — before GPU inference completes. Combined with the 2ms flush timer, this creates a rapid chain of batch=1 flushes:

  1. Timer fires (2ms), creates flush task, _flush_pending=True
  2. Flush acquires semaphore, pops 1 request, sets _flush_pending=False (line 273)
  3. 2ms later: timer fires again, creates new flush, grabs 1 request
  4. Repeat — GPU never has time to process before next flush fires

Before PR #8535: _flush_pending was only reset in _guarded_flush's finally block, staying True for the entire GPU inference time (2-5s). Requests accumulated during GPU processing → batches of 8-12.

Evidence (30 min post-deploy)

  • 500 flushes: avg=1.6 files/batch, 72.8% batch=1
  • VRAM limit=32 for ALL batches (formula is not constraining)
  • Duration probes: zero failures
  • 504s from LB timeout (30s) when queue wait exceeded threshold
  • 504s self-resolved when backlog drained; system stable but suboptimal

Fix

Remove line 273 (self._flush_pending = False inside _flush_batch). Let _flush_pending reset only in _guarded_flush's finally block, restoring pre-PR accumulation behavior. The max_inflight semaphore remains for future concurrent batching work.

Impact

  • GPU efficiency: ~4x lower throughput per batch (batch=1 vs 8-12)
  • 504s during peak load (resolved at steady state)
  • Zero OOMs (VRAM formula working correctly but never needed)

Activity

  1. added a commit that references this issue on Jun 30, 2026
    745c82b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions