Cloudflare open sources Pingora, its high-performance Rust-based proxy framework

· 3 min read
Cloudflare open sources Pingora, its high-performance Rust-based proxy framework

Cloudflare, a major content delivery network and web security company, recently announced the open sourcing of Pingora, its in-house developed Rust-based proxy framework. Pingora has been powering Cloudflare's infrastructure and managing a significant portion of Internet traffic worldwide.

Why Cloudflare built Pingora

In a blog post dating back to 2022, Cloudflare discussed some of the motivations behind building their own proxy instead of relying on existing open source software like Nginx. They found that Nginx's event-driven async model did not scale well under very high loads. Its codebase had also grown quite large and complex over the years.

Cloudflare wanted a proxy that was highly performant, capable of handling billions of requests per day, while also being memory safe written in Rust. Pingora was developed with an asynchronous multithreaded architecture for improved concurrency and resource utilization compared to Nginx. Being in Rust also allowed Cloudflare to avoid common memory safety bugs found in other C/C++ proxies.

Key features and capabilities

According to Cloudflare's documentation, some of Pingora's main features include:

  • Support for HTTP/1, HTTP/2 as well as gRPC and WebSocket proxying
  • Customizable load balancing and failover strategies
  • Integration with OpenSSL and BoringSSL for TLS and security
  • Filters and callbacks APIs for building highly customizable services
  • Zero-downtime upgrades and graceful restarts
  • Observability integrations for monitoring and metrics

Cloudflare showed an example of how to easily build a basic load balancer application using Pingora's APIs. It supports protocol upgrades and handles all low-level tasks like connection handling under the hood.

Open sourcing Pingora

In February 2024, Cloudflare officially announced it was open sourcing the Pingora framework under an Apache 2.0 license. It has been powering their global network, handling nearly a quadrillion requests.

GitHub - cloudflare/pingora: A library for building fast, reliable and evolvable network services.
A library for building fast, reliable and evolvable network services. - cloudflare/pingora

The goal of open sourcing Pingora is to help build a better and more secure internet beyond Cloudflare's own infrastructure. It aims to provide inspiration and tools for others to develop their own high-performance services using a memory-safe Rust framework.

Cloudflare is collaborating with the Internet Security Research Group (ISRG) on expanding Pingora's adoption. ISRG is working on a new reverse proxy called River that will offer an easier to use application built on top of Pingora.

Community contributions and roadmap

Pingora is currently in a pre-1.0 phase, with API stability not guaranteed. While support for non-Unix platforms is not a priority, this could change in the future.

The code is hosted on GitHub, where users can file issues and contribute fixes/enhancements. Cloudflare provides guidelines for code contributions and ensuring changes align with the project vision.

Over time, features like HTTP/3 support, improved Windows/ARM compatibility and additional protocol integrations are planned. The goal is for Pingora to eventually become a fully polished production-ready proxy framework.

Conclusion

Pingora addresses limitations in other popular proxies while providing a highly programmable platform. Backed by ISRG and adoption in future projects like River, it has the potential to reshape how internet services are architected and deployed going forward.

## Convertkit Newsletter