English | 中文
gnet is an event-driven networking framework that is fast and lightweight. It makes direct epoll and kqueue syscalls rather than using the standard Go net package and works in a similar manner as netty and libuv, which makes
gnet achieve a much higher performance than Go net.
gnet is not designed to displace the standard Go net package, but to create a networking client/server framework for Go that performs on par with Redis and Haproxy for networking packets handling (although it does not limit itself to these areas), therefore,
gnet is not as comprehensive as Go net, it only provides the core functionalities (by a concise API set) of a networking application and it is not planned on being a full-featured networking framework, as I think net has done a good enough job in this area.
gnet sells itself as a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go which works on the transport layer with TCP/UDP protocols and Unix Domain Socket, so it allows developers to implement their own protocols(HTTP, RPC, WebSocket, Redis, etc.) of application layer upon
gnet for building diversified network applications, for instance, you get an HTTP Server or Web Framework if you implement HTTP protocol upon
gnet while you have a Redis Server done with the implementation of Redis protocol upon
gnet and so on.
gnet derives from the project:
evio while having a much higher performance and more features.
Unix Domain Socket
epollon Linux and
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.
go get -u github.com/panjf2000/gnet/v2
go get -u github.com/panjf2000/gnet
The following companies/organizations use
gnet as the underlying network service in production.
If you have
gnet integrated into projects, feel free to open a pull request refreshing this list.
# 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 see the full ranking list, visit TechEmpower Plaintext Benchmark.
# Machine information OS : Ubuntu 20.04/x86_64 CPU : 8 CPU cores, AMD EPYC 7K62 48-Core Processor Memory : 16.0 GiB # Go version and settings Go Version : go1.17.2 linux/amd64 GOMAXPROCS : 8 # Benchmark parameters TCP connections : 1000/2000/5000/10000 Packet size : 512/1024/2048/4096/8192/16384/32768/65536 bytes Test duration : 15s
# Machine information OS : MacOS Big Sur/x86_64 CPU : 6 CPU cores, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory : 16.0 GiB # Go version and settings Go Version : go1.16.5 darwin/amd64 GOMAXPROCS : 12 # Benchmark parameters TCP connections : 300/400/500/600/700 Packet size : 512/1024/2048/4096/8192 bytes Test duration : 15s
The source code of
gnet should be distributed under the Apache-2.0 license.
Please read the Contributing Guidelines before opening a PR and thank you to all the developers who already made contributions to
Support us with a monthly donation and help us continue our activities.
Become a bronze sponsor with a monthly donation of $10 and get your logo on our README on GitHub.
Please be sure to leave your name, GitHub account, or other social media accounts when you donate by the following means so that I can add it to the list of donors as a token of my appreciation.
gnet had been being developed with
GoLand IDE under the free JetBrains Open Source license(s) granted by JetBrains s.r.o., hence I would like to express my thanks here.
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容，可点击提交进行申诉，我们将尽快为您处理。