📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What is the difference between an SLI, an SLO and an SLA? How do you choose good SLIs for a .NET API, turn a latency percentile into an SLO, and calculate and use an error budget?

Defines SLI, SLO and SLA, covers choosing user-centred SLIs and where to measure them, turning latency percentiles into ratio-based SLOs from histograms, error budget maths and an error budget policy.

Mid-Level Theory Intermediate error-budget observability reliability sla sli slo

🎯 Key points

  • SLI = good events ÷ valid events (e.g. non-5xx requests under 300 ms ÷ all requests), measured close to the user
  • SLO = internal target for an SLI over a rolling window (e.g. 99.5% over 28 days), set from user needs, historical SLI data and dependency SLAs, and revisited each quarter
  • SLA = external contract with penalties, looser than the SLO; Azure service SLAs compose (multiply) for dependencies
  • Latency SLO as a ratio: 99% of requests faster than 300 ms, from the http.server.request.duration histogram (ASP.NET Core since .NET 8, still the standard metric in .NET 10), never averaged p99s
  • Error budget = 1 − SLO; 99.9% over 30 days ≈ 43 minutes or 0.1% of requests
  • Error budget policy: when spent, freeze risky releases and fund reliability work
  • Choose few SLIs per user journey (availability, latency, freshness/correctness); exclude synthetic traffic and client 4xx deliberately
  • Validate SLIs against user feedback: if customers complain while the SLI is green, the SLI is measuring the wrong thing

⏱ 30-second answer

An SLI is a measurement of user experience expressed as a ratio of good events to valid events, for example requests to /api/orders answered in under 300 ms with a non-5xx status ÷ all requests. An SLO is the internal target for that SLI over a rolling window, such as 99% over 28 days. An SLA is the external contract with financial penalties, deliberately looser than the SLO (say 99.5% vs 99.9%) so you breach the SLO first.

To turn a latency percentile into an SLO, rephrase it as a threshold ratio: "99% of requests complete in under 300 ms", computed from the ASP.NET Core http.server.request.duration histogram buckets, not by averaging p99s. The error budget is 1 − SLO: at 99.9% over 30 days that is about 43 minutes or 0.1% of requests. When the budget is spent, risky releases pause and reliability work takes priority. The trade-off: each extra nine costs far more engineering and infrastructure.

🗣 Full answer (senior)

How I would answer this in an interview

"An SLI, a service level indicator, is a number that reflects what users experience, and I always express it as a ratio: good events over valid events. For a .NET API that might be 'requests that returned a non-5xx status in under 300 milliseconds, divided by all requests, excluding health checks and synthetic traffic'. An SLO is the target I set for that ratio over a rolling window, for example 99.5% over 28 days. It's internal and it's an engineering tool. An SLA is a contract with customers, with credits or penalties if we miss it, so it's set looser than the SLO: if we promise 99.5%, we aim for 99.9% internally so we see trouble long before we owe anyone money.

Choosing SLIs is the part people rush. I start from user journeys, like 'place an order' or 'view my bookings', and pick two or three indicators per journey: availability, latency, and for async work freshness, like 'order confirmation emails sent within five minutes'. I measure as close to the user as I can: at the gateway or with ASP.NET Core's http.server.request.duration histogram rather than inside one method. For latency, I don't say 'p99 under 300 ms'; I say '99% of requests are faster than 300 ms' and compute it from histogram buckets, because that's a ratio I can add up across instances and time, whereas percentiles can't be averaged.

The error budget is just one minus the SLO. At 99.9% over 30 days, that's 0.1% of requests, or about 43 minutes of full downtime. The budget turns reliability into a decision: while there's budget left we ship freely; when it's gone, the error budget policy kicks in, risky releases pause and the team works on reliability. The mistake I see is picking SLOs at 99.99% because it sounds good, without checking what the dependencies can actually deliver."


The three terms

Term What it is Who sees it Example
SLI A measured ratio of good to valid events Engineers 99.82% of checkout requests succeeded in < 300 ms this week
SLO Target for an SLI over a window Engineering and product 99.5% over 28 days
SLA Contract with consequences Customers, legal 99.5% monthly availability or 10% service credit

Good SLIs for a .NET API

Journey type SLI Measured from
Request/response API Availability: non-5xx ÷ all valid requests http.server.request.duration count by http.response.status_code, or App Insights requests
Request/response API Latency: requests < threshold ÷ all Histogram bucket at the threshold (le="0.3")
Async processing Freshness: messages processed within 5 min ÷ all Custom histogram of enqueue-to-done time
Data pipeline Correctness: records passing validation ÷ all Custom counter
Low-traffic service Synthetic availability: successful runs ÷ runs Availability tests

