Build high-performance networking applications in Go

On top of a variety of protocols of HTTP, RPC, WebSocket, Redis, etc.

gnet is the fastest networking framework in Go.

Why gnet?

Ultra-Fast

Built in Go, gnet is ultra-fast and memory efficient based on the event-driven mechanism. It's designed to create a networking server framework for Go that performs on par with Redis and Haproxy for networking packets handling.

Lock-Free

gnet is lock-free during the entire runtime, which keeps gnet free from synchronization issues and speeds it up.

Concise & Easy-to-use APIs

gnet provides concise and easy-to-use APIs for users, it only exposes the essential APIs and takes over most of the tough work for users, minimizing the complexity of business code so that developers are able to concentrate on business logic instead of the underlying implementations.

Multiple Porotocols

gnet supports multiple protocols/IPC mechanism: TCP, UDP and Unix Domain Socket, enabling you to develop a variety of networking applications.

Cross Platform

gnet is devised as a cross-platform framework, as a result, it works faultlessly on multiple platforms: Linux, FreeBSD, DragonFly BSD, Windows.

Powerful Libraries

There is a rich set of libraries in gnet, such as memory pool, goroutine pool, elastic buffers, logging package, etc., which makes it convenient for developers to build fast and efficient networking applications.

Networking model of multiple reactors

Learn how gnet works

Cross Platform

Built on Linux, FreeBSD, DragonFly BSD, Darwin, Windows
        
UNIX & Windows
X86_64, ARM64
Light-weight
Ultra-fast

How to install gnet

`gnet` is available as a Go module and we highly recommend that you use `gnet` via Go Modules, with Go 1.11 Modules enabled (Go 1.11+), you can just simply add `import "github.com/panjf2000/gnet/v2"` to the codebase and run `go mod download/go mod tidy` or `go [build|run|test]` to download the necessary dependencies automatically.

Run go get to download gnet:

With v2

go get -u github.com/panjf2000/gnet/v2

With v1

go get -u github.com/panjf2000/gnet

Performance

Benchmarks on TechEmpower
# Hardware Environment
* 28 HT Cores Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz
* 32GB RAM
* Ubuntu 18.04.3 4.15.0-88-generic #88-Ubuntu
* Dedicated Cisco 10-gigabit Ethernet switch
* Go1.19.x linux/amd64

All languages

This is a leaderboard of the top 50 out of 499 frameworks that encompass various programming languages worldwide, in which gnet is ranked first.

Go

This is the full framework ranking of Go and gnet tops all the other frameworks, which makes gnet the fastest networking framework in Go.


To check the full ranking list, visit TechEmpower Plaintext Benchmark.

Note that the HTTP implementation of gnet on TechEmpower is half-baked and fine-tuned for benchmark purposes only and is far from production-ready.

Use cases

The following companies/organizations use gnet as the underlying network service in production.

If your projects are also using gnet, feel free to open a pull request refreshing this list.