# What Is a p95/p99 Latency Budget?

> What p95 and p99 mean, how a time budget is set and split across an AI request, and how to defend it for your AI interview.

**In short:** A latency budget is the longest wait an AI feature may impose, promised at a percentile. p95 means 95 out of 100 requests finish within the limit, and p99 is the time 99 out of 100 beat, so it exposes the slowest one in a hundred. Teams budget the tail, not the average, and split the total across each step.

AI and LLM interview question Q344, Inference, performance and cost. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-a-p95-p99-latency-budget

## Say it in 30 seconds

A latency budget is the time we allow a request to take, promised at a percentile. A p95 of 3 seconds means 95 out of every 100 requests finish within 3 seconds. I also set p99, because the average hides the slow few, and those are the users who give up. I split the total across each step, like search, the model and the checks, so I know which step to fix when the budget is missed.

## Say it in 2 minutes

Latency is how long a user waits for an answer. A percentile tells you how that wait is spread out. The p95 is the time that 95 out of every 100 requests beat. The p99 is the time that 99 out of 100 beat, so it catches the slowest one in a hundred. A latency budget is the limit we promise at those points, for example a p95 under 3 seconds and a p99 under 6 seconds.

I set both because an average can look healthy while some users wait far too long. Take a claims assistant that answers policyholders. Its average answer might come in around 1.4 seconds, which looks fine. But if the p99 is over 6 seconds, those are the people who give up and phone the office. The average never shows them.

Then I split the budget across the steps: finding the policy clauses, the model writing the reply, the checks on amounts and the screen. Each step gets a share, and the step that runs over its share gets the most attention. OpenAI's latency guide says to time the whole journey, from the user's action through retrieval, model and tool calls, retries and rendering, so the budget covers all of it.

Last, I set timeouts from the same numbers, and I alarm on p95 and p99 rather than the mean. A timeout set too low sends more retries and makes the slowdown worse, so the timeout must come from the measured tail.

## What is a p95/p99 latency budget, in plain words?

Latency is the wait between a user asking and the answer appearing. A latency budget is the longest wait we promise, and the promise is set at a percentile. A p95 of 3 seconds means 95 out of every 100 requests finish within 3 seconds.

Think of a bank's call centre. It might promise that 95 calls out of 100 are answered within 30 seconds. A call centre does not have to promise the average, because the average can look fine while a few callers wait ten minutes. Those callers are the ones who complain.

An AI feature has the same problem. A claims assistant that answers policyholders is quick most of the time, then stalls when the model queue is busy or a database is slow. So the budget sets a limit at p95 and at p99, and the total is split across each step the request passes through.

- **Latency:** How long the user waits, from pressing send to the answer on screen.
- **Percentile:** The time that a given share of requests finish within.
- **p95 and p99:** The 95th and 99th percentiles: the times that 95 and 99 out of every 100 requests beat.
- **Tail latency:** The slowest few requests, the ones past p95 or p99.
- **Latency budget:** The time limit we promise at each percentile, shared out across the steps.

## What do p95 and p99 mean in practice?

A percentile is a position in a sorted list of timings. Amazon's CloudWatch monitoring service describes it as the value that a share of the data sits under, and that is how p95 and p99 are read here.

Here is a made-up hour of 205 requests to a claims assistant, run as a short Python script. The average is 1.4 seconds, which looks healthy. The p95 is 1.7 seconds, inside its 3 second limit. The p99 is 6.3 seconds, over its 6 second limit, so the slowest one in a hundred broke the promise.

```python
import math

# A made-up hour of 205 requests to a claims assistant, in milliseconds.
# Most answers are quick; a few hit a slow database or a busy model queue.
latencies = [800 + (i * 37) % 900 for i in range(200)]
latencies += [4200, 5100, 6300, 7900, 9800]

def percentile(values, p):
    # Nearest rank: the time that p out of every 100 requests finish at or under.
    ordered = sorted(values)
    return ordered[math.ceil(p * len(ordered) / 100) - 1]

budget = {95: 3000, 99: 6000}  # the allowed time, in ms, at each percentile
print("requests:", len(latencies))
print("mean:", round(sum(latencies) / len(latencies)), "ms")
for p, limit in budget.items():
    value = percentile(latencies, p)
    status = "OK" if value <= limit else "OVER"
    print(f"p{p}: {value} ms, budget {limit} ms, {status}")
```

Output:

```text
requests: 205
mean: 1369 ms
p95: 1676 ms, budget 3000 ms, OK
p99: 6300 ms, budget 6000 ms, OVER
```

The average would never have shown the problem. The next step is to find which part of the request makes up that slow tail, then set a limit on that part.

## Where does the budget go?

A chat reply has several steps, and each one takes time. The budget is the total allowed for all of them together, and each step gets a share of it. Sharing it out tells you which step to fix when the total is missed.

*Diagram, One chat reply, split into steps: One chat reply passes through four steps. The budget is the time allowed for all of them together, and each step is timed on its own, so the slow one can be found.*
1. The question arrives, and the clock starts.
2. The assistant looks up the clauses it needs.
3. The model writes a draft from those clauses.
4. Code checks the amounts before the reply is shown.

- **Split by step: Each step has a share.** The shares show where the time goes, so the slow step shows up straight away.
- **One total: Only one big number.** It says the reply is slow, but not which step is the cause.

Shares show where to look, not a guarantee. Each step can stay inside its share while the whole reply still misses the end-to-end p99, so measure the whole journey directly as well.

