Cloudflare Company announced about opening the source code of the framework Pingora, intended for the development of secure, high-performance network services and programmable network systems in the Rust language. The framework has been well tested and is already used in high-load systems – a proxy built on its basis has been used in the Cloudflare content delivery network instead of Nginx for more than a year and processes more than 40 million requests per second. The code is written in Rust and published licensed under Apache 2.0.
Pingora can be used for multi-threaded request processing in asynchronous mode, supports HTTP/1 and HTTP/2 (HTTP/3 in plans), gRPC and WebSocket proxying, pluggable load balancers, changing configuration without restarting, updating code without breaking connections, defining switching strategy load in case of failure (failover), integration with various monitoring and logging systems (Syslog, Prometheus, Sentry, OpenTelemetry). Pingora also supports TLS encryption, but it is implemented as an add-on to the OpenSSL and BoringSSL C libraries.
Ready-made Rust packages are provided for creating an HTTP proxy, working with network protocols, parsing HTTP headers, accounting and limiting traffic, load balancing, working with a distributed hash table Ketama, maintaining a cache in RAM and asynchronously processing timeouts. In addition to HTTP, the creation of services using their own protocols or UDP/TCP is supported.
The key priority of the project is ensuring security – to reduce the likelihood of memory-related errors, the Rust language was chosen for development. Much attention is also paid to efficiency, performance and extensibility. For example, when creating proxy servers and load balancers based on Pingora, it is possible to attach callback handlers and filters that allow manage various stages of request processing, as well as modify, redirect, block and log requests and responses.
Together with the ISRG organization (Internet Security Research Group), which is the founder of the Let's Encrypt project and promotes the development of technologies to increase the security of the Internet, based on Pingora will be created reverse proxy River, designed for use in critical elements of the network infrastructure. Code River will be written in Rust and distributed under the Apache 2.0 license. Development will begin in the second quarter of 2024. The project is currently in the design and definition stage architecture. The project is being developed under the direction of James Manns (James Munns) from the Rust Embedded Working Group.
The main purpose of the River project is implementation of a proxy capable of relaying client requests to backend servers, triaging incoming TLS connections and routing, modifying and filtering requests in accordance with specified rules. Among the features of River, a multi-threaded request processing model is mentioned, which allows for more efficient connection reuse compared to proxies such as nginx. To expand the functionality of the proxy and create filters, it will be possible to connect modules compiled in the WebAssembly format (for development, you can use any programming languages for which compilation in WASM is supported). They plan to make the configuration format as simple and familiar as possible.
Thanks for reading: