Technology
Building APIs that respond in under 100 milliseconds requires discipline, not shortcuts
eBay engineer Saranya Vedagiri explains how to carve latency budgets across each layer of a distributed system and diagnose why users time out even when dashboards look green.
InfoQ
The difference between a 120-millisecond response and an 80-millisecond one may sound minor, but users experience it as friction—and friction compounds. At scale, that gap can mean the difference between a transaction completing and timing out.
Achieving sub-100ms API latency in distributed systems is achievable, but maintaining it over time requires a repeatable process and deep visibility into where delays hide. At eBay, latency drifts as load peaks, dependencies falter, and retry storms amplify—even when code stays unchanged.
Breaking Down the Request Path with Latency Budgets#
The most practical tool for controlling latency is a latency budget: a concrete target divided into allocations for each hop in the request chain. Rather than optimizing blindly, assign a cap to every layer and enforce it.
A rough blueprint might look like this:
- Edge layer (TLS handshake, routing): 10 ms
- Gateway (authentication, throttling): 5 ms
- Application logic (single or multiple microservices): 30 ms
- Data access layer (database queries): variable
- Response serialization: part of application layer
- Buffer (reserve for unexpected delays): 10–15 ms
This discipline serves two purposes: it forces prioritization (don't spend 100 ms on a nice-to-have if your cap is 50 ms) and it drives alignment across product, engineering, and quality teams around a single goal.
One common pitfall: teams subdivide systems into so many microservices that tasks requiring one network hop now require four. Each hop—including TLS setup, connection pooling, DNS lookup—compounds latency. Removing even a single hop often saves more time than rewriting thousands of lines of code.
Hidden Latency: Where Delays Really Hide#
When dashboards show p95 metrics looking healthy but users report timeouts, the culprit usually lurks in one of several places:
- Network hops and serialization: JSON payload translation, especially for large responses, can be a silent killer. If you're returning all available user data to 400+ downstream applications when each needs only 5–10 fields, serialization overhead compounds.

