How Pingora keeps count
May 12, 2023Yuchen Wu

Summary
This post introduces `pingora-limits`, a new library within Cloudflare's in-house proxy, Pingora. It addresses the need for efficient counting of inflight events and estimation of event rates to protect infrastructure. The library utilizes the Count-Min Sketch algorithm, offering significant improvements in space efficiency (O(log n)) and performance (lock-free, O(1) per event) compared to traditional hash table approaches, especially at Cloudflare's scale of millions of requests per second across tens of thousands of machines.
More from the Hardware Infrastructure & Performance Optimization trail
- How we reduced core unit boot time from hours to minutes
- A one-line Kubernetes fix that saved 600 hours a year
- Inside Gen 13- how we built our most powerful server yet
- Launching Cloudflare’s Gen 13 servers- trading cache for cores for 2x edge compute performance
- So long, and thanks for all the fish- how to escape the Linux networking stack