Skip to content
handling 1M websockets connections in Go
Go Shell
Branch: master
Clone or download
eranyanay Fix #9: memory leak
Missing close() during error reading client message
Latest commit 87d86c0 Apr 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
0_simple_web_server Update README.md Feb 12, 2019
1_ws_example Update README.md Feb 12, 2019
2_ws_ulimit Fix #9: memory leak Apr 24, 2019
3_optimize_ws_goroutines Fix #9: memory leak Apr 24, 2019
4_optimize_gobwas Fix #9: memory leak Apr 24, 2019
LICENSE Update LICENSE Feb 18, 2019
README.md Update README.md Mar 11, 2019
client.go Update client.go Feb 13, 2019
destroy.sh Update LICENSE Feb 18, 2019
pprof_goroutine.sh Update README.md Feb 12, 2019
pprof_heap.sh Update README.md Feb 12, 2019
setup.sh Update LICENSE Feb 18, 2019

README.md

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>

You can’t perform that action at this time.