Backend Development 13 min read

Design and Optimization of Bilibili Live Chat (GOIM) System

The article presents a detailed overview of Bilibili's GOIM live chat architecture, covering its high‑stability, high‑availability, low‑latency design, component breakdown, memory and module optimizations, network improvements, and performance testing results to achieve scalable real‑time messaging.

Architecture Digest
Architecture Digest
Architecture Digest
Design and Optimization of Bilibili Live Chat (GOIM) System

This article summarizes the best‑practice presentation by Bilibili architect Liu Ding on the design of the GOIM live chat service, emphasizing the three essential qualities for a live‑streaming bullet‑screen system: high stability, high availability, and low latency.

GOIM consists of several modules: Client, Comet (maintains long‑lived connections), Logic (message processing and authentication), Router (session storage), Kafka (distributed message queue), and Jop (message distribution). The system evolved from an earlier Gopush project, adding optimizations for massive concurrent broadcasts.

Optimization efforts are divided into memory optimization (single‑allocation per message, stack‑based user memory, memory pool usage), module optimization (parallel, independent message channels, controlled goroutine counts, distributed locks), and extensive testing to validate improvements.

Performance tests in 2015 showed CPU saturation as the bottleneck with 2.44 × 10⁶ messages per second across two machines; subsequent optimizations moved memory to the stack and increased capacity to one million concurrent users on a single server, demonstrating significant throughput gains.

From 2016 onward, focus shifted to network optimization: moving from a single‑IDC deployment to multi‑IDC access, implementing user‑optimal node selection (Svrlist), monitoring drop‑rate, automatic failover of offline servers, and traffic control to manage bandwidth costs.

Further architectural refinements introduced pull‑based data collection from Comet nodes to a central hub, enhanced fault monitoring (client simulation, process profiling, whitelist logging, server load alerts), and redundancy across multiple telecom lines to improve stability and reduce packet loss.

The article concludes that continuous optimization of GOIM’s architecture—spanning memory, modules, and network—aims to provide low‑cost, high‑efficiency, and reliable live chat experiences for Bilibili users.

backend architecturelive streamingHigh AvailabilityGoKafkachat systemLow Latency
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.