Skip to content
tezvyn:

Prove API Latency Affects User Engagement

Source: optimizely.comHardHow cards are made

Prove API Latency Affects User Engagement

This tests your ability to design a controlled experiment for a backend attribute. A great answer outlines an A/B test that artificially adds latency for a treatment group, details the necessary logging with shared IDs, and explains how to join and analyze…

What's really being asked

This question assesses your ability to move beyond simple correlation and design a scientifically valid experiment to prove causation. It tests your systems thinking (connecting backend performance to business KPIs), data engineering skills (instrumentation and joining disparate datasets), and your understanding of product analytics.

The full answer

First, clearly state the hypothesis and define metrics. The primary metric could be 'items viewed per session,' and secondary metrics could be 'session duration' or 'add-to-cart rate.' Second, propose a controlled A/B experiment. The best method is to artificially introduce a fixed amount of latency (e.g., 300ms) via a server-side feature flag for a randomly selected cohort of users (the treatment group). The control group sees no change. Third, describe the instrumentation. Both API performance logs and user analytics events must be tagged with a common identifier, like a 'session_id' or 'request_id', as well as the experiment variant ('A' or 'B'). Fourth, explain the analysis. You would join the performance logs with the analytics events on the shared ID, group the results by experiment variant, calculate the primary metric for each group, and determine if the difference is statistically significant (e.g., p-value < 0.05).

The mistakes people make

Suggesting a purely observational study is the biggest red flag. For example, plotting historical latency against historical engagement is only correlation, not causation. A third variable, like a marketing campaign, could be driving both high traffic (and thus high latency) and low-intent users. Another common mistake is a vague data joining strategy. Simply saying 'we'll join the logs' is insufficient. You must specify the join key (e.g., session_id) and confirm it's available in both data sources. Finally, proposing a poor experimental design, like splitting users by time of day or geography, introduces confounding variables and invalidates the results.

What usually comes next

Be prepared to discuss how much latency to add (a small, perceptible amount like 200-500ms is a good start). A follow-up could be 'What if you can't add latency?' In that case, you could segment users by naturally observed latency, but you must call out that this is a weaker, correlational approach. Expect questions on rollout safety, such as using a feature flag system, starting with a 1% traffic split, and monitoring error rates.

A concrete example

Hypothesis: Adding 300ms of latency to the '/api/search' endpoint will decrease the 'click-through rate' from the search results page by at least 2%. We'll run an A/B test on 10% of traffic, with 5% in the control (A) and 5% in the treatment (B). The treatment group will have a 'sleep(300ms)' call injected in the API handler. Every API log and frontend analytics event will be tagged with a unique 'session_id' and the user's variant. After collecting 100,000 sessions, we will join the datasets on 'session_id', group by variant, and calculate the click-through rate for each. We then check if the observed drop for variant B is statistically significant.

Interview question

To *prove* that increased API latency *causes* a decrease in user engagement, which experimental design is most scientifically sound?

  • a.Implementing an A/B test where a random subset of users experiences artificially introduced latency, with data joined by a common identifier.Correct
  • b.Continuously monitoring real-time API latency and user engagement dashboards to observe simultaneous dips.
  • c.Analyzing historical trends to identify periods where high latency coincided with low engagement.
  • d.Comparing user engagement metrics between geographical regions, where one region's API is intentionally slowed down.
Why?

The card emphasizes that proving causation requires a controlled A/B experiment where latency is artificially introduced to a random treatment group, and data is joined using a common identifier. Options A and D describe observational studies that can only show correlation, not causation. Option D is a poor experimental design as geographical differences introduce confounding variables.

Just read this? Test yourself on what you have been reading.

Read the original → optimizely.com

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.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on systems design — each one lists the topics its interview covers.

See open roles