SShortSingh.
Back to feed

Request coalescing in Rust cuts 100 cache-miss upstream calls to one

0
·5 views

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.

Read the full story at DEV Community

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

Related stories

0
ProgrammingDEV Community ·

MCP Maturity Map: Only MCP Apps Is Stable as Protocol Adds Stateless Design

A post claiming MCP shipped four new capabilities (Skills, Tasks, Elicitation, and File Uploads) conflates different maturity levels, according to an analysis of the primary MCP spec repository as of 4 December 2026. Under the extension lifecycle SEP-3392, reaching Final only means a proposal was accepted, while Beta and Stable status require further approvals, and Experimental or Beta extensions can break compatibility with only Extension Maintainer approval. MCP Apps is the only Stable extension, Skills and Tasks are in Beta or Experimental, and File Uploads is merely an experimental draft. The current stable spec, dated 2026-07-28, moves MCP to a stateless design that removes the session handshake and adds new header and caching requirements. Elicitation predates this release, which instead introduces MRTR to replace server-initiated calls.

0
ProgrammingDEV Community ·

Why async AI image generation needs more job states, deadlines, and concurrency limits

A developer reflecting on building an AI image generation product argues that asynchronous generation jobs have far more failure states than simple request-response calls. Beyond success and error, jobs can be lost when a worker dies or a webhook never fires, so the author recommends assigning every job a deadline enforced by a sweeper. Failures also need classification, since rate limits and transient outages warrant retries while content-policy rejections and malformed prompts do not. To prevent double charges from client retries, the author uses per-intent idempotency keys, and separates per-user from global concurrency limits to control costs and fairness.

0
ProgrammingDEV Community ·

How a browser-based auto-tune works: pitch tracking, key detection and PSOLA

A developer working on a free in-browser auto-tune explains its internal pipeline, built from three pure functions that operate on Float32Arrays. The vocal is downsampled and analysed with the YIN algorithm every 10 milliseconds to track pitch, with a level gate that adapts to each file's peak after a fixed threshold silently failed on quiet recordings. Key is estimated from a histogram of pitch classes correlated against major and minor profiles, and users can override it and choose among seven scales. To avoid jittery retuning during vibrato, target notes must hold for 80 milliseconds or make a clear jump, while a one-pole glide controls retune speed. Pitch is shifted with time-domain PSOLA, which preserves formants and avoids the chipmunk effect.

0
ProgrammingDEV Community ·

Shared Generator Now Prints Signs into Each Service's Own Directory Layout

The sign printer previously assumed one fixed enclosure shape, which forced residents with their own burrows to relocate or go without signs. A new change lets every enclosure declare its own layout, so the printer writes into each service's existing folder structure while producing consistent output. The layout is set through a manifest section that defines the print directories, with a library default used when none is given. Manifests can also be split into per-subject files that the generator reads together as one plan. The author frames this as a way for older services to keep their code in place rather than migrate into the generator's tree.