Sub topic 2
Making Quality Targets Measurable: SLIs, SLOs, and SLAs
Assume you know basic web APIs, databases, caching, and short Python programs. This chapter turns vague quality goals into targets that engineers can measure and test.
SLIs, SLOs, and SLAs
A service-level indicator (SLI) is a measured value, such as redirect latency or successful request rate. A service-level objective (SLO) is the target for that value. A service-level agreement (SLA) is a customer-facing commitment, often with a remedy if the target is missed.
| Term | Meaning | Example |
|---|---|---|
| SLI | What you measure | Successful redirects |
| SLO | Internal target | 99.9% success over 30 days |
| SLA | External commitment | Credit if success falls below 99.9% |
def downtime_budget_minutes(availability, days=30):
return (1 - availability) * days * 24 * 60
print(downtime_budget_minutes(0.999)) # 43.2
print(downtime_budget_minutes(0.9999)) # 4.32Performance, Availability, and Reliability
Latency is the time required to complete one operation. Throughput is the amount of work completed per time unit, such as requests per second. Use percentiles because averages hide slow requests. A target such as “99% of reads finish within 100 ms” is more useful than “average latency is 20 ms.”
Availability measures whether a service is usable. Reliability describes its ability to keep working correctly over time, including recovery from failures. An availability target becomes a downtime budget. For example, 99.9% availability over 30 days permits about 43.2 minutes of unavailable time.
Scalability
A scalability requirement states how load may grow while targets remain satisfied. Record expected users, requests per user, peak factors, and data growth. These assumptions guide capacity estimates and architecture choices such as caching, replication, or partitioning.
Consistency, Durability, Security, and Compliance
Consistency specifies when reads must reflect writes. A payment balance may require immediate consistency, while a search index may tolerate delay. Durability specifies whether acknowledged data survives failures.
Security requirements should name controls and outcomes: encrypted transport, authenticated access, authorization checks, audit logs, and a maximum time to revoke access. Compliance requirements should identify the applicable rule, data location, retention period, and evidence required.
Exercise
Classify this requirement: “99% of API requests complete within 200 ms over a rolling 30-day window.”
Show answer
It is an SLO. Its SLI is request latency, and its target is the 99th percentile being at most 200 ms.