How would you design an experiment measuring API latency impact on retention?

Causal experiment design linking API latency to retention.
Randomize users into control and delay groups; track D7 retention and P99 latency; analyze with quantile metrics.
Using observational data or mean latency only.
What's really being asked
This question evaluates whether you can construct a causal experiment rather than rely on correlation. The interviewer wants to see if you understand user-level randomization, know how to inject latency technically without breaking functionality, and can pick metrics that reveal tail effects rather than hiding them in averages. It also checks your ability to connect a systems-level change to a business outcome like retention.
The full answer
First, randomization at the user ID level so that every request from a given user lands in the same bucket, preventing mixed experiences that dilute the treatment effect. Second, a clear technical implementation such as adding deterministic sleep or throttling at the API gateway or middleware based on the user's experiment bucket; the delay should be consistent per user and applied server-side to avoid client variability. Third, metric selection that pairs a primary business metric like D7 or D30 retention with secondary latency metrics including mean, median, and upper quantiles such as P95 and P99. Fourth, analysis using quantile testing to compare the full distribution of latencies across groups, because a treatment might rescue tail experiences without moving the mean. Fifth, guardrail metrics like error rate and session length to ensure the latency injection does not degrade stability or trigger timeouts.
The mistakes people make
A major red flag is proposing to analyze historical slow requests versus fast requests without randomization, which invites confounding variables like device type or network quality. Another is injecting latency client-side or only on certain endpoints, creating an inconsistent user experience that makes retention impossible to attribute. Relying solely on mean latency is also weak because it masks outliers; a P99 of two seconds can coexist with a mean of two hundred milliseconds, and those tail users are often the ones who churn.
What usually comes next
The interviewer may ask how you would handle network effects if the API is backed by a shared cache or database, since synthetic slowdowns in treatment could spill over and hurt control users. They might also ask how long you would run the experiment to detect a retention signal, which is typically weeks rather than days because retention is a lagging indicator. Another follow-up is how you would segment results by user cohort or device tier to see if latency sensitivity differs across populations.
A concrete example
Suppose your control group hits the origin server directly with a P99 API latency of one thousand four hundred sixty milliseconds and a D7 retention rate of sixty percent. Your treatment group is routed through a new edge cache implementation that drops P99 to four hundred sixty four milliseconds, while the mean only falls from two hundred thirty nine milliseconds to one hundred ninety nine milliseconds. Quantile metrics reveal the tail improved dramatically, and D7 retention rises to sixty five percent. Without quantile testing you might have only seen the forty millisecond mean improvement and missed the causal link between tail latency and retention.
Interview question
When designing an A/B test to measure how API latency impacts D7 retention, which setup best isolates causality?
- a.Compare historical users with naturally high latency against those with low latency from observational logs
- b.Inject delays client-side on a subset of endpoints and use mean latency as the primary success metric
- c.Randomize each API request independently so the same user may experience both fast and slow responses
- d.Bucket users by user ID, inject a consistent server-side delay per bucket, and track D7 retention alongside P99 latencyCorrect
Why? this is the answer
User-level randomization with consistent server-side delays ensures the only systematic difference between groups is the injected latency, establishing causality. Comparing historical slow versus fast requests is confounded by variables like device type or network quality, so retention differences cannot be attributed solely to latency.
Just read this? Test yourself on what you have been reading.
Read the original → growthbook.io
- #experiment design
- #latency
- #a/b testing
- #quantile metrics
- #retention
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles