← All projects

Team project · Distributed systems

Distributed Instant Messaging Platform

Java · Spring Cloud · Netty · WebSocket · ZooKeeper · RabbitMQ · Redis · MinIO

Problem
Real-time messaging at high concurrency
Architecture
Spring Cloud services + Netty WebSocket cluster
Guarantees
Ordered, lossless delivery; zero-downtime releases
Scale
80k–120k concurrent connections
Architecture: clients connect to a Netty WebSocket cluster discovered through ZooKeeper; RabbitMQ fans messages out to Spring Cloud services backed by Redis, relational databases, and MinIO.
Figure 1. Architecture. Clients connect to a Netty WebSocket cluster discovered through ZooKeeper; RabbitMQ fans messages out to Spring Cloud services backed by Redis, relational databases, and MinIO.

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

Table 1. Components and their roles.
LayerTechnologyRole
Connection tierNetty, WebSocketHorizontally scalable cluster holding client connections
ServicesJava Spring CloudStateless microservices for messaging and social features
DiscoveryZooKeeperTracks the stateful Netty nodes and routes users to them
MessagingRabbitMQFan-out routing, tuned for low intra-cluster latency
SessionsRedisDistributed session state and failover recovery
StorageMinIO, relational DBMultimedia objects and relational data
DeploymentContainersRolling 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

Table 2. Measured performance.
MetricValueCondition
Concurrent connections80k–120k–
Message throughput15k–25k msg/sBursts, in order, no loss
Intra-cluster latency (p95)40–70 msHigh concurrency
Release downtimeNoneRolling upgrades