A high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
gnet is an event-driven networking framework built from scratch in Go, designed for ultra-fast performance and low memory consumption in high-demand scenarios. It operates on the transport layer (TCP/UDP/Unix Domain Socket) and enables developers to build custom application-layer protocols like HTTP, RPC, or WebSocket servers on top of it. It provides a high-performance alternative to Go's standard net package for specialized, performance-critical network services.
Go developers building performance-critical network services such as custom protocol servers, high-throughput TCP/UDP applications, or low-latency real-time systems. It is suited for those needing to optimize for high concurrency and low memory usage in production environments.
Developers choose gnet over alternatives for its ultra-fast performance and low memory consumption, achieved through an event-driven architecture with epoll/kqueue, a built-in goroutine pool, and lock-free runtime. It offers a concise API focused on core functionality, making it ideal for building specialized network services where Go's standard net package may not meet performance demands.
🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks like TechEmpower show gnet ranking first among Go frameworks, achieving higher throughput and lower latency than Go's net package in specific high-concurrency scenarios.
Uses elastic memory buffers such as Ring-Buffer and Linked-List-Buffer to minimize memory consumption, which is crucial for handling millions of connections with low overhead.
Integrates the ants library for optimized concurrency management, reducing goroutine creation costs and improving scalability in event-driven loops.
Supports algorithms like Round-Robin and Least-Connections, enabling scalable network services with flexible traffic distribution across multiple cores or threads.
TLS support is not yet implemented (only on the roadmap), limiting its use for secure protocols without additional third-party or custom work.
As a specialized framework, it lacks the extensive community tools and examples available for Go's net package, making implementation of custom protocols more hands-on.
The README explicitly warns against using the Windows version in production, restricting cross-platform deployments to Linux/macOS/*BSD for reliable operation.