finds.dev

eranyanay/1m-go-websockets

handling 1M websockets connections in Go

View on GitHub

★ 5,992GoAGPL-3.0updated Aug 2022

// the take

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.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
5,992
Forks
639
Language
Go
License
AGPL-3.0
Last commit
14 Aug 2022

// nearby

If 1m-go-websockets isn't quite it.

All repos →