Summary
The ThreadPoolExecutor for segment I/O only has 16 workers for ALL segment uploads across all streams.
Impact
Severity: HIGH
Throughput calculation:
- 50 concurrent streams × 3 qualities = 150 segments/10s = 15 segments/sec
- Each segment write takes ~200ms (50MB at 250MB/s NAS)
- 15 seg/sec × 0.2s = 3 workers busy on average
- Current capacity: 16 workers = 80 seg/sec max
This is acceptable for 200 concurrent streams but becomes a hard bottleneck at 500+ streams.
Files Affected
/api/live_ingest.py (line 66)
Recommended Fix
- Increase
max_workers to 64 for write-heavy workloads
- Consider using
os.O_DIRECT flag to bypass page cache for large segments (reduces memory pressure)
- Monitor thread pool queue depth with metrics
_io_executor = ThreadPoolExecutor(max_workers=64, thread_name_prefix="live_io")
Scaling Characteristics
- Current: 80 seg/sec max (hard limit)
- After fix: 320 seg/sec max
🤖 Generated by automated performance review
Summary
The ThreadPoolExecutor for segment I/O only has 16 workers for ALL segment uploads across all streams.
Impact
Severity: HIGH
Throughput calculation:
This is acceptable for 200 concurrent streams but becomes a hard bottleneck at 500+ streams.
Files Affected
/api/live_ingest.py(line 66)Recommended Fix
max_workersto 64 for write-heavy workloadsos.O_DIRECTflag to bypass page cache for large segments (reduces memory pressure)Scaling Characteristics
🤖 Generated by automated performance review