Scaling Real-Time Chat with Elixir’s Concurrency Model
At Discord, instant responsiveness is non-negotiable. With millions of users sending messages, reacting, and sharing memes simultaneously, the platform relies on Elixir’s concurrency model to handle this load. Each Discord server—internally called a “guild”—operates independently, allowing the system to scale horizontally. But when guilds struggle with high activity, engineers need tools to diagnose and resolve issues quickly.
Metrics, Logs, and Guild Timings
When performance issues arise, Discord’s on-call engineers start with metrics and logs. These tools track user actions and processing times, offering clues about sudden spikes in activity. However, metrics alone can’t reveal the full user experience. For deeper insights, engineers use a custom tool called “guild timings,” which records how much of each minute is spent on specific actions. This granular data helps identify bottlenecks but is too voluminous to store long-term.
Building Distributed Tracing for Elixir
Other teams at Discord rely on distributed tracing to map out operation timelines. Integrating this with Elixir required custom work, as most tracing tools depend on HTTP headers—something Elixir’s communication model lacks. Discord engineers built their own solution, enabling them to trace requests across services without downtime. This approach provides end-to-end visibility into how guilds handle user interactions, from message processing to downstream effects.
Why Elixir Matters for Real-Time Apps
Elixir’s concurrency model allows Discord to isolate guilds while maintaining system-wide stability. By combining metrics, guild timings, and distributed tracing, the team can pinpoint issues like lag or outages. This layered observability strategy ensures that even during peak activity, the platform remains responsive and reliable.
Key Takeaways
- Elixir’s concurrency enables Discord to scale chat servers independently.
- Custom tools like guild timings provide granular performance insights.
- Distributed tracing helps map complex interactions across services.







