BACK TOProject Archive

EP.04 / PROJECT CASE FILE / 02

Live-Stream Danmaku System

A distributed Go backend sustaining 60K+ concurrent WebSocket connections and 1.5M QPS peak broadcast throughput on one node.

GoWebSocketRedisKafka

A closer look at the problem, engineering decisions, system design, and measurable outcome.

PRIVATE REPOSITORY · DETAILS AVAILABLE ON REQUEST

01 / Context

Build a real-time live-stream danmaku backend that remains responsive under large connection counts, fan-out pressure, and bursty persistence workloads.

02 / Runtime

Used Go with Gin and Gorilla WebSocket to sustain more than 60,000 concurrent connections and 1.5 million QPS peak broadcast throughput on a single node.

03 / Concurrency

Sharded fan-out across 100 broadcast-worker goroutines, reused slices with sync.Pool to reduce GC pressure, and separated read/write locks so broadcasts never blocked connection registration.

04 / Distribution

Enabled cross-server room broadcasts through Redis Pub/Sub, tracked global online counts with TTL heartbeat keys, and served likes through atomic INCRBY counters.

05 / Persistence

Buffered writes with an asynchronous Kafka producer using Snappy compression and batch flushing; a consumer group persisted five million queued messages to MySQL within two minutes at roughly 40K QPS.

Next projectChatbot Arena Preference PredictionProject Archive