MCPcopy Index your code
hub / github.com/eranyanay/1m-go-websockets

github.com/eranyanay/1m-go-websockets @main sqlite

repository ↗ · DeepWiki ↗
25 symbols 59 edges 8 files 0 documented · 0%
README

Going Infinite, handling 1M websockets connections in Go

This repository holds the complete implementation of the examples seen in Gophercon Israel talk, 2019.

Going Infinite, handling 1 millions websockets connections in Go / Eran Yanay — [ Video | Slides ]

It doesnt intend or claim to serve as a better, more optimal implementation than other libraries that implements the websocket protocol, it simply shows a set of tools, all combined together to demonstrate a server written in pure Go that is able to serve more than a million websockets connections with less than 1GB of ram.

Usage

This repository demonstrates how a very high number of websockets connections can be maintained efficiently in Linux

Everything is written in pure Go

Each folder shows an example of a server implementation that overcomes various issues raised by the OS, by the hardware or the Go runtime itself, as shown during the talk.

setup.sh is a wrapper to running multiple instances using Docker. See content of the script for more details of how to use it.

destroy.sh is a wrapper to stop all running clients.

A single client instance can be executed by running go run client.go -conn=<# connections to establish>

Remarks

This repo consists of a set of examples that were demonstrated during a live talk in Gophercon.

What you see is what you get - while the implementation is fully functional, it doesn't intend to serve as a production-ready code, and no new features that were asked will be added.

The only purpose of this repository is to serve as a reference and a case study.

Core symbols most depended-on inside this repo

Add
called by 3
4_optimize_gobwas/epoll.go
websocketFD
called by 2
4_optimize_gobwas/epoll.go
websocketFD
called by 2
3_optimize_ws_goroutines/epoll.go
Start
called by 1
4_optimize_gobwas/server.go
MkEpoll
called by 1
4_optimize_gobwas/epoll.go
Remove
called by 1
4_optimize_gobwas/epoll.go
Wait
called by 1
4_optimize_gobwas/epoll.go
Start
called by 1
3_optimize_ws_goroutines/server.go

Shape

Function 17
Method 6
Struct 2

Languages

Go100%

Modules by API surface

4_optimize_gobwas/epoll.go6 symbols
3_optimize_ws_goroutines/epoll.go6 symbols
4_optimize_gobwas/server.go3 symbols
3_optimize_ws_goroutines/server.go3 symbols
2_ws_ulimit/server.go2 symbols
1_ws_example/server.go2 symbols
0_simple_web_server/server.go2 symbols
client.go1 symbols

Dependencies from manifests, versioned

github.com/gobwas/httpheadv0.0.0-2018013018473 · 1×
github.com/gobwas/poolv0.2.0 · 1×
golang.org/x/sysv0.0.0-2020030215014 · 1×

For agents

$ claude mcp add 1m-go-websockets \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact