-
Notifications
You must be signed in to change notification settings - Fork 3
[Performance] Thread Pool Size Limits Segment Upload Throughput #547
Copy link
Copy link
Open
Labels
performancePerformance improvementsPerformance improvements
Description
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_workersto 64 for write-heavy workloads - Consider using
os.O_DIRECTflag 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
performancePerformance improvementsPerformance improvements