Video in progress

Explain the difference between SLI, SLO and SLA with an example.

An SLI is a measurable indicator (the share of successful requests), an SLO is the team's internal goal for that indicator (99.9% over 30 days), and an SLA is a legal agreement with the customer, with a penalty or compensation if it's broken.

📖 Answer

Using a payment service as the example:

  • SLI: the share of POST /payments requests completed within 500 ms with no 5xx. This is a formula, measured precisely.
  • SLO: over a 30-day window this share is ≥ 99.9%. The team works to it and makes decisions by it.
  • SLA: a contract with a bank: if it falls below 99.5% in a month, 10 percent of the service fee is refunded.

An SLA is usually set looser than the SLO. When the internal goal is broken, you still have a margin before the contract is breached.

What a good SLI looks like:

  • close to the user experience: not "CPU 70%" but "did the request succeed and was it fast";
  • as a ratio: good events / total events;
  • measured as close to the user as possible (the load balancer, the gateway), because if the service dies it can't record its own errors.

An SLI in PromQL:

sum(rate(http_server_requests_seconds_bucket{uri="/payments",le="0.5",status!~"5.."}[30d]))
/
sum(rate(http_server_requests_seconds_count{uri="/payments"}[30d]))

A spot where people often slip up in interviews: setting a 100% SLO. That is practically impossible and means making no changes at all.