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.
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.
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.
gnet supports multiple protocols/IPC mechanism: TCP, UDP and Unix Domain Socket, enabling you to develop a variety of networking applications.
gnet is devised as a cross-platform framework, as a result, it works faultlessly on multiple platforms: Linux, FreeBSD, DragonFly BSD, Windows.
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
- Multiple Reactors
- Multiple Reactors With Groutine Pool
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:
go get -u github.com/panjf2000/gnet/v2
go get -u github.com/panjf2000/gnet
# 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
This is a leaderboard of the top 50 out of 499 frameworks that encompass various programming languages worldwide, in which
gnet is ranked first.
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.
gnetas the underlying network service in production.
If your projects are also using
gnet, feel free to open a pull request refreshing this list.