Skip to content
All projects

Go Concurrent Streamlink Orchestrator

A highly concurrent Go orchestrator that leverages goroutines and the Context API to manage multiple proxied Streamlink subprocesses for automated HLS stream viewing.

Tech stack

Languages
Frameworks & libraries

Performance & metrics

  • Eliminates heavy browser rendering overhead by piping raw HLS streams directly into hardware-accelerated mpv instances
  • Context-bound execution ensures an immediate $O(1)$ teardown signal across all active subprocesses, strictly preventing memory leaks

Why I built it

Generating concurrent viewing sessions for platforms like Twitch or Kick involves strict memory constraints and complex proxy routing. Instead of relying on bloated browser automation tools like Puppeteer or Selenium, I engineered this native Go utility. It automates the lifecycle of multiple low-latency streamlink instances, ensuring fault-tolerant proxy rotation and dynamic window management with minimal system overhead.

Architecture & decisions

The orchestrator is built entirely on Go's concurrency primitives (goroutines and sync.WaitGroup). It dispatches worker threads that spawn streamlink subprocesses via exec.CommandContext. Process lifecycles and graceful teardowns (catching SIGTERM/SIGINT) are strictly managed through Go's context tree, guaranteeing no zombie processes are left behind. The engine dynamically calculates X/Y spatial geometry for cascading mpv windows and forces cacheless, low-latency playback profiles to drastically reduce RAM consumption per node.

Key features

  1. 01Goroutine-based worker pool with context-aware subprocess termination and synchronization
  2. 02Dynamic proxy rotation (SOCKS5/HTTP) injected directly into Streamlink execution arguments
  3. 03Automated spatial geometry calculation preventing overlapping mpv window instances
  4. 04Robust OS signal interruption handling for clean, global teardown of all child processes