explaingit

eranyanay/1m-go-websockets

5,987GoAudience · developerComplexity · 3/5Setup · moderate

TLDR

Demo code from a 2019 conference talk showing how to maintain one million simultaneous WebSocket connections in Go, organized as progressively optimized server implementations intended for learning, not for production use.

Mindmap

mindmap
  root((1m-go-websockets))
    What it is
      Conference talk demo
      Go WebSocket scaling
      Learning resource
    Techniques
      OS limit tuning
      Memory reduction
      Runtime optimization
    Testing
      Docker client load
      setup.sh script
      Connection benchmarks
    Key insight
      1M connections feasible
      Incremental improvements
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study how to push a Go WebSocket server past OS and runtime limits to extreme connection counts

USE CASE 2

Learn techniques for reducing per-connection memory overhead in a high-concurrency Go server

USE CASE 3

Use the Docker test harness to benchmark WebSocket server capacity on your own hardware

USE CASE 4

Understand the performance bottlenecks that appear when scaling beyond 100k concurrent connections

Tech stack

GoDockerWebSocket

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Docker to spin up the client load-test instances, the code is a learning demo and not maintained for production use.

No license information is mentioned in the explanation.

In plain English

This repository contains the code from a 2019 conference talk about how to handle one million simultaneous WebSocket connections using the Go programming language. WebSockets are a way for a server and a browser (or other client) to keep a live two-way connection open, rather than the client making one-off requests. The challenge shown here is maintaining an enormous number of these open connections without the server running out of memory or hitting system limits. The code is organized into separate folders, each showing a different approach that solves a specific problem encountered when pushing a server to that scale, whether the limit comes from the operating system, the hardware, or Go's own runtime behavior. A helper script called setup.sh uses Docker to spin up many client instances at once so you can test the server under load. This is a learning resource, not a production library. The author is clear that no new features will be added and the code is not intended for use in real applications. It exists to accompany the talk slides and video, which are linked in the README. If you are curious about how high-performance Go servers handle extreme connection counts, this is a concise working example to study.

Copy-paste prompts

Prompt 1
Walk me through the progression of optimizations in 1m-go-websockets, what changes between each folder and why?
Prompt 2
What system-level limits does Go hit when maintaining 1 million WebSocket connections and how does this repo work around them?
Prompt 3
Show me how to run the Docker-based load test from this repo and interpret the resulting connection count metrics
Prompt 4
How does this repo reduce per-connection memory to handle 1 million open WebSocket connections on a single machine?
Prompt 5
Based on the techniques in this repo what is the minimum RAM required to hold 100k open WebSocket connections in Go?
Open on GitHub → Explain another repo

← eranyanay on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.