DNS Lookup Per Request, Not Pingora, Caused 6x Slowdown in Proxy Benchmark
A developer benchmarking Cloudflare's Rust proxy library Pingora against nginx in a containerized 2-vCPU environment initially recorded a six-fold performance gap, with Pingora handling only 21,000 requests per second versus nginx's 126,000. Investigation revealed the culprit was a DNS resolution call — getaddrinfo — being triggered synchronously on every single request inside a Tokio worker thread. In containers, this meant each request fired a live DNS query to Docker's resolver, blocking the thread and inflating latency from 0.45 ms to 4.78 ms. Resolving the upstream address once at startup and reusing the SocketAddr brought Pingora's throughput up to 89,000 requests per second. The developer concluded that the true performance difference between Pingora and nginx in this setup is just 1.49x, and warned that blocking operations hidden on the hot path can easily be misattributed to the framework itself.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in