git404hub

what is gnet fr?

panjf2000/gnet — explained in plain English

Analysis updated 2026-06-24

11,144GoAudience · developerComplexity · 4/5Setup · moderate

tl;dr

A Go library for building extremely fast network servers that handles thousands of simultaneous connections using event-driven I/O instead of one goroutine per connection.

vibe map

mindmap
  root((gnet))
    What it does
      Event-driven networking
      High-throughput servers
      Connection management
    Tech stack
      Go
      epoll
      kqueue
    Use cases
      TCP proxy servers
      Custom protocols
      Game backends
    Audience
      Go developers
      Systems programmers
      Backend engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Build a high-throughput TCP proxy server that manages tens of thousands of simultaneous connections with low memory use.

VIBE 2

Implement a custom game server backend in Go that needs minimal latency and tight control over connection handling.

VIBE 3

Write a specialized UDP protocol handler where Go's standard networking package is too slow for your traffic volume.

what's the stack?

Go

how it stacks up fr

panjf2000/gnet0xjacky/nginx-uiloft-sh/vcluster
Stars11,14411,13811,132
LanguageGoGoGo
Setup difficultymoderatemoderatehard
Complexity4/53/54/5
Audiencedeveloperops devopsops devops

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · moderate time til it works · 30min

Requires Go 1.20+, Windows support is development-only and not suitable for production deployments.

in plain english

gnet is a Go library for building high-performance network services. It works at the transport layer, meaning it handles the low-level mechanics of accepting and managing network connections for protocols like TCP and UDP, while leaving it to you to implement the application-level protocol on top, such as HTTP, WebSocket, or Redis. Most Go programs use the standard library's built-in networking package, which handles each connection with a dedicated goroutine. gnet takes a different approach: it uses event-driven I/O based on operating system primitives (epoll on Linux, kqueue on macOS and BSD) to handle many connections without a goroutine per connection. This design reduces memory use and can improve throughput in scenarios where a server needs to manage very large numbers of simultaneous connections. The library is not intended to replace Go's standard net package for everyday use. It is aimed at situations where raw performance is a priority, such as building a high-throughput proxy, a custom game server, or a specialized protocol handler. It provides an internal goroutine pool, elastic memory buffers, multiple load-balancing strategies, support for timed events, and edge-triggered I/O, all behind a concise API. gnet runs on Linux, macOS, Windows, and BSD variants, though the Windows version is noted as suitable for development use only rather than production. The library is used in production by several large Chinese technology companies including Tencent, iQiyi, Xiaomi, Baidu Tieba, and JD.com. Go 1.20 or higher is required. The library is added to a project as a standard Go module with a single import line.

prompts (copy fr)

prompt 1
Using gnet, write a simple TCP echo server in Go that handles connections efficiently without a goroutine per connection.
prompt 2
Show me how to implement a custom protocol handler in gnet that parses a fixed-length binary frame over TCP.
prompt 3
Help me benchmark gnet against Go's standard net package for a server handling 50,000 concurrent TCP connections.
prompt 4
Walk me through building a UDP server with gnet that uses the built-in goroutine pool and round-robin load balancing.

Frequently asked questions

what is gnet fr?

A Go library for building extremely fast network servers that handles thousands of simultaneous connections using event-driven I/O instead of one goroutine per connection.

What language is gnet written in?

Mainly Go. The stack also includes Go.

How hard is gnet to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is gnet for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.