OpenAI's latency guide makes the same point from the model side. It asks teams to time the whole journey, from the user's action through retrieval, model and tool calls, retries and rendering, and to compare the median (p50) and the 95th percentile (p95) on representative traffic.

A budget that covers only the model call misses the retrieval and the screen. Users feel the whole wait, so the budget has to cover the whole wait.

## Why budget the tail, not the average?

The slow few are called the tail. Google researchers wrote about this in 2013, in a paper called The Tail at Scale. The paper is about large online services, and the same risk grows with scale for AI features too.

> "Temporary high latency episodes which are unimportant in moderate size systems may come to dominate overall service performance at large scale." (Google researchers, The Tail at Scale (2013))
>
> "If you monitor the average, this can hide anomalies." (Amazon CloudWatch documentation)

Fan-out makes this worse. If one answer waits on ten steps, and each one is slow one time in a hundred, then about 1 answer in 10 hits at least one slow step, if the steps are independent. Ten rare events add up to a common one.

The same paper notes that a system answering within 100 milliseconds feels more fluid to users, so the aim is to keep the slow few under the promise.

> **Tip:** Asked why p99 matters more than the average? Say the average hides the slow few, and one slow step in a chain of steps makes the whole reply slow.

## How do you set and defend a budget?

Measure real traffic first. Then set the promise, split it across the steps, and set the timeouts from the same numbers.

1. **Measure real traffic:** Time each step on real requests, grouped by task, so the slow kinds of request stand out.
2. **Set the promise:** Pick p95 and p99 limits for the whole journey, the time the user actually waits.
3. **Split it across steps:** Give each step a share, and leave room for retries and the screen.
4. **Set timeouts from the tail:** Amazon chooses a rate of false timeouts it can accept, then reads the matching percentile of the service it calls.
5. **Alarm on percentiles:** CloudWatch can use a percentile as an alarm's statistic, so the alarm watches the slow end instead of the average.

> "we choose an acceptable rate of false timeouts (such as 0.1%). Then, we look at the corresponding latency percentile on the downstream service (p99.9 in this example)." (Amazon Builders' Library)

Timeouts cut both ways. Amazon notes that a timeout set too low brings more traffic to the backend and more latency, because too many requests get retried. A timeout set too high keeps resources busy while the client waits. Amazon's usual answer to failing retries is to limit how many times a client retries. Set the timeout from the measured tail, then test it under load.

Amazon says the percentile method works well in most cases, but not where clients have substantial network latency, such as over the internet. Measure that case separately.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] p95 means 95 out of 100 requests finish within the time, and p99 covers the slow tail.
- [ ] Why the average can hide the slow few.
- [ ] The budget covers the whole journey, split across the steps.
- [ ] Timeouts come from the measured tail of the service called, with retries capped.
- [ ] Alarms on p95 and p99, measured on real traffic.
- [ ] Finding the slow step first, then fixing that step.

**Common traps**

- Trap: "Our average is fine, so the budget is met." Better: The average hides the slow few. Check p95 and p99 for each step on real traffic.
- Trap: "Set the timeout high so nothing fails." Better: A high timeout keeps resources busy while the client waits. Set it from the tail of the service it calls.
- Trap: "We will add a bigger model to speed it up." Better: A bigger model can be slower per answer. Measure the step first, then fix the one with the slow tail.

## Can you spot the problem?

**Spot the budget miss:** A claims team reports that the average answer is 1.4 seconds and says the budget is fine. Which measure tells the truth?

A. The average over the last month
B. The p99 for each step, measured on real traffic
C. The fastest answer from the demo
D. The number of users who logged in

**Answer:** B. An average can look healthy while one request in a hundred waits far too long. The p99 for each step shows where the slow tail is, so the fix goes to the right place.

**Quick check:** A feature calls the model, then a policy database, then a payments check. Which change does the most to keep the p99 within budget?

A. Raise the average budget
B. Set each call's timeout from its slow tail, and cap the retries
C. Remove the p99 alarm
D. Use only the numbers from the demo

**Answer:** B. A timeout taken from the tail stops one slow call from holding up the whole reply, and a retry cap stops retries from piling up. The other options hide the problem or ignore real traffic.

## Can you answer these from memory?

**Flash cards**

- **What is p95?** The time that 95 out of every 100 requests finish at or under.
- **What is p99 for?** It covers the slowest one in a hundred, which an average hides.
- **Why not budget the average?** It can look healthy while some users wait far too long.
- **What does the budget cover?** The whole journey, from the user's action to the screen, split across steps.
- **Where does a timeout come from?** The matching percentile of the service it calls, at a rate of false timeouts you accept.
- **What should alarms watch?** Percentiles like p95 and p99 on real traffic, not the mean.

## Likely follow-up questions

- Q316 TTFT vs tokens/sec vs total latency? https://designervenkat.online/interview/ai/ttft-vs-tokens-per-second-vs-latency
- Q317 The latency vs throughput trade-off? https://designervenkat.online/interview/ai/the-latency-vs-throughput-trade-off
- Q272 How do you track latency and cost in evals? https://designervenkat.online/interview/ai/how-do-you-track-latency-and-cost-in-evals
- Q369 How do you design for low latency? https://designervenkat.online/interview/ai/how-do-you-design-for-low-latency
- Q340 How do reasoning tokens affect cost and latency? https://designervenkat.online/interview/ai/how-do-reasoning-tokens-affect-cost-and-latency

## Learn it in depth

- [Watching cost and speed](https://designervenkat.online/learn/ai-engineering/cost-latency-monitoring)
