InterviewStack.io LogoInterviewStack.io

Latency Analysis & Optimization Questions

Understanding and reducing response time across the request path, including tail latency, latency budgets, and critical-path analysis. Covers where latency accumulates (compute, I/O, serialization, network hops, queuing), percentile-based reasoning (p50/p95/p99), and targeted techniques to shave the dominant contributors. Focuses on end-to-end latency as an engineered property rather than an incidental one.

MediumTechnical
26 practiced

Implement a thread-safe latency histogram aggregator in Go that records integer millisecond latencies into exponential buckets (e.g., 1ms,2ms,4ms,... up to a max). Provide methods: Record(latencyMs int) and Percentile(p float64) returning an approximate value. Explain concurrency control, memory usage, and how you would merge histograms across processes for global percentiles.

MediumTechnical
28 practiced

Describe a reproducible benchmarking methodology to measure end-to-end request latency for a REST service. Cover warmup period, generating realistic load patterns (bursty vs steady), avoiding client-side bottlenecks, environment isolation, eliminating benchmark artifacts (CPU frequency scaling, cold caches), and how to report percentiles with confidence intervals.

MediumTechnical
24 practiced

A Kubernetes deployment is experiencing restarts and increased latency during traffic surges. The liveness probe is configured to run every 10s and performs a complex health check that does some I/O. Diagnose how readiness/liveness probes might cause or exacerbate latency spikes and propose concrete fixes, including probe tuning and alternative patterns.

HardSystem Design
28 practiced

Design a retention and sampling policy for traces and metrics that allows SREs to debug latency spikes from the last 30 days, while keeping storage and egress costs within a fixed budget. Include tiered retention (hot/cold), sampling/sketching approaches, aggregation rollups, and how to keep high-fidelity data for critical windows.

MediumTechnical
25 practiced

Given a simplified OLTP schema below, propose concrete indexes to optimize the supplied queries and explain the trade-offs (write amplification, disk usage, index-only scans):

Tables:
users(id PK, email text, created_at timestamptz)
orders(id PK, user_id FK, total numeric, status text, created_at timestamptz)
line_items(id PK, order_id FK, product_id int, qty int)

Queries:

  1. SELECT * FROM orders WHERE user_id = ? ORDER BY created_at DESC LIMIT 20
  2. SELECT COUNT(*) FROM orders WHERE status = 'failed' AND created_at > now() - interval '30 days'
  3. SELECT SUM(total) FROM orders WHERE created_at BETWEEN ? AND ?

Unlock Full Question Bank

Get access to all Latency Analysis & Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.