// the find
eranyanay/1m-go-websockets
handling 1M websockets connections in Go
A conference talk companion repo from Gophercon Israel 2019 showing how to push a single Go server past 1M concurrent WebSocket connections on under 1GB RAM. It walks through progressively optimized implementations: vanilla goroutines, epoll-based I/O multiplexing, and the gobwas/ws library for zero-copy frame handling. Aimed at developers who want to understand the mechanics, not copy-paste a library.
The progression across four numbered directories is the right way to teach this — each step isolates one bottleneck (goroutine overhead, file descriptor limits, GC pressure from gobwas vs gorilla/websocket) so you can actually see what each change buys you. The epoll integration in step 3 is the rare case of Linux syscall wrangling done readably. Using gobwas/ws to avoid per-connection heap allocations is a real technique used in production systems. The pprof helper scripts (goroutine, heap) are included, which turns this into an actual learning tool rather than just slideware.
Abandoned since 2022 with no activity — the gobwas/ws dependency pinned in go.mod may have had breaking changes since 2019. The Docker-based load generation setup is manual and fiddly; there's no automated benchmark harness to reproduce the 1M number on your own hardware. Linux-only (epoll) with no fallback, so none of this transfers to macOS development environments without modification. The repo explicitly refuses new features and hasn't addressed the goroutine-per-connection model being largely superseded by newer approaches like netpoll or the Go runtime's own improvements since 1.14.