1Problem
An instant-messaging backend holds a long-lived connection per client, so its connection tier is stateful while its business logic is not. The system must scale both tiers horizontally, deliver messages in order and without loss under burst traffic, recover sessions when a node fails, and ship new releases without dropping connections.
2Architecture
| Layer | Technology | Role |
|---|---|---|
| Connection tier | Netty, WebSocket | Horizontally scalable cluster holding client connections |
| Services | Java Spring Cloud | Stateless microservices for messaging and social features |
| Discovery | ZooKeeper | Tracks the stateful Netty nodes and routes users to them |
| Messaging | RabbitMQ | Fan-out routing, tuned for low intra-cluster latency |
| Sessions | Redis | Distributed session state and failover recovery |
| Storage | MinIO, relational DB | Multimedia objects and relational data |
| Deployment | Containers | Rolling upgrades and horizontal scaling |
Messages enter through the connection tier and are published asynchronously; RabbitMQ fan-out delivers them to the services and back to the nodes holding each recipient. Asynchronous pipelines absorb bursts while preserving order, and Redis-held sessions let a client reconnect to any node after a failure. Containerized rolling upgrades replace nodes one at a time, so releases need no downtime.
3Results
| Metric | Value | Condition |
|---|---|---|
| Concurrent connections | 80k–120k | – |
| Message throughput | 15k–25k msg/s | Bursts, in order, no loss |
| Intra-cluster latency (p95) | 40–70 ms | High concurrency |
| Release downtime | None | Rolling upgrades |