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?
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
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- 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 QuestionsSample Answer
Clarify
Independent sampled requests, latency standard deviation ms, target half-width ms at 95% confidence (). The latency distribution is skewed but has finite variance...
Approach
By the CLT, the sample mean is approximately normal with standard error . Set and solve for ....