5 min read
eBay staff engineer details how to design distributed APIs under 100 milliseconds

- Reading
- 5 min
- Tables
- 1
In a talk at QCon London, staff engineer Saranya Vedagiri explains how eBay splits a request's latency into per-layer budgets to prevent a single bottleneck from derailing the entire user experience.
A presentation by eBay staff engineer Saranya Vedagiri, made available by InfoQ from a talk at QCon London, details how the company designs APIs that must respond in under 100 milliseconds even while depending on dozens of internal calls. The material doesn't bring a product novelty: it's an account of applied engineering, with the same problems any team running microservices in Brazil has already encountered, just described with the vocabulary and numbers of someone handling this at a scale of billions of calls.
Vedagiri's starting point is that latency isn't felt by the user as a number, but as accumulated friction.
Users don't experience latency as numbers, they experience it as friction.
Saranya Vedagiri, Staff Engineer at eBay
Hop-by-hop latency budget
The central proposal is to treat latency as a budget distributed across the request's layers, not as a single number measured only at the end. Each hop gets a ceiling, and none can consume more than agreed:
| Layer | Suggested budget | What happens there |
|---|---|---|
| Edge (TLS, routing) | 10 ms | Handshake, initial edge routing |
| Gateway | 5 ms | Authentication and throttling |
| Application logic | 30 ms | Business rules, may involve more than one microservice |
| Safety buffer | 10 to 15 ms | Margin for traffic spikes and unstable dependencies |
The data access layer is also part of the budget, but the talk doesn't settle on a fixed number for it: the point is that each team needs to define the ceiling for its own layer, not assume there's time to spare. Vedagiri uses as an example a recommendation engine that needs to respond in 50 milliseconds because it appears at multiple points in the product, from page to email: the budget keeps the team from spending time on something "nice to have" when it already knows it won't fit the ceiling.
Where latency really hides
The second block of the talk maps the path of a typical request to an eBay item service: it needs to query the seller service, the feedback service, the reviews service, and the image service before assembling the response. Each additional call multiplies the risk of delay, and the decision between making these calls in series or in parallel is where most of the time is lost or recovered.
Some points the presentation cites as recurring pitfalls:
- Payload serialization: if the item service returns title, SKU, transaction history, and full description to every client (search, cart, checkout, email, metrics), it's paying the cost of serializing data that most consumers don't use.
- Cache miss at the worst moment: a cache failure forces a fallback to the database and adds latency that doesn't show up in normal load tests.
- Thread contention: when a downstream fails, the queue grows, the application retries, and the system spirals until it fails completely.
- Excess dependencies: the system's final SLA is, in practice, the SLA of the slowest downstream it depends on.
The choice between gRPC and REST also factors into this: for internal service-to-service communication, gRPC pays off when the payload is larger; for a public client-facing API, JSON still makes more sense because it's readable. For read services with many response formats per client type, the talk also cites GraphQL as an alternative to multiplying REST endpoints.
The green p95 case with a client hanging
The most concrete part of the presentation is a real incident: the internal dashboard showed a healthy p95, but a client was reporting constant timeouts. The explanation is statistical. When eBay processes billions of calls, a failure rate under 1% doesn't show up as an anomaly in the aggregate. For a client making millions of calls, that same 1% is felt in full, and if the call is part of a checkout, every failure is a lost transaction.
The investigation followed a sequence that works as a checklist for any team operating critical APIs:
- Cross-reference the complaining client's logs with the service's internal metrics.
- Build (or revisit) p99 dashboards, not just p95 or average.
- Compare successful transactions with those that timed out, looking at thread pool health, queue size, and database and cache dashboards for the same interval.
- Isolate the real cause: cascading retries, a saturated thread pool, database latency tail, or an observability gap.
One of the cited findings is what the talk calls retry amplification: a service that increases the timeout with each new attempt (500ms, then 1000ms) isn't protecting the system, it's guaranteeing that it loses the race against the SLA. The recommendation is the opposite: if a Redis query normally responds in 5 milliseconds, the retry timeout should be tighter than that, not looser, because waiting too long before retrying only delays the failure.
The three fixes that resolved the case at eBay were payload reduction (the service was returning a user map with thousands of keys to more than 400 consuming applications, when most needed only 5 or 10 fields), retry discipline (only retrying idempotent calls, with a limit and a dedicated thread pool per downstream), and a field-by-field review of the response from the actual consumer's side.
What changes for those designing systems in Brazil
In summary: the material doesn't bring a new tool, but it reinforces an engineering pattern that applies directly to marketplaces, fintechs, and any Brazilian backend combining service fanout with an aggressive SLA. E-commerce and checkout teams that depend on multiple synchronous calls (inventory, payment, shipping, fraud prevention) face exactly the same dilemma between parallelizing, running in the background, or going fire-and-forget that the talk describes for eBay's "place order" flow.
The practical recommendation that can be applied right away is to instrument p99 before the incident, not after: the talk itself acknowledges there's no time to build that dashboard once the client is already complaining. Isolating thread pools per downstream and reviewing whether the retry timeout is shorter than the dependent's expected latency are configuration changes, not architectural ones, and can be applied without rewriting any service.
What remains open is how much of this per-hop budget model is formalized into an internal tool at eBay versus kept as team discipline: the presentation describes the process and the reference numbers, but doesn't detail whether automated tooling exists to enforce per-layer latency ceilings.
Translated from the Brazilian Portuguese original · Read the original
Senacon demands that Google expand ad transparency in Brazil
Preliminary injunction also covers YouTube campaigns, with a daily fine for non-compliance





