Latency Analysis & Optimization Questions
Understanding and reducing response time across the request path: where latency accumulates (compute, I/O, serialization, network hops, queuing), percentile-based reasoning (p50/p95/p99/p999), tail-latency behavior (why the tail diverges from the median, fan-out amplification across dependencies, hedged/speculative requests and other targeted mitigations), latency budgets and SLOs, and critical-path or distributed-trace span analysis that pinpoints where a request's wall-clock time actually goes. Focuses on end-to-end latency as a measured, engineered property rather than an incidental one. This is distinct from profiling a codebase to find CPU or memory hotspots with flame graphs, sampling, or instrumentation tooling (that is performance-optimization-and-bottleneck-analysis), and distinct from the reactive process of triaging, mitigating, and running the postmortem for a live production incident (that is performance-optimization-and-incident-response).
Explain the difference between metrics, logs and traces for performance debugging. For a service experiencing intermittent latency spikes, give one concrete example of the kind of information you expect to find in each signal and describe how you would correlate them to find a root cause.
Design an observability strategy for latency engineering across polyglot microservices. Include choices for distributed tracing, sampling strategies (head vs tail sampling), span enrichment, correlating traces with metrics and logs, storage/retention, query performance, and balancing observability detail vs cost.
Explain the basics of distributed tracing for latency engineering: define trace and span, explain parent-child relationships, why context propagation matters, common sampling strategies, and the kinds of latency questions tracing helps answer. Discuss trade-offs associated with high sampling rates and high-cardinality trace data (storage and query cost).
Implement a function in Python that computes percentile values (p50, p95, p99) from a list of request latencies in milliseconds. The function should accept a list of numeric latencies and return the requested percentiles using the nearest-rank method. Discuss time and memory complexity and how you'd modify your approach for streaming data or very large datasets that do not fit in memory.
A request to your frontend A shows end-to-end latency of 800ms but instrumented spans for every RPC and local CPU time show only ~30-50ms each (A CPU 20ms, A->B network 20ms, B total 30ms, C total 30ms). What are plausible hidden causes for the large wall-clock latency that spans do not show, and describe three experiments or tooling probes you would run to surface the missing delay (e.g., tracing sampling, kernel run-queue metrics, strace for futex waits).
Unlock Full Question Bank
Get access to all 26 Latency Analysis & Optimization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.