Site Reliability Engineering Principles Questions
The core SRE practice model: service-level objectives and indicators, error budgets, toil reduction, and reliability as an engineering discipline. Covers the principles and trade-offs behind treating operations as a software problem and balancing reliability against feature velocity. The conceptual foundation questions specific to SRE-style roles.
Given a PostgreSQL table http_logs(id PK, service varchar, status_code int, occurred_at timestamptz), write a SQL query that computes the daily error rate (percentage of requests with status_code >= 500) for service = 'checkout' over the last 30 days. Ensure your query returns days with zero requests as 0% error.
Sample Answer
Reporting a daily error rate that must show 0% on days with zero traffic requires generating the full calendar of days first and left-joining actual data onto it, rather than grouping only the rows that exist.
Structured elaboration
A plain GROUP BY date(occurred_at) silently omits any day with no matching rows, which is exactly the case this question calls out as a requirement to handle correctly. The fix is a recursive date-spine (or an equivalent calendar table) covering the full 30-day range, LEFT JOINed to the aggregated daily counts, with COALESCE converting missing aggregates to zero before computing the percentage (and guarding the percentage calculation itself against a divide-by-zero when total is zero).
Worked example (executed; sqlite3, verified against a dataset with an intentional zero-request day)
WITH RECURSIVE days(d) AS (
SELECT date('2026-07-01')
UNION ALL
SELECT date(d, '+1 day') FROM days WHERE d < date('2026-07-01', '+29 day')
),
daily AS (
SELECT date(occurred_at) AS d, COUNT(*) AS total,
SUM(CASE WHEN status_code >= 500 THEN 1 ELSE 0 END) AS bad
FROM http_logs
WHERE service = 'checkout'
AND occurred_at >= datetime('2026-07-01') AND occurred_at < datetime('2026-07-01','+30 day')
GROUP BY date(occurred_at)
)
SELECT days.d,
COALESCE(daily.total, 0) AS total_requests,
COALESCE(daily.bad, 0) AS errors,
ROUND(CASE WHEN COALESCE(daily.total,0) = 0 THEN 0.0
ELSE daily.bad * 100.0 / daily.total END, 2) AS error_pct
FROM days LEFT JOIN daily ON days.d = daily.d
ORDER BY days.d;
Against a dataset with requests on July 1st and 3rd but NONE on July 2nd, the query correctly returned 50.0% error for July 1st (1 of 2 requests failed), and exactly 0.0% (not a missing row, not NULL) for the zero-traffic July 2nd, confirming the calendar-spine approach satisfies the stated requirement.
Trade-offs and pitfalls
A date-spine built with a recursive CTE is portable but can be slow at very large day-ranges in some engines; PostgreSQL's generate_series is the more idiomatic and typically faster equivalent for the same purpose. It's also worth being explicit about WHY a zero-traffic day reports 0% rather than being excluded or shown as NULL: for an SLO dashboard, a silent gap (day missing from the output entirely) is easy to misread as "no problem that day" when it might actually mean the service was down so hard it received no traffic at all, which a naive GROUP BY would hide.
Write a PromQL expression to compute a rolling 1-hour burn rate for an SLO based on a 'success_rate' metric, and write an alert that fires if burn rate > 2 for 30 minutes. Explain how burn rate is calculated from SLI time-series and justify the window lengths and threshold chosen.
Sample Answer
A rolling 1-hour burn-rate alert needs the burn rate computed from the SAME success-rate series that the SLO is measured against, and the alert should page only once that elevated rate has PERSISTED, not on a single noisy evaluation.
Structured elaboration
Burn rate is (1−observed success rate)/(1−SLO): a value of 1 means the service is consuming budget exactly at the sustainable rate, and a value of 2 means it is burning twice as fast as the budget can tolerate long-term. The critical, easy-to-get-wrong detail is what success_rate actually IS in your metric system: if it is already a computed ratio gauge (0 to 1), it must be averaged over the window with avg_over_time, never passed through rate() (rate() is only valid on monotonically increasing counters; applied to a gauge it silently returns something close to zero for a roughly-constant value, which then maxes out the burn-rate formula and pages on EVERY evaluation regardless of true health, a genuine bug this answer caught by executing the query rather than just reasoning about it).
Worked example (executed; promtool unit test against a real Prometheus binary)
- record: job:burn_rate:1h
expr: (1 - avg_over_time(success_rate[1h])) / (1 - 0.999)
- alert: BurnRateHigh
expr: job:burn_rate:1h > 2
for: 30m
labels:
severity: page
First version of this rule used rate(success_rate[1h]) instead of avg_over_time; tested against a synthetic success_rate gauge held constant at 0.9999 (well above the 99.9% SLO), the buggy version STILL fired the alert on every evaluation, because rate() on a non-monotonic, roughly-flat gauge returns ~0, making (1-0)/0.001 = 1000. After switching to avg_over_time, the same 0.9999-constant series produces no alert, and a constant 0.99 series (genuinely 10x over budget) correctly fires BurnRateHigh after persisting 30 minutes. Both cases confirmed with promtool test rules.
Trade-offs and pitfalls
A single 1-hour window, even correctly computed, will page on a real but short-lived blip that resolves before 30 minutes are up only if the blip itself is long enough to sustain a >2x average over the full hour; pairing this with a much shorter window (e.g. 5 minutes) at a higher burn-rate threshold catches fast, severe outages sooner, which is the standard multi-window pattern. The for: 30m clause is doing real work here (requiring the condition to hold for the whole 30 minutes before firing) and is a separate lever from the window size in the avg_over_time range selector; conflating the two is a common source of confusion when tuning alert sensitivity.
You inherited a service with no SLOs and minimal monitoring. The product manager wants measurable reliability improvements in 30 days. Create a plan to define appropriate SLOs, implement minimum viable monitoring and alerting, and deliver concrete reliability improvements within 30 days. Include which metrics, tooling choices, and quick-win actions you'll prioritize.
Sample Answer
Thirty days is enough time to get real minimum-viable monitoring in place and land a few concrete fixes, but not enough to justify an aggressive SLO target; the plan needs to be honest about that distinction from day one.
Structured elaboration
Week 1: instrument the golden signals (latency, traffic, error rate, saturation) even before any target exists, using whatever the org already has available rather than introducing new tooling under time pressure, e.g. Prometheus + Grafana (or a hosted equivalent like Datadog or a cloud provider's native metrics, such as CloudWatch) for metric collection and dashboards, and the existing on-call/paging tool (e.g. PagerDuty or Opsgenie) for alert routing, since standing up brand-new tooling in week 1 of a 30-day window competes directly with the time needed to actually instrument and observe. Set up basic alerting on obvious failure conditions (5xx spike, service down) that don't require historical baselining to be useful. Week 2: with a few days of real data, propose a deliberately conservative INITIAL SLO (looser than hoped-for, since there's no real baseline yet) and identify 1-2 quick-win reliability fixes visible from the new telemetry (an obvious N+1 query, a missing timeout, an unbounded retry loop). Weeks 3-4: implement the quick wins, tighten alerting thresholds based on the now-larger dataset, and present a plan for the NEXT phase (a real SLO, set with proper headroom) rather than pretending 30 days is enough to also validate a long-term target. The same underlying discipline applies whether the deadline is a relatively relaxed 30 days or a much tighter two-week window with no maintenance window available at all: the sequence (instrument first, then quick wins, then a real target) just compresses, with even more conservatism applied to any interim SLO or error-budget accounting during that short bootstrap period, since there isn't enough data yet to trust a tight number.
Worked example
For a service with no prior monitoring: Day 1-3, deploy request-count, error-rate, and p95-latency instrumentation using the org's existing Prometheus/Grafana stack (or the closest equivalent already running elsewhere in the company), wired into the existing PagerDuty rotation rather than a new one. Day 4-10, observe; find that 15% of requests hit an endpoint making an unindexed database query under load, an easy, well-understood fix. Day 11-20, ship the fix, observe improvement (p95 latency drops from 900ms to 200ms). Day 21-30, propose an initial SLO (e.g. 99% success / p95 < 400ms, comfortably above what's now being observed) as a placeholder, explicitly flagged to stakeholders as provisional pending a longer observation window.
Trade-offs and pitfalls
The biggest risk under a hard 30-day (or shorter) deadline is a product manager interpreting "we set an SLO" as "the reliability problem is solved," when in reality only the FIRST cheap fixes have landed and the number itself is still a conservative placeholder; that expectation needs managing explicitly and early, not left implicit. It's also tempting to skip instrumentation and jump straight to "fixes" under deadline pressure, but without baseline telemetry there's no way to demonstrate the fixes actually helped, which undermines the whole exercise's credibility with the very stakeholder who's watching for measurable improvement. Introducing an entirely new observability stack from scratch inside a 30-day window is itself a common mistake: reusing whatever tooling the org already trusts and knows how to operate is almost always faster than evaluating and onboarding a new platform under deadline pressure.
Your team's monthly SLO is 99.95%. Ten days into the month you have already burned 60% of the monthly error budget to intermittent failures, and a planned feature rollout is scheduled for day 11. Decide whether to proceed, delay, or modify the rollout: what stakeholders would you involve, and what automated controls (canary percentage, automated rollback, feature-flag gating) would you apply if you decide to proceed anyway?
Sample Answer
With 60% of the monthly error budget already spent by day ten and a feature rollout scheduled for day eleven, the decision should not be an automatic freeze or an automatic green light; it should weigh how much budget is genuinely left, whether the rollout itself is a meaningful new source of risk, and who needs to be in the room before deciding. A service-level objective (SLO) of 99.95% over 30 days leaves an error budget of 0.05% of requests for the month; having burned 60% of it in the first third of the month is a real signal, but the right response depends on what caused the burn and what the rollout would add on top of it.
Working through the decision
- Understand the cause of the burn before deciding anything else. If the 60% came from a single, already-resolved incident (a bad deploy that's been rolled back), the ongoing risk profile for the rest of the month is different than if it's an unresolved, intermittent issue that's still actively burning budget; the second case argues much more strongly against adding a new source of risk on top of it.
- Estimate the rollout's own risk contribution, not just its existence. A well-tested, low-blast-radius change behind a feature flag is a different risk than a large, untested change touching the same code path as the current instability.
- Decide among proceed, delay, or modify, with the default leaning toward caution given 60% is already spent with two-thirds of the month remaining: proceed only with extra safeguards, delay until the underlying issue is understood or resolved, or modify the rollout to reduce its own risk contribution (a smaller canary percentage, an easier automated rollback path, tighter feature-flag gating so it can be turned off instantly without a redeploy).
- Involve the right stakeholders before deciding, not after: the engineering lead who understands the ongoing burn, the product owner who owns the rollout's business urgency, and, if the budget is this depleted, whoever owns the team's error-budget policy (often an SRE lead), since a policy freeze may already be triggered independent of this specific rollout.
Worked example of "proceed, with controls"
The team determines the 60% burn came from a resolved, one-time incident rather than an ongoing issue, and the planned rollout is a well-tested change behind a feature flag. Decision: proceed, but with a small initial canary (1% of traffic instead of the originally planned 10%), automated rollback wired to the same error-rate alert that would page on-call, and an explicit go/no-go check with the product owner and on-call lead 24 hours after the canary starts before expanding further. If the remaining 40% of budget were instead being burned by an ongoing, unresolved issue, the more defensible call would be to delay the rollout until that issue is fixed, since proceeding would be adding new risk on top of an already-active problem rather than a resolved one.
Trade-offs and pitfalls
Treating the error-budget percentage as a mechanical stop light (over 50% burned means automatic freeze, regardless of cause) is simpler to apply consistently but ignores real information about whether the remaining risk is active or already resolved, and can block genuinely low-risk, valuable work unnecessarily. The opposite failure, treating the number as advisory and rolling out anyway without adjusting the rollout's own risk profile, undermines the entire point of having an error budget as a real decision input rather than a dashboard nobody acts on. The healthiest version of this decision is fast (it should not take days to resolve) and transparent (the reasoning and the people consulted are visible after the fact, especially if the call turns out to be wrong).
Define MTTR, MTTD, and MTTA. Explain two architectural or tooling changes that would reduce MTTR for a critical service, and why those specific changes help.
Sample Answer
Mean time to recovery (MTTR) is the average time from when an incident starts affecting users to when service is restored; mean time to detect (MTTD) is the average time from when a problem actually begins to when the team becomes aware of it; mean time to acknowledge (MTTA) is the average time from an alert firing to a human actively responding to it. Together they decompose the incident timeline: how long until we notice (MTTD), how long until someone starts working it (MTTA), and how long until it's actually fixed (MTTR, which includes the detection and acknowledgment time that came before the fix).
Two changes that reduce MTTR, and why
- Better automated detection and more precise alerting. If an alert doesn't fire until a customer complains, MTTD (and therefore MTTR, since it's downstream of detection) is bounded by how long it takes a human to notice and report the problem, often many times longer than an automated check would take. Tightening monitoring to catch the actual failure signature, and tuning alert thresholds so responders trust and act on pages immediately instead of second-guessing them, directly shortens both MTTD and MTTA.
- Pre-built, tested runbooks and one-click mitigations. A large share of recovery time is often spent re-deriving the fix during the incident itself (finding the right dashboard, remembering the failover command, checking who has access). A tested runbook, or better, an automated mitigation triggered by the same signal that paged the responder (an automatic rollback, a pre-approved failover script), collapses the time between "we know what's wrong" and "it's fixed."
Worked example
A service's incident history shows: alerts currently fire an average of 8 minutes after a real failure begins (MTTD), responders acknowledge within 3 minutes of the page (MTTA is already reasonably tight), and it then takes another 25 minutes to diagnose and apply the fix by hand, for a total MTTR of roughly 36 minutes. Tightening the alerting to catch the failure signature directly (rather than waiting for a downstream symptom) cuts MTTD from 8 minutes to 2. Building a tested, one-command rollback runbook for the most common failure class cuts the manual diagnosis-and-fix time from 25 minutes to an estimated 8 for that failure class. Combined, MTTR for that failure class drops from roughly 36 minutes to roughly 13, a change the team can verify against real incident data in the following quarter rather than assuming from the estimate alone.
Trade-offs and pitfalls
Averages hide the shape of the underlying distribution: a single very long outage can dominate a monthly MTTR average and make the number look worse than the typical incident actually was, which is why many teams track percentiles (the median and p90, meaning 90th-percentile, recovery time) alongside the average. It's also easy to game MTTR by declaring "recovered" the moment a symptom disappears rather than when the underlying cause is actually fixed, which looks good on the metric while leaving a recurrence risk in place; a consistent, written definition of "recovered" for the whole organization matters as much as the number itself. Finally, these three metrics measure speed of response, not frequency of incidents; a team can hit an excellent MTTR while still having far too many incidents in the first place, which is a different problem these metrics don't capture on their own.
Unlock Full Question Bank
Get access to all 40 Site Reliability Engineering Principles interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.