# gnet **Repository Path**: opensource-release/gnet ## Basic Information - **Project Name**: gnet - **Description**: π gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go. - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://gnet.host/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-03 - **Last Updated**: 2026-01-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
English | [δΈζ](README_ZH.md) ### πππ Feel free to join [the channels about `gnet` on the Discord Server](https://discord.gg/UyKD7NZcfH). # π Introduction `gnet` is an event-driven networking framework that is ultra-fast and lightweight. It is built from scratch by exploiting [epoll](https://man7.org/linux/man-pages/man7/epoll.7.html) and [kqueue](https://en.wikipedia.org/wiki/Kqueue) and it can achieve much higher performance with lower memory consumption than Go [net](https://golang.org/pkg/net/) in many specific scenarios. `gnet` and [net](https://golang.org/pkg/net/) don't share the same philosophy in network programming. Thus, building network applications with `gnet` can be significantly different from building them with [net](https://golang.org/pkg/net/), and the philosophies can't be reconciled. There are other similar products written in other programming languages in the community, such as [libuv](https://github.com/libuv/libuv), [netty](https://github.com/netty/netty), [twisted](https://github.com/twisted/twisted), [tornado](https://github.com/tornadoweb/tornado), etc. which work in a similar pattern as `gnet` under the hood. `gnet` is not designed to displace the Go [net](https://golang.org/pkg/net/), but to create an alternative in the Go ecosystem for building performance-critical network services. As a result of which, `gnet` is not as comprehensive as Go [net](https://golang.org/pkg/net/), it provides only the core functionality (via a concise set of APIs) required by a network application and it doesn't plan on becoming a coverall networking framework, as I think Go [net](https://golang.org/pkg/net/) has done a good enough job in that 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. It enables developers to implement their own protocols(HTTP, RPC, WebSocket, Redis, etc.) of application layer upon `gnet` for building diversified network services. For instance, you get an HTTP Server 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` with much higher performance and more features.** # π Features ## π¦ Milestones - [x] [High-performance](#-performance) event-driven looping based on a networking model of multiple threads/goroutines - [x] Built-in goroutine pool powered by the library [ants](https://github.com/panjf2000/ants) - [x] Lock-free during the entire runtime - [x] Concise and easy-to-use APIs - [x] Efficient, reusable, and elastic memory buffer: (Elastic-)Ring-Buffer, Linked-List-Buffer and Elastic-Mixed-Buffer - [x] Multiple protocols/IPC mechanisms: `TCP`, `UDP`, and `Unix Domain Socket` - [x] Multiple load-balancing algorithms: `Round-Robin`, `Source-Addr-Hash`, and `Least-Connections` - [x] Flexible ticker event - [x] `gnet` client - [x] Running on `Linux`, `macOS`, `Windows`, and *BSD: `Darwin`/`DragonFlyBSD`/`FreeBSD`/`NetBSD`/`OpenBSD` - [x] **Edge-triggered** I/O support - [x] Multiple network addresses binding - [x] Support registering new connections to event-loops ## π Roadmap - [ ] **TLS** support - [ ] [io_uring](https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023) support - [ ] **KCP** support ***Windows version of `gnet` should only be used in development for developing and testing, it shouldn't be used in production.*** # π¬ Getting started `gnet` is available as a Go module and we highly recommend that you use `gnet` via [Go Modules](https://go.dev/blog/using-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. ## With v2 ```bash go get -u github.com/panjf2000/gnet/v2 ``` ## With v1 ```bash go get -u github.com/panjf2000/gnet ``` # π‘ Use cases The following corporations/organizations use `gnet` as the underlying network service in production.
|
|
|
|
|
|
|
|
|
|
|
|