The Road to 2 Million Websocket Connections in Phoenix
summary
Benchmarks use the Tsung tool to hold WebSocket connections and drive arrival rates; Phoenix channels hit real limits that get identified and fixed. Specific fixes include removing expensive timer.send_after heartbeats, switching ETS tables to duplicate_bag for subscriber storage, sharding pubsub with a local pool and tuning pool size, and inspecting queues with observer. Tests run on donated hardware up to 128 GB RAM 40 cores and reach about 1.2 million connections, showing which changes actually double or eliminate bottlenecks.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:16Why benchmark
- 2:10Challenges in benchmarking
- 4:42Tools for load testing
- 5:31Tsung configuration
- 7:19Load and session setup
- 9:12Tsung dashboard and metrics
- 12:10Initial test results
- 14:23Optimization 1: ETS tables
- 15:41Optimization 2: Timers
- 17:36Hardware scaling
- 21:15Optimization 3: ETS types
- 23:26Reaching one million
- 24:55Optimization 4: Parallelism
- 27:20Final 2 million milestone
- 29:36Optimization lessons
- 32:11Common issues and setup
- 34:18Scaling automation
- 35:05Future work
- 37:16Q&A








