Implementation·Glossary term

Latency

Latency A/B testing Reference guide

Latency is a concept used in technical implementation.

Quick definition: Latency is the time between a request, action, or event and the response a user or system can use. In experimentation, it is both a product-quality measure and a possible cause of unequal treatment delivery.

What is latency?

Latency describes delay. It may mean the interval from a tap to a screen update, from a browser navigation to useful content, from an API request to a response, or from an experiment decision to a visible variant. It is not the same as throughput: a service can process many requests per second while individual requests are slow. It is also not simply “page speed.” A fast first paint can coexist with a delayed recommendation, checkout calculation, or experiment-controlled component.

For an A/B test, the important question is which delay is relevant to the hypothesis. A test of a new search ranker may care about request-to-results latency. A client-side banner test may care about the time from navigation to stable rendering. A remote configuration test may care about decision latency before the app chooses a feature path. Define the boundary in plain language, the clock used, and the event that ends the interval before collecting data.

Teams commonly report p50, p95, and p99 latency rather than only an average. The median represents a typical request, while upper percentiles expose the long tail that affects slower devices, networks, regions, or dependency paths. A 20-millisecond median improvement does not compensate for a p99 regression that makes a primary flow unusable. Pair latency with timeout, error, and abandonment measures so a supposedly faster result cannot be achieved by failing early.

Technical mechanics behind latency

End-to-end latency is a chain of waits and work. A web request can include DNS lookup, connection setup, TLS negotiation, server queueing, application processing, database or third-party calls, response transfer, browser parsing, JavaScript execution, and rendering. On mobile, radio wake-up, device CPU, memory pressure, and application lifecycle add further variation. A single total number is useful for user experience, but component timings are needed to locate a regression.

Instrumentation should create timestamps at meaningful boundaries, using a monotonic clock when measuring durations within one process. Cross-service clocks can drift, so distributed traces should propagate a request or trace identifier rather than relying only on wall-clock subtraction. Record the experiment ID, configuration version, arm, route or operation, status, and a coarse environment segment. Avoid putting raw identifiers, passwords, or sensitive payloads in timing logs.

Caches, retries, queues, and fallbacks complicate measurement. A cache hit can be faster than a miss but may return data calculated for a different experiment arm if the assignment is absent from the cache key. A retry can turn a transient failure into a slow success; it must be visible as a retry, not silently counted as an ordinary response. A timeout fallback may preserve the user journey, but it means the intended treatment was not delivered. These states are part of the result, not implementation noise.

Budgeting helps turn a broad concern into an engineering decision. A checkout experiment might reserve 80 milliseconds for assignment and pricing logic inside a 400-millisecond response target. Each dependency receives a timeout that leaves time for a safe fallback. Budgets should describe both the desired percentile and the action after a breach, such as serving control, using a cached response, or disabling a nonessential module.

Latency and experiment validity

Latency can change the treatment itself. If a new experience waits for a remote decision, visitors on slow connections may see the default instead, see content change after interaction, or leave before exposure. That makes the delivered population different from everyone assigned to treatment. Review the path from eligibility through assignment, decision, render, and qualified exposure; an assignment event alone does not prove that the user received the variant.

Choose the analysis population deliberately. Assignment-level, or intent-to-treat, analysis estimates the effect of assigning the new delivery system including its fallbacks. Exposure-level analysis estimates the effect among people who actually received the experience, but can be biased when delivery depends on device or network characteristics that also affect outcomes. Both views can be useful, yet neither should be substituted for the other after results are known. Report delivery and timeout rates by arm beside the primary metric.

Latency is often a guardrail rather than the primary success metric. A checkout simplification might improve conversion but add a payment-provider call that worsens p95 response time. Conversely, a faster ranking model may increase clicks by returning less relevant results. Pre-register the threshold and the decision rule: for example, continue only if the conversion effect is acceptable and p95 latency does not exceed a defined tolerance with no material error-rate increase. This prevents treating a technical regression as an acceptable surprise.

Stable assignment matters when latency causes retries or route changes. A user assigned at account level should not receive a new arm after a refresh merely because the first configuration request timed out. Preserve the assignment across sessions where the experience demands it, version the treatment, and make fallback behavior deterministic. Read more about sample planning and interpretation in the sample-size guide and primary versus guardrail metrics.

Example: testing a personalized checkout recommendation

