How to scale WebSockets to millions of connections

How to scale WebSockets to millions of connections

Aug 8, 2023

WebSockets are hard to scale, it's true. The stateful connection that makes them so powerful for two-way realtime communication also makes them tricky to load balance efficiently, but that isn't to say it can't be done. In this video, Alex Booker (@CodeCast) from Ably runs you through the technical challenges scaling WebSockets before outlining the patterns used to scale WebSockets to thousands of concurrent connections and beyond. Theoretically, the approach to system design outlined in this video can scale to millions of concurrent WebSocket connections in a production environment.

Ably is an enterprise-grade pub/sub messaging platform. We make it easy to efficiently design, quickly ship, and seamlessly scale critical realtime functionality delivered directly to end-users. Every day, we deliver billions of realtime messages to millions of users for thousands of companies.


00:00 Introduction

00:16 Why WebSockets are hard to scale

01:33 Why WebSocket benchmarks are misleading

03:03 Options for scaling WebSockets

03:32 Introduction to vertical scaling

04:14 Challenges with vertical scaling WebSockets

06:30 Horizontal scaling

07:40 Horizontal scaling continued

09:55 Challenges with horizontal scaling WebSockets

11:38 Conclusion