Menu
InfoQ Architecture·November 27, 2026

Sub-100ms API Design in Distributed Systems: Latency Budgeting and Optimization

This article explores strategies for designing low-latency, resilient APIs in distributed systems, drawing on practical experiences from eBay. It emphasizes latency budgeting, optimizing network hops, managing serialization overhead, and employing resilience patterns like caching and circuit breakers. The core focus is on actionable techniques to achieve sub-100ms API response times by addressing common bottlenecks in complex service interactions.

Read original on InfoQ Architecture

The Imperative of Low-Latency APIs

In distributed systems, every millisecond counts, as user experience is highly sensitive to latency. The article highlights that users perceive latency as "friction" which compounds across interactions. Achieving sub-100ms API response times requires a systematic approach, where latency is treated as a critical architectural constraint from the outset. This involves more than just optimizing code; it demands careful consideration of network interactions, data serialization, and resilience strategies across multiple services.

Latency Budgeting: A Strategic Approach

A key strategy presented is the concept of latency budgeting, where the total end-to-end latency goal is broken down and allocated to each hop or component in the request path. This provides concrete performance targets for individual teams and ensures alignment across product, engineering, and quality assurance. A typical breakdown might include allocations for edge layers (TLS, routing), API gateways (authentication, throttling), application logic (microservices), and data access layers.

💡

Example Latency Budget Allocation

Client-to-Edge: 10ms (TLS handshake, initial routing)Gateway: 5ms (Authentication, throttling)Application Logic: 30ms (Single or multiple microservices)Data Access Layer: 20ms (Entity service, database queries)Buffer: 10-15ms (For unexpected delays or spikes)

Identifying and Mitigating Latency Bottlenecks

  • Network Hops: Minimizing inter-service calls, especially synchronous ones, is crucial. Considering gRPC for internal service communication with heavy data payloads can be more efficient than REST/JSON.
  • Serialization/Deserialization: Large JSON payloads can introduce significant overhead. Tailoring response data based on client needs (e.g., using GraphQL for read-heavy services) can reduce this. The cost of serialization is often overlooked.
  • Cold Caches & DB Query Shape: Cache misses lead to slower database lookups. Properly tuning database queries and ensuring correct constraints are vital.
  • Queuing and Contention: Thread pool sizing and managing increased queue sizes during downstream failures are critical to prevent cascading failures and increased latency.
  • Dependencies: Total SLA is often dictated by the slowest dependency. Asynchronous fan-out patterns can help, but managing their complexity is key.
  • Observability Overheads: Excessive logging or tracing can add minor but cumulative latency. Balancing observability needs with performance is important.

Resilience Patterns for Consistent Performance

To maintain low latency under stress, robust resilience patterns are indispensable. This includes implementing circuit breakers to prevent calls to failing services, graceful degradation strategies, and intelligent retry mechanisms. The article emphasizes that building a low-latency system is achievable, but sustaining it requires continuous engineering effort, monitoring, and a repeatable process to identify and address performance regressions as systems evolve and scale.

ℹ️

Actionable Insight

Eliminating a single network hop often saves more time than rewriting thousands of lines of code. Prioritize reducing inter-service communication overhead.

latencyapidistributed-systemsperformance-optimizationmicroservicesresiliencecachingdesign-patterns

Comments

Loading comments...