Full answer
Definitions
- SLI: good events / valid events, measured at a meaningful point (at the load balancer or from the user's side). Typical SLIs: availability, latency below a threshold, freshness, correctness.
- SLO: the goal for the SLI over a rolling window. Choose with the business, as 100 percent is not a sensible target.
- SLA: a contract with consequences. SLOs are internal and stricter than SLAs.
- Error budget: 1 - SLO. It is the amount of unreliability you can spend on releases, experiments and failures. When the budget is used up, the team shifts effort to reliability.
Burn rate
- burn rate = observed error ratio / allowed error ratio. A burn rate of 1 uses the whole budget exactly at the end of the window. A burn rate of 14.4 uses 2 percent of a 30-day budget in one hour.
- Alert with multiple windows: page when the burn rate is above 14.4 over both 1 hour and 5 minutes (a big, current problem). Page for 6 over 6 hours and 30 minutes. Ticket for 1 over 3 days. The short window makes the alert reset quickly once the problem is fixed.
Benefits: alerts are tied to user impact, not to causes such as CPU. Releases can be judged against the remaining budget.
const SLO = 0.999, WINDOW_DAYS = 30;
const allowedErrorRatio = 1 - SLO;
const budgetMinutes = WINDOW_DAYS * 24 * 60 * allowedErrorRatio;
console.log('SLO', SLO * 100 + '%', 'over', WINDOW_DAYS, 'days -> error budget =', budgetMinutes.toFixed(1), 'minutes of full outage');
const burnRate = (errors, total) => errors / total / allowedErrorRatio;
const hoursToExhaust = (rate) => (WINDOW_DAYS * 24) / rate;
// Request counts for a recent time window: [errors, total]
const scenarios = {
'normal day (0.05% errors)': { '1h': [180, 360000], '5m': [15, 30000] },
'slow leak (0.3% errors)': { '1h': [1080, 360000], '5m': [90, 30000] },
'bad deploy (5% errors)': { '1h': [18000, 360000], '5m': [1500, 30000] },
'bad deploy, already fixed': { '1h': [18000, 360000], '5m': [0, 30000] },
};
for (const [name, w] of Object.entries(scenarios)) {
const long = burnRate(...w['1h']), short = burnRate(...w['5m']);
const page = long > 14.4 && short > 14.4;
console.log(name.padEnd(28), 'burn 1h =', long.toFixed(1).padStart(5), '| burn 5m =', short.toFixed(1).padStart(5), '| page:', page, '| budget gone in', Math.round(hoursToExhaust(Math.max(long, 0.0001))), 'h at the 1h rate');
}
console.log('fraction of budget used by one hour at burn rate 14.4:', (14.4 * 1 / (WINDOW_DAYS * 24) * 100).toFixed(1) + '%');The calculations use fixed request counts. The numbers 14.4 and 6 follow the widely used multi-window burn-rate recipe from the Google SRE workbook. Save it as app.js and run it with node app.js. Output (Node.js v24.22.1, run once): SLO 99.9% over 30 days -> error budget = 43.2 minutes of full outage normal day (0.05% errors) burn 1h = 0.5 | burn 5m = 0.5 | page: false | budget gone in 1440 h at the 1h rate slow leak (0.3% errors) burn 1h = 3.0 | burn 5m = 3.0 | page: false | budget gone in 240 h at the 1h rate bad deploy (5% errors) burn 1h = 50.0 | burn 5m = 50.0 | page: true | budget gone in 14 h at the 1h rate bad deploy, already fixed burn 1h = 50.0 | burn 5m = 0.0 | page: false | budget gone in 14 h at the 1h rate fraction of budget used by one hour at burn rate 14.4: 2.0%
Key points
- SLI measures, SLO targets, SLA is a contract.
- Error budget is 1 minus the SLO.
- Burn rate compares the current error ratio with the allowed one.
- Use long and short windows together in alerts.
- Alert on user-visible symptoms.
Common mistakes
- A 100 percent target.
- Measuring SLIs at the server only, missing what users see.
- Alerting on every CPU spike instead of budget burn.
- Too many SLOs per service.
- Not using the budget to decide on releases.
Follow-ups
- How do you pick an SLO for a new service?
- Why use two windows in one alert?
- What is the difference between SLA and SLO?
Tips
- Give the budget in minutes.
- Explain burn rate with one number.
- Mention multi-window alerts.