Going Infinite: Handling 1 Million Websocket Connections in Go
summary
Shows how a Go HTTP/WebSocket server moves from a goroutine-per-connection design to an epoll-based event loop that drops goroutines, swaps the websocket library for a zero-allocation alternative, and reuses I/O buffers. Uses pprof to find 20 GB of per-connection allocations, raises ulimits and conntrack, and runs clients in separate network namespaces to bypass ephemeral port limits. Result: memory falls to ~600–700 MB and the demo reaches ~260–300k live sockets with paths toward millions.
AI-written summary · about
chapters (23)
- 0:00Introduction
- 0:15Overview
- 1:00Hello Handler
- 1:35Salvin
- 2:01What is Websocket
- 2:50How do we do it
- 3:13Example
- 4:08Demonstration
- 5:27Too Many Open Files
- 6:15Ulama
- 7:54Limit syscall
- 8:27Starting a server
- 10:39People
- 14:56Go Team
- 15:24WebSocket Handler
- 15:45Future Optimizations
- 16:38Neighbor Post
- 18:54April
- 20:16Buffer Locations
- 21:10Gobos
- 22:23Demo
- 28:01Results
- 28:24Summary
related talks
47mUnbounded Concurrency in Go
01h 06mgolang rocks!
31mGo: Code that Grows with Grace
08mPërvoja personale me Go si gjuhë e infrastrukturës
21mReaching the ceiling of single-instance Go
18mUnmasking netpoll.go
24mMastering Concurrency in Go: From Patterns to Production
30mDynamically Instrumenting Go Programs