Decide what counts as valid: usually exclude health checks, synthetic traffic (or measure it separately) and client errors such as 400 and 404, but count 429 if you throttled users unfairly.

Error budget maths

SLO Budget (ratio) Downtime equivalent over 30 days
99% 1% 7 h 12 min
99.5% 0.5% 3 h 36 min
99.9% 0.1% 43.2 min
99.95% 0.05% 21.6 min
99.99% 0.01% 4.3 min

Composite SLAs and dependencies

If your API needs App Service (99.95%) and Azure SQL (99.99%) in series, the best you can expect is roughly 0.9995 × 0.9999 ≈ 99.94% before your own bugs, so a 99.99% SLO would be fiction. Redundancy (zone-redundant SQL, multiple regions) raises the composite.

Production example

For an [order API] we set 99.5% availability and "99% under 400 ms" over 28 days, measured from the ASP.NET Core request duration histogram at the ingress. In [March] a [slow EF Core query release] consumed [70%] of the latency budget in four days; under the error budget policy we paused feature releases for [one sprint], fixed the query and added a performance test to CI, and the budget recovered by the end of the window.

🔍 What the interviewer is checking

Checks the candidate can define SLIs, SLOs and SLAs precisely, choose meaningful SLIs, do the error budget maths and use the budget to make decisions.

Green flags

  • SLIs as good ÷ valid ratios tied to user journeys, measured near the user
  • Latency SLOs as threshold ratios from histogram buckets, not averaged percentiles
  • Correct budget maths (99.9% ≈ 43 minutes per 30 days) and a real error budget policy
  • Mentions SLA < SLO and composite availability of dependencies

Red flags

  • Uses SLA and SLO interchangeably
  • Proposes CPU or server uptime as SLIs
  • Picks 99.99% with no reasoning about cost or dependencies

📚 Learn in depth

1. Why ratios

Ratios of good to valid events have useful properties: they're between 0 and 1, they can be summed across instances and time (add numerators and denominators), and they map directly to user experience ("1 in 200 requests failed"). Percentiles have none of these: the p99 of two instances is not the average of their p99s.

instance A: 1,000 requests, 10 bad        ┐
instance B: 9,000 requests, 9 bad         ├─► SLI = (10 + 9) / (1,000 + 9,000) = 99.81%
                                          ┘   (averaging 99.0% and 99.9% would give 99.45%: wrong)

2. Latency SLOs from histograms

ASP.NET Core (since .NET 8) publishes http.server.request.duration as a histogram in seconds. With OpenTelemetry, buckets are configurable; set a bucket boundary exactly at your threshold (0.3 s), otherwise the SLI is interpolated and inaccurate.

buckets: ... 0.1 | 0.25 | 0.3 | 0.5 | 1 ...
good = count(le="0.3")      valid = count(+Inf)
SLI  = good / valid

In KQL against Application Insights requests: countif(duration < 300 and success) / count().

3. Where to measure

user ─► Front Door ─► ingress ─► Kestrel/ASP.NET Core ─► handler ─► SQL
        ▲ best for availability     ▲ good, easy             ▲ too deep: misses queueing and routing

The closer to the user, the more failures you see (TLS, routing, queueing before Kestrel). Server-side metrics are easier and usually good enough; complement them with synthetic tests and RUM.

4. Windows

A rolling window (28 or 30 days) gives a continuous view and is what alerts use; a calendar window (monthly) matches SLA reporting. 28 days contains exactly four of each weekday, which avoids the weekly pattern skewing comparisons.

5. Error budget policy

An SLO without a policy is just a chart. A typical policy, agreed with the product owner:

Budget remaining Response
> 50% Ship normally; consider experiments
25-50% Extra review for risky changes
< 25% Only low-risk releases; reliability items prioritised
Exhausted Feature freeze except fixes and security; postmortem for the biggest consumers

The budget also works in the other direction: if you never spend it, the SLO is probably too loose or you're over-investing in reliability.

6. SLAs and money

SLA breaches usually mean service credits. Azure publishes per-service SLAs, and your SLA to customers must account for what you depend on. Australian B2B contracts often include availability schedules; legal and product own the SLA, engineering owns the SLO that protects it.

Try it yourself

  1. For 99.95% over 28 days, calculate the budget in minutes and in failed requests at 2 million requests a day.
  2. Configure an OpenTelemetry view in .NET that sets histogram buckets for http.server.request.duration including 0.3, and export to Prometheus.
  3. Write the availability and latency SLIs in PromQL over 28 days, and in KQL against requests.
  4. Compute the composite availability of your own service's dependencies from the Azure SLA pages.
  5. Draft an error budget policy for your team and ask your product owner to sign it off.

💻 Code

Setting histogram buckets so the latency SLI is exact, plus the SLI queries in PromQL and KQL.

