Achieving Sub-100ms API Design in Distributed Systems
In the complex world of distributed systems, achieving consistently low latency is a significant engineering challenge. This report delves into the critical strategies for designing APIs that respond in under 100 milliseconds. We will explore how to meticulously manage latency budgets across various system components, drawing parallels to real-world scenarios like navigating public transport to illustrate the impact of unexpected delays.

Table of Contents
The presentation, “From Fan-Out to Fast: Sub-100ms API Design in Distributed Systems,” by Saranya Vedagiri, a Staff Engineer at eBay with nearly two decades of IT experience, offers practical patterns for senior engineers, architectural trade-offs for architects, and strategic insights for leaders. The core principle is treating latency not as an abstract number, but as user-perceived friction that compounds with every delay.
Chapter 1: Latency Budgets – Defining and Managing Performance Targets
Establishing a latency budget is the foundational step towards building high-performance APIs. This involves defining a clear target response time, such as 50 milliseconds for a recommendation engine, and ensuring the system architecture can support it. A well-defined budget aids in prioritization, preventing unnecessary optimization on non-critical paths, and fosters alignment across product, engineering, and quality assurance teams.
The complete request path, from client to response, must be segmented into sub-parts, each with an allocated budget. A suggested breakdown includes 10 milliseconds for the edge layer (handling TLS and initial routing), 5 milliseconds for the gateway (authentication and throttling), and a significant 30 milliseconds for application logic. The data access layer receives a further allocation, with a crucial buffer of 10-15 milliseconds set aside to absorb unexpected delays and ensure overall stability.
Chapter 2: The Request Journey – Tracing the Path of a Fast Request
Understanding the typical request journey is vital for identifying hidden latency sources. A request travels from the client through the edge, gateway, application logic, and persistence layer before returning. Components like serialization, particularly JSON payload translations, can significantly impact perceived API speed, even if the application logic itself is fast.
Network hops, including TLS handshakes and connection pooling, are major latency contributors. Removing even a single hop can yield substantial performance gains. When an item service needs to aggregate data from multiple downstream services, the decision between synchronous and asynchronous calls becomes critical. For internal communication, gRPC can offer faster performance, especially with large data payloads, while public-facing REST services might benefit from JSON for readability.
Serialization costs increase with payload size. Customizing responses based on client needs, rather than sending exhaustive data, can mitigate this. Considering alternatives like GraphQL for read-heavy services is also a strategic decision. Latency can also hide in cold caches, inefficient database queries, queuing, thread contention, and the cumulative SLAs of numerous dependencies. Insufficient observability, such as limited tracing, further exacerbates these issues.
Chapter 3: Scenarios and Fixes – Addressing Common Latency Pitfalls
A common scenario involves seemingly healthy p95 and p99 latency metrics, yet users still experience timeouts. This discrepancy often arises when a small percentage of failures for a high-volume system translates into a significant impact for a specific client, especially in critical transaction paths like checkout. Investigating such issues requires mapping client-side logs to internal system traces.
Leaders play a crucial role in ensuring comprehensive observability is built into services from the outset, as retrofitting these metrics during an incident is often too late. The ability to trace and correlate issues across different services is paramount. For instance, if an item service call from checkout fails, even for a fraction of a percent of transactions, it can lead to lost revenue and customer dissatisfaction.
The focus on sub-100ms API design must extend to understanding and mitigating these edge cases. This involves deep dives into client-specific failure patterns and ensuring that observability tools provide granular insights. Without robust tracing and logging, diagnosing and resolving these subtle yet impactful latency issues becomes exceedingly difficult, undermining the goal of a consistently fast user experience.
Chapter 4: Trade-offs, Measurement, and Future Outlook
Implementing low-latency systems involves inherent trade-offs. For example, reducing network hops might increase complexity elsewhere, or choosing a faster serialization format could impact readability. Architects must carefully weigh these factors against business requirements and system constraints. The decision between using a monolithic service versus numerous microservices, each introducing network overhead, is a prime example of such a trade-off.
Measurement is indispensable for success in achieving sub-100ms API design. Without continuous monitoring and performance testing, it’s impossible to gauge progress or identify regressions. Tools that provide real-time insights into latency, error rates, and resource utilization are essential for maintaining performance targets over time. Regularly analyzing these metrics helps in proactively addressing potential bottlenecks before they impact users.
The pursuit of sub-100ms API design is an ongoing engineering effort, not a one-time fix. It requires a repeatable process, a deep understanding of system dynamics, and a commitment to continuous improvement. By meticulously budgeting latency, tracing request journeys, addressing common pitfalls, and embracing robust measurement, teams can build and maintain distributed systems that deliver exceptional performance and user satisfaction.



