---
title: "Real-time Messaging"
description: "Slack's real-time messaging runs on four Java services: stateful in-memory Channel Servers sharded by consistent hashing, regionally deployed Gateway Servers holding websocket subscriptions, stateless Admin Servers bridging the Webapp backend, and Presence Servers tracking online users."
url: "https://swe.quest/articles/real-time-messaging-63eff1981479ebae"
canonical: "https://slack.engineering/real-time-messaging/"
source: "Slack Engineering"
published: "2023-04-11"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["realtime","system-design","distributed-systems","communications","scalability"]
---

# Real-time Messaging

A post on [Slack Engineering](https://swe.quest/sources/slack.md), published 2023-04-11, 6 min read, Case study. Original: [https://slack.engineering/real-time-messaging/](https://slack.engineering/real-time-messaging/)

## Summary

Slack's real-time messaging runs on four Java services: stateful in-memory Channel Servers sharded by consistent hashing, regionally deployed Gateway Servers holding websocket subscriptions, stateless Admin Servers bridging the Webapp backend, and Presence Servers tracking online users. Consistent hash ring managers (CHARMs) registered in Consul replace failed Channel Servers in under 20 seconds. Messages flow from Webapp to Admin Server to the owning Channel Server, which fans out to every subscribed Gateway Server worldwide. Transient events like typing indicators skip persistence and enter directly through the Gateway. The system delivers messages globally within 500ms and handles tens of millions of channels per host.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Distributed systems](https://swe.quest/tags/distributed-systems.md) (Distributed systems)
- [Communications](https://swe.quest/tags/communications.md) (Domains)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)

## Prerequisites

- consistent hashing
- WebSockets ([easy posts on Real-time systems](https://swe.quest/tags/realtime.md?difficulty=easy))
- pub/sub fan-out

## Keywords

Slack, Consul, Envoy, CHARMs, WebSocket, Hack

## Related posts

- [Slack Overflow: How We Scaled Slack to Support 1000s of Developers](https://swe.quest/articles/slack-overflow-how-we-scaled-slack-to-support-1000s-of-developers-8632014eebe803cb.md): Railway · 2025-01-23 · Medium · 9 min read · Communications, Resilience, TypeScript, Product engineering
  Railway built a two-way bridge between Slack Connect channels and its in-house Help Station support tool, auto-creating channels when customers hit growth thresholds.
- [How OpenAI delivers low-latency voice AI at scale](https://swe.quest/articles/how-openai-delivers-low-latency-voice-ai-at-scale-fa481a5234e95d30.md): OpenAI · 2026-05-04 · Hard · 13 min read · Networking, Real-time systems, Load balancing, Kubernetes, Speech & audio
  OpenAI rearchitected its WebRTC stack for ChatGPT voice and the Realtime API by splitting a stateless UDP relay from a stateful Go/Pion transceiver that owns ICE, DTLS and SRTP state.
- [Using Server Sent Events to Simplify Real-time Streaming at Scale](https://swe.quest/articles/using-server-sent-events-to-simplify-real-time-streaming-at-scale-27a5424d07541ac7.md): Shopify Engineering · 2022-11-30 · Medium · 9 min read · Real-time systems, Stream processing, Go, Scaling, Load balancing
  Shopify replaced its 2021 BFCM Live Map delivery path, in which WebSocket fed a presentation layer that clients polled through a mailbox system every 10+ seconds, with a Go Server Sent Events server.
- [Lessons learnt from building reactive microservices for Canva Live - Canva Engineering Blog](https://swe.quest/articles/lessons-learnt-from-building-reactive-microservices-for-canva-live-canva-1f351c423d5adf5b.md): Canva Engineering · 2020-10-12 · Medium · 14 min read · Real-time systems, Caching, Microservices, Scaling, System design
  Canva Live delivers near real-time audience questions to presenters through a hybrid design: presenters receive updates over WebSockets, while audience members use plain request/response APIs, all behind a gateway that multiplexes client sockets onto single connections per RPC node and uses service discovery instead of an ALB.
- [Migrating Millions of Concurrent Websockets to Envoy](https://swe.quest/articles/migrating-millions-of-concurrent-websockets-to-envoy-b99b542be70019c3.md): Slack Engineering · 2021-03-15 · Medium · 11 min read · Load balancing, Real-time systems, Deployment, Configuration management, Networking
  Slack moved its websocket ingress tier, serving millions of concurrent connections, from HAProxy to Envoy Proxy.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
