CloudWeGo-Netpoll
Introduction
CloudWeGo-Netpoll is a high-performance non-blocking I/O networking framework specifically designed for Remote Procedure Call (RPC) scenarios. Developed by ByteDance, this framework emerges from the need to handle RPC tasks efficiently, where processing logic can be quite heavy. Traditional Go standard libraries like net
were originally devised for blocking I/O APIs, which means they typically operate on a "One Connection, One Goroutine" design. This traditional design can become inefficient in high-concurrency situations due to the increased costs associated with context switching among numerous goroutines. Additionally, the standard net.Conn
lacks an API for checking if a connection is still alive, complicating the creation of an efficient connection pool for RPC frameworks, which can inadvertently include many failed connections.
Netpoll addresses these challenges by drawing on insights from other frameworks such as evio
and netty
. It offers superior performance and is tailored for microservice architecture, making it a recommended replacement for the net
package in certain RPC scenarios. It powers RPC and HTTP frameworks like Kitex and Hertz, both of which boast top-tier performance in the industry.
Features
CloudWeGo-Netpoll comes equipped with a range of features focused on enhancing performance and support across different systems:
-
Current Features:
- LinkBuffer: Offers a no-copy API for efficient streaming read and write operations.
- gopool: Provides a high-performance goroutine pool for better resource management.
- mcache: Efficient memory reuse feature to prevent memory waste.
- Connection Management: Offers
IsActive
for checking connection status andDialer
for establishing client connections. - Server Support: Includes
EventLoop
for server construction. - Supports TCP and Unix Domain Socket.
- Compatible with Linux and macOS operating systems.
-
Planned Features:
- Support for advanced I/O technologies like
io_uring
. - Shared Memory IPC for faster inter-process communication.
- TLS for secure data transmission.
- UDP protocol support.
- Support for advanced I/O technologies like
-
Unsupported:
- Windows operating systems are not currently supported.
Performance
The performance benchmarks of CloudWeGo-Netpoll illustrate its suitability for industrial use, especially in RPC scenarios requiring extensive concurrency and robust timeout handling. The netpoll-benchmark
project serves as a resource for comparing Netpoll's performance against other frameworks under various conditions. For further insights into performance, users can refer to benchmarks related to the Kitex and Hertz frameworks.
Reference
For more information about CloudWeGo-Netpoll, potential users are encouraged to visit the official website and explore resources such as the Getting Started Guide, Design Overview, and in-depth explorations like Why DATA RACE.