Sub topic 2
Starting from user and business requirements
This chapter assumes you know what latency and throughput mean and how a request moves through a load balancer, a service and a database. It also assumes you can read short Python snippets. Here you will learn how to turn a product need into a first draft of a number.
Why targets start with people, not hardware
A target such as "p99 under 300 ms" means nothing until someone asks why 300 ms. If you pick numbers from what your current system achieves, you may overbuild or promise too little. If you copy numbers from another company, you inherit their needs.
Start from two sources:
- User needs. What does the person doing the task notice, and when do they give up?
- Business needs. What does a slow or failed request cost in revenue, contract penalties or support load?
The target is the smallest number that still satisfies both. Anything tighter costs money without a benefit anyone can point to.
Step 1: Describe the behavior in plain words
Write each requirement as something a user sees or a business relies on. These statements are vague, and that is acceptable at this stage.
- "Search results should feel instant."
- "Checkout must not fail during a flash sale."
- "A partner's nightly import must finish before their morning report."
Then ask which kind of requirement each one is. Interactive requests are about latency. Bulk and batch work is about throughput, meaning how much work finishes per unit of time. Most systems have both, and they are usually different endpoints with different targets.
Step 2: Make it measurable
Replace each vague word with a quantity, a percentile and a scope. Usually you need to ask for or assume these inputs:
| Question | Example answer |
|---|---|
| Which operation? | `GET /search` |
| What counts as success? | Returns HTTP 200 with results |
| How fast, for how many requests? | 95% within 200 ms |
| At what load? | Up to 3,000 requests per second at peak |
| Over what period? | Measured per rolling 30 days |
Percentiles come from the next chapters. For now, treat "95% within 200 ms" as "slower than 200 ms for at most 1 request in 20".
Step 3: Subtract what you do not control
A user's perceived delay includes time outside your servers: the device, the last-mile network and page rendering. Your server-side target must be smaller than the user-facing limit.
# Draft a server-side latency target from a user-facing limit
perceived_limit_ms = 200 # assumed: results "feel instant" below this
client_overhead_ms = 60 # assumed: rendering plus device network time
server_target_p95_ms = perceived_limit_ms - client_overhead_ms
print(server_target_p95_ms) # 140The same method works for throughput. A business statement about volume becomes a rate.
# Turn a business volume into a rate
checkouts_per_hour_at_peak = 50_000 # assumed from the sales forecast
checkouts_per_second = checkouts_per_hour_at_peak / 3600
print(round(checkouts_per_second, 1)) # 13.9Both snippets rest on assumed inputs. Write those assumptions next to the target so that someone can challenge them later.
Common errors
- Using one number for everything. A login request, a report export and a health check have different needs. Set targets per operation or per class of operation.
- Treating "as fast as possible" as a requirement. It has no stopping point. Ask what happens at 500 ms and at 2 s. If nobody can say, the requirement is not yet understood.
- Confusing a goal with a promise. An internal goal can be ambitious. A number you promise to customers should have slack, which later chapters cover under SLOs and SLAs.
- Ignoring failures. A fast error is not a success. Define in the requirement what counts as a good response.
- Skipping the cost question. Halving a latency target can more than double the infrastructure bill. Ask the business whether the gain is worth that.
What you carry forward
The output of this chapter is a short list of draft targets, each with an operation, a quantity, a scope and its assumptions. The next chapters sharpen those drafts. Percentiles define what "95% within 200 ms" means. A latency budget splits the 140 ms across components. SLIs and SLOs give the targets an official form. Measurement and load tests later show which drafts were wrong.
Exercise
A product manager says, "The product page must load quickly, and we expect 90,000 orders in the busiest hour of Black Friday." Users abandon the page after about 1 second. Assume 300 ms of client rendering and device network time. Write a draft server-side latency limit and the order rate in orders per second, and name one assumption each.
Show answer
Server-side limit: 1000 ms - 300 ms = 700 ms (for example, "95% of product page requests within 700 ms"). Assumption: the 300 ms client overhead is accurate and users abandon at 1 s. Order rate: 90,000 / 3600 = 25 orders per second at the busiest hour. Assumption: the forecast of 90,000 is right and the load is spread evenly within that hour. Real traffic will burst above the average, which a later chapter on peaks and headroom covers.