Request coalescing in Rust cuts 100 cache-miss upstream calls to one
A Rust reverse proxy gained opt-in request coalescing so that a burst of identical cache-miss requests triggers only one upstream call. The author's first design tied the shared work to the first caller, so a disconnect would fail everyone else; the fix runs the producer in a spawned task that publishes results over a watch channel. A review also uncovered a cache-sharing bug where requests with different tenant headers could reuse the same entry, fixed with a presence-tagged fingerprint and a regression test. On a local mock with a 250 ms upstream delay and 100 callers, upstream calls dropped from 100 to 1, though the author notes this is a correctness result, not a billing or throughput claim. The implementation is process-local, so multiple replicas still make separate calls, and it applies only to non-streaming requests.
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