An ecommerce team tests a personalized cross-sell module on the cart page. Control uses the existing curated list; treatment calls a recommendation service after cart data is available. The team assigns signed-in customers persistently before the request, passes the arm to the service, and gives the recommendation call a 120-millisecond budget. If the budget is exceeded, the existing list stays on screen and a fallback reason is logged.

Its event model records cart eligibility, assignment, request start, service response, timeout or error, module render, viewport impression, item click, cart conversion, and order value. The dashboard shows p50, p95, and p99 service and end-to-end render latency, segmented by app version, browser family, region, and arm. It also shows the percentage of assigned users who received a visible module. This separates a model-quality question from a delivery-quality question.

After one week, treatment has a higher click rate among successfully rendered modules but a much higher timeout rate on older Android devices. The team does not claim a universal gain. Its assignment-level conversion estimate includes those fallbacks, while its delivery diagnostics point to model cold starts and an oversized response. It optimizes the service, reruns quality checks, and keeps the rollout limited until the tail latency and exposure imbalance meet the pre-set criteria.

Monitoring and QA checklist

Monitor latency as a distribution, not a single dashboard tile. Track request count, p50/p95/p99 duration, timeouts, errors, retries, queue depth where relevant, fallback rate, and client-visible completion. Break each measure down by experiment arm, release version, endpoint or screen, platform, region, and useful connection or device categories. Alert on sustained changes and on arm differences that are large enough to affect the interpretation of a live test.

Before launch, test an ordinary path plus slow network, cold cache, unavailable dependency, malformed configuration, repeated request, background-to-foreground mobile transition, and older-device path. Confirm that every fallback is safe, measurable, and consistent with the declared control. Run an A/A test when the delivery path or telemetry is new: large arm differences in latency, exposure, or conversion during an A/A test can reveal assignment, cache, or logging defects before a product decision depends on them.

Use synthetic checks to catch a completely broken route, but rely on real-user telemetry for performance claims. Synthetic clients have stable locations, warm connections, and controlled hardware; customers do not. Retain enough raw or aggregated data to investigate a spike, with sampling rules that preserve rare slow paths. Link performance deployments and experiment configurations to releases so operators can distinguish a treatment regression from an unrelated infrastructure change.

Limitations and common mistakes

  • Using the mean alone: a small average improvement can hide severe tail delays.
  • Measuring the wrong boundary: fast API responses do not prove the user saw a fast screen.
  • Ignoring fallbacks: a control fallback in treatment is delivery information, not a successful treatment exposure.
  • Comparing unmatched populations: successful treatment renders may overrepresent fast devices and networks.
  • Changing cache keys carelessly: cached treatment output can contaminate control traffic.
  • Alerting on every fluctuation: noisy alerts obscure actionable sustained regressions.

Latency is also context dependent. A few additional milliseconds may be harmless for an optional dashboard refresh but unacceptable during payment confirmation or accessibility interactions. It cannot by itself establish customer value: faster content may be less accurate, less useful, or more costly. Combine performance measurements with task success, reliability, and the outcome the experiment was designed to improve.

FAQ

What latency percentile should an experiment use?

Use percentiles that match the risk of the journey, commonly p50 for typical experience and p95 or p99 for tail harm. Set the threshold before launch and supplement it with error and timeout rates.

Is latency a primary metric or a guardrail?

It can be either. It is primary when the hypothesis is about speed; otherwise it is usually a guardrail protecting the experience while another product outcome is evaluated.

Should timeout fallbacks be included in treatment results?

For an assignment-level question, yes: they are part of the effect of offering the treatment. Also report a clearly labeled delivered-exposure view and the fallback imbalance.

How do we avoid client-side experiment flicker?

Prefer a decision before first meaningful render when feasible, use a strict bounded fallback, and measure time to stable content. Hiding the whole page indefinitely merely trades flicker for delay.

Can a faster API still worsen the user experience?

Yes. It may return poorer recommendations, incomplete data, or an aggressive fallback. Evaluate user-visible completion and quality alongside technical timing.

Summary

Latency is the delay between an action and a usable result. In experiments, measure the right end-to-end boundary, inspect percentiles and delivery states by arm, and make timeouts and fallbacks explicit. A valid performance decision connects technical timing to actual exposure, reliability, and the user outcome the product intends to improve.

Sources