Go HTTP server provides great scalability, allocating a goroutine per connection, and reusing the efficient multiplexing and scheduling of the Go runtime.
While this technique is almost ideal for most scenarios, it comes with limited scale for websockets applications due to high memory consumption
In this talk, we will show how we’ve implemented our own event loop mechanism to overcome those limitations and efficiently manage millions of concurrent connections while minimizing resource utilization. We will compare the memory footprint of a naive implementation, relying on the standard way to handle those connections with go-routines, and explore the difficulties of using epoll and select in pure go to efficiently schedule and maintain all those concurrent connections
All the examples in the slides are also available here: https://github.com/eranyanay/1m-go-websockets/