← Back to the caseThe Sarthak Gupta Times · Case FilesFiled from Sonipat
Case File · Exhibit A · Distributed Systems · Real-Time Communication

The cluster that talks to itself

A horizontally scalable real-time communication system engineered to break the single-server WebSocket ceiling.

By The Investigation Desk  ·  2025 · Distributed Systems

Multi-Instance Chat — horizontally scalable real-time messaging architecture
Exhibit AFig. 1 — three Socket.IO nodes linked across a high-throughput Redis Pub/Sub backbone.

A single WebSocket server inevitably hits a hard wall when concurrent connections and message volume climb. In a distributed topology, in-memory socket state remains strictly confined to the instance holding the active TCP connection. A message emitted into Node A stays trapped in Node A; users connected to Node B and Node C never receive the broadcast.

To resolve this partition, the subject engineered a horizontally scalable backbone centered on Redis Pub/Sub. When a client transmits an event to its connected Socket.IO instance, the server publishes the payload immediately across the shared message broker. Sibling instances subscribed to the channel receive the transmission and deliver it down to their own locally connected clients in near-real-time.

“In-memory socket state is local to each instance — without Redis, half the room is deaf to the other.”

The infrastructure is packaged with Docker Compose, deploying three independent Node.js / Express backend instances behind an Nginx reverse proxy. Core engineering covers cross-instance message routing, cluster-wide typing indicators, and shared presence tracking where heartbeats expire unceremoniously if an instance drops offline.

Verification notes on file document target benchmarks: sustaining 500 to 1,000 concurrent connections, 50 to 100 messages per second, and a p95 latency under 500 milliseconds. The investigation desk records these as architectural targets under ongoing testing, rather than confirmed lab measurements.

How it was built
RuntimeNode.js · Express
Real-TimeSocket.IO
BrokerRedis Pub/Sub
ContainersDocker · Docker Compose
ProxyNginx
RoleBackend Engineer
Entered2025
StatusArchitecture on file — targets under test