Sample Size Needed to Pin Down Mean Search Latency

Last updated: November 29, 2026

Quick Overview

Search request latencies have a standard deviation of about 40 ms. How many requests must you sample to estimate mean latency within plus or minus 1 ms at 95% confidence, and what changes if you need the 99th percentile instead?

Google
Statistics & Math
Software Engineer
Google
November 29, 2026
Software Engineer
Technical Screen
Statistics & Math
Easy

0

0

0 solved


Search request latencies have a standard deviation of about 40 ms. How many requests must you sample to estimate mean latency within plus or minus 1 ms at 95% confidence, and what changes if you need the 99th percentile instead?

A practical estimation question for Google SWE and SRE candidates who design latency benchmarks. Interviewers check the CLT-based margin of error formula, quick arithmetic, and awareness that tail percentiles need far more data than means.

What the Interviewer Expects
  • Use margin E = z * sigma / sqrt(n)
  • Solve n = (1.96 * 40 / 1)^2, about 6,150
  • Note the CLT justifies normality even for skewed latency
  • Explain that halving the margin quadruples n
  • Explain percentiles need many tail samples and a different interval method
Key Topics to Cover
central limit theorem
margin of error
sample size
percentile estimation
heavy tails
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • How would you build a confidence interval for p99 latency?
  • What if requests are correlated in time (bursts)?
  • How would you compare latency between two binaries with the fewest samples?
  • Why might the standard deviation estimate itself be unreliable?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

Independent sampled requests, latency standard deviation σ≈40\sigma \approx 40 ms, target half-width E=1E = 1 ms at 95% confidence (z=1.96z = 1.96). The latency distribution is skewed but has finite variance...

Approach

By the CLT, the sample mean is approximately normal with standard error σ/n\sigma/\sqrt{n}. Set zσ/n=Ez\sigma/\sqrt{n} = E and solve for nn....


Submit Your Answer
Markdown supported