2 releases

0.1.1 Apr 18, 2024
0.1.0 Feb 28, 2024

#1835 in Asynchronous

Download history 186/week @ 2024-02-22 757/week @ 2024-02-29 729/week @ 2024-03-07 680/week @ 2024-03-14 534/week @ 2024-03-21 588/week @ 2024-03-28 747/week @ 2024-04-04 498/week @ 2024-04-11 675/week @ 2024-04-18

2,589 downloads per month
Used in 2 crates (via pingora)

Apache-2.0

1MB
20K SLoC

Pingora

Pingora banner image

What is Pingora

Pingora is a Rust framework to build fast, reliable and programmable networked systems.

Pingora is battle tested as it has been serving more than 40 million Internet requests per second for more than a few years.

Feature highlights

  • Async Rust: fast and reliable
  • HTTP 1/2 end to end proxy
  • TLS over OpenSSL or BoringSSL
  • gRPC and websocket proxying
  • Graceful reload
  • Customizable load balancing and failover strategies
  • Support for a variety of observability tools

Reasons to use Pingora

  • Security is your top priority: Pingora is a more memory safe alternative for services that are written in C/C++
  • Your service is performance-sensitive: Pingora is fast and efficient
  • Your service requires extensive customization: The APIs Pingora proxy framework provides are highly programmable

Getting started

See our quick starting guide to see how easy it is to build a load balancer.

Our user guide covers more topics such as how to configure and run Pingora servers, as well as how to build custom HTTP servers and proxy logic on top of Pingora's framework.

API docs are also available for all the crates.

Notable crates in this workspace

  • Pingora: the "public facing" crate to build networked systems and proxies
  • Pingora-core: this crate defines the protocols, functionalities and basic traits
  • Pingora-proxy: the logic and APIs to build HTTP proxies
  • Pingora-error: the common error type used across Pingora crates
  • Pingora-http: the HTTP header definitions and APIs
  • Pingora-openssl & pingora-boringssl: SSL related extensions and APIs
  • Pingora-ketama: the Ketama consistent algorithm
  • Pingora-limits: efficient counting algorithms
  • Pingora-load-balancing: load balancing algorithm extensions for pingora-proxy
  • Pingora-memory-cache: Async in-memory caching with cache lock to prevent cache stampede
  • Pingora-timeout: A more efficient async timer system
  • TinyUfo: The caching algorithm behind pingora-memory-cache

System requirements

Systems

Linux is our tier 1 environment and main focus.

We will try our best for most code to compile for Unix environments. This is for developers and users to have an easier time developing with Pingora in Unix-like environments like macOS (though some features might be missing)

Both x86_64 and aarch64 architectures will be supported.

Rust version

Pingora keeps a rolling MSRV (minimum supported Rust version) policy of 6 months. This means we will accept PRs that upgrade the MSRV as long as the new Rust version used is at least 6 months old.

Our current MSRV is 1.72.

Contributing

Please see our contribution guidelines.

License

This project is Licensed under Apache License, Version 2.0.


lib.rs:

pingora-proxy

Programmable HTTP proxy built on top of [pingora_core].

Features

  • HTTP/1.x and HTTP/2 for both downstream and upstream
  • Connection pooling
  • TLSv1.3, mutual TLS, customizable CA
  • Request/Response scanning, modification or rejection
  • Dynamic upstream selection
  • Configurable retry and failover
  • Fully programmable and customizable at any stage of a HTTP request

How to use

Users of this crate defines their proxy by implementing [ProxyHttp] trait, which contains the callbacks to be invoked at each stage of a HTTP request.

Then the service can be passed into [http_proxy_service()] for a pingora_core::server::Server to run it.

See examples/load_balancer.rs for a detailed example.

Dependencies

~36–60MB
~1M SLoC