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).
Describe what p50, p95 and p99 percentiles mean for request latency and why p99 is often more important for user experience. Given latency samples (ms): [10, 20, 30, 1000, 1100], show how you'd compute p50, p95 and p99 approximately from the ordered list and interpret each result in terms of user impact.
Describe what resource pooling is and why connection pooling reduces latency for databases. What are the core parameters you'd tune when sizing a pool, how would you detect that a pool is being exhausted, and what would you do about it under load?
Design an architecture that provides low-latency reads for analytics combining OLTP DB state and near-real-time Kafka events, ensuring materialized views are fresh within 1 second and correct under failures. Consider change-data-capture (CDC), transactional boundaries, exactly-once or idempotent updates, and read routing for low latency.
Design an ingestion system for multi-GB files uploaded by global clients that minimizes time-to-first-byte and supports high throughput to backend processors. Discuss chunked parallel uploads, resumable uploads, edge signing, using CDN/edge for accelerated uploads, integrity verification, authentication, and streaming parts directly into processing pipelines with low latency.
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.
Unlock Full Question Bank
Get access to all 22 Latency Analysis & Optimization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.