// Program.cs (.NET 10). Packages: OpenTelemetry.Extensions.Hosting, OpenTelemetry.Instrumentation.AspNetCore,
// OpenTelemetry.Exporter.OpenTelemetryProtocol
using OpenTelemetry.Metrics;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry()
    .ConfigureResource(r => r.AddService("orders-api"))
    .WithMetrics(metrics => metrics
        .AddAspNetCoreInstrumentation()
        // Put a bucket boundary exactly on the SLO threshold (0.3 s) so "good" is counted, not interpolated.
        .AddView("http.server.request.duration", new ExplicitBucketHistogramConfiguration
        {
            Boundaries = [0.05, 0.1, 0.2, 0.3, 0.5, 1, 2, 5]
        })
        .AddOtlpExporter());

var app = builder.Build();

// Health and other non-user endpoints should not count as valid events.
app.MapHealthChecks("/health/ready").DisableHttpMetrics();

app.MapGet("/api/orders/{id:int}", (int id) => Results.Ok(new Order(id, "Placed")));
app.Run();

record Order(int Id, string Status);
# Availability SLI over 28 days: non-5xx ÷ all
1 - (
  sum(increase(http_server_request_duration_seconds_count{service="orders-api",http_response_status_code=~"5.."}[28d]))
  / sum(increase(http_server_request_duration_seconds_count{service="orders-api"}[28d]))
)

# Latency SLI over 28 days: requests under 300 ms ÷ all
sum(increase(http_server_request_duration_seconds_bucket{service="orders-api",le="0.3"}[28d]))
/ sum(increase(http_server_request_duration_seconds_count{service="orders-api"}[28d]))

# Error budget remaining (SLO 99.5%)
1 - ((1 - <availability SLI>) / (1 - 0.995))
// Same SLIs from Application Insights, excluding synthetic traffic
requests
| where timestamp > ago(28d) and cloud_RoleName == "orders-api"
| where isempty(customDimensions["synthetic"]) and name !startswith "GET /health"
| summarize valid = count(),
            available = countif(toint(resultCode) < 500),
            fast = countif(toint(resultCode) < 500 and duration < 300)
| extend availability = 100.0 * available / valid,
         latency_sli = 100.0 * fast / valid,
         budget_left_pct = 100.0 * (1 - (1.0 - 1.0 * available / valid) / (1 - 0.995))

⚠ Common mistakes

  • Mistake: Defining SLIs from what's easy to measure (CPU, uptime of the VM). Why it is wrong: they don't reflect what users experience. Instead: good ÷ valid events for user journeys, measured near the user.
  • Mistake: "p99 latency < 300 ms" averaged across instances or days. Why it is wrong: percentiles can't be averaged, so the number is meaningless. Instead: "99% of requests < 300 ms" from histogram buckets.
  • Mistake: Histogram buckets that don't include the threshold. Why it is wrong: the SLI is interpolated between buckets and can be badly off. Instead: configure a bucket boundary exactly at the SLO threshold.
  • Mistake: Setting the SLA equal to the SLO. Why it is wrong: you find out you're in trouble at the same moment you owe credits. Instead: SLO tighter than the SLA.
  • Mistake: Choosing 99.99% because it sounds good. Why it is wrong: dependencies' composite SLA may be lower, and each nine costs roughly ten times more. Instead: base the SLO on user needs, history and dependency SLAs.
  • Mistake: Counting health checks, synthetic tests and client 4xx as valid events. Why it is wrong: they inflate or distort the SLI. Instead: define "valid" explicitly and exclude or separate them.
  • Mistake: An SLO with no error budget policy. Why it is wrong: nothing changes when it's missed, so nobody takes it seriously. Instead: a signed-off policy that changes release behaviour.
  • Mistake: Too many SLIs per service. Why it is wrong: nobody can remember or act on twenty targets. Instead: two or three per critical journey.

🏛 Senior insight: trade-offs

SLOs are a product decision expressed in engineering terms. The number should come from what users need and what the business will pay for, checked against history and the composite SLA of the dependencies, not from a wish for many nines. Their real value is the error budget: it turns "should we ship or fix?" from an argument into a policy the product owner agreed to in advance.

SLO choice When it fits Cost When not to
99% Internal tools, batch, back-office Low Customer-facing payments
99.5-99.9% Most customer-facing APIs on a single region with zone redundancy Moderate: zone-redundant SQL, good deploys When dependencies can't reach it
99.95%+ Payments, auth, core platform Multi-region, active-active, strong release safety Without matching investment and on-call maturity

I measure the SLO programme by whether it changes decisions: how often the policy was triggered, what reliability work it funded, and whether customer-reported incidents dropped.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions percentiles or p99. Why: Checks they understand why percentiles can't be averaged and how they come from histograms.
    How to answer

    An average mixes fast and slow requests into one number that describes almost nobody. If 95 requests take 50 ms and 5 take 3 s, the average is (95 × 50 + 5 × 3,000) / 100 ≈ 198 ms, which looks fine while 1 in 20 customers waits 3 seconds. Percentiles describe the distribution: p50 is the typical request, p95/p99 is the slow tail people complain about.

    Percentiles come from a histogram: count requests into buckets, then find the bucket where 99% of the count is reached and interpolate (put bucket boundaries close to your SLO threshold so the estimate is tight). Because a percentile is not additive, you cannot average p99 across pods or time windows; you merge the bucket counts first and then take the quantile, which is what histogram_quantile(0.99, sum by (le) (rate(...[5m]))) does.

    The trade-off: high percentiles need enough traffic and well-chosen buckets to be trustworthy, so chart the request count next to them and alert on SLO burn rate rather than a raw p99.

  2. When: Candidate mentions alerting when the budget burns. Why: Checks they can turn the SLO into multi-window burn-rate alerts with routing.
    How to answer

    Alert on symptoms users feel, such as the request error-rate or latency SLI, failed synthetic journeys or orders per minute dropping, because causes like CPU at 80% often hurt nobody and miss failures with no resource signal at all. The best symptom alert is SLO burn rate: how fast you are spending the error budget. With a 99.9% SLO, a 14.4× burn over 1 hour (confirmed over 5 minutes) spends 2% of a 30-day budget and pages; 6× over 6 hours pages; slower burns raise a ticket.

    Every alert needs who gets paged (the owning team's rotation), the threshold and window, a severity that decides page versus ticket, a dashboard link and a runbook with the first mitigation steps. Cause metrics stay on dashboards for diagnosis. The trade-off: fewer pages means a slightly later warning for slow-building problems, which tickets cover.

  3. When: Candidate asks how to measure availability for a low-traffic service. Why: Checks they know synthetic tests can provide an availability SLI.
    How to answer

    Synthetic monitoring runs scripted requests or user journeys against your app on a schedule from outside, typically from several regions. Unlike real user monitoring, it works when no users are active (3 am, a new region) and gives a consistent baseline; unlike health checks, it tests the whole path users take: DNS, TLS, Front Door, the app and its dependencies.

    On Azure, an Application Insights standard test sends one HTTP request every 5-15 minutes from chosen locations and checks the status code, content and certificate expiry. For multi-step journeys (sign in, add to cart, pay) you run a Playwright script on a timer and report the result with TrackAvailability, using synthetic accounts with fake data and the payment provider's test mode, never real customers or cards.

    Alert when several locations fail (for example 3 of 5), not one. The trade-off: synthetic tests are cheap and predictable but only cover the paths you script, so pair them with RUM and server-side SLIs.

🛠 Real-world problems: how you handle them

Error budget policy pauses releases after a slow-query regression
Situation
An [order API] on .NET 10 with [~1.5 million requests a day] and SLOs of 99.5% availability and 99% of requests under 400 ms over 28 days, agreed with the product owner along with an error budget policy.
Signals
The latency SLI dropped from [99.6%] to [98.9%] over [four days] after a release; the slow-burn (6× over 6 hours) alert opened a Sev2; the SLO dashboard showed [70%] of the latency budget consumed. Availability was unaffected and no errors were logged.
Investigation
Split the latency SLI by route in Grafana: one route (`GET /api/orders/search`) accounted for most slow requests. Application Insights traces showed one EF Core query taking [800 ms+]; Query Store showed a new plan with a clustered index scan after a LINQ change added a non-sargable `ToLower()` comparison.
Resolution
Immediate: rolled back the search change behind its feature flag; latency SLI returned to [99.7%] daily. Long term: rewrote the query to be sargable, added a covering index, and re-released. Under the error budget policy, feature releases paused for [one sprint] while the team added performance tests.
Prevention
A k6 performance test in CI with a p99 threshold for the search route; EF Core query tags plus a Query Store regression report; SLO review in sprint planning; latency budget burn alerts at 6× and 14.4×.

How to tell it (STAR)

**S:** At [company] our [order API] had SLOs for availability and latency, plus an error budget policy the product owner had signed. **T:** After a release, the slow-burn alert told us we'd used [70%] of the monthly latency budget in four days, and I [owned the investigation]. **A:** I split the SLI by route, traced the slow requests to one EF Core query whose plan had changed because of a non-sargable comparison, and rolled the feature back with its flag. Then I fixed the query and index, and because the budget was nearly gone we followed the policy: one sprint without feature releases, spent on performance tests in CI. **R:** The latency SLI went back above [99.7%] daily, we finished the window within the SLO, and the CI test has since blocked [two] similar regressions before release.

↩ Usually asked after

More in Health and Alerts

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me