Back to Monitoring & Logging
Q8Question 8 of 13

What are SLIs, SLOs, and error budgets

Answer: An SLI measures how well your service performs, an SLO sets the target for that measurement, and an error budget is the allowed amount of failure before the team must prioritize reliability over new features.

Key Concepts
  • An SLI (Service Level Indicator) is a quantitative measurement of a service attribute like latency, availability, or error rate.
  • An SLO (Service Level Objective) is a target value for an SLI, such as 99.9% of requests succeed within 500ms.
  • An SLA (Service Level Agreement) is a business contract with penalties if the SLO is not met.
  • An error budget is the allowed amount of unreliability: if the SLO is 99.9%, the error budget is 0.1% of requests.
  • Error budgets balance reliability and feature velocity: when the budget is exhausted, the team focuses on stability instead of new features.
  • Banking APIs typically require 99.95% or higher availability for critical operations like transfers and balance checks.

Definition

An SLI measures how well your service performs, an SLO sets the target for that measurement, and an error budget is the allowed amount of failure before the team must prioritize reliability over new features.
  • SLI (Service Level Indicator) is a metric that quantifies one aspect of service quality: availability, latency, throughput, or error rate.
  • SLO (Service Level Objective) is a target range for an SLI: "99.9% of transfer API requests complete successfully within 500ms."
  • SLA (Service Level Agreement) is a contract between a service provider and customer that defines penalties (credits, refunds) if SLOs are breached.
  • Error budget is the inverse of the SLO target: if the SLO is 99.9% availability, the error budget allows 0.1% downtime.
  • Burn rate measures how fast the error budget is being consumed relative to the SLO window (typically 30 days).

Think of the National Bank of India ATM network. The SLI is the percentage of ATM transactions that complete successfully. The SLO is the bank's internal target: 99.95% of transactions must succeed. The SLA is the contract with the RBI (Reserve Bank of India) that says: if ATM success rate drops below 99.9%, the bank faces fines. The error budget is like a petty cash drawer: the bank is allowed 0.05% failures per month. While there is money in the drawer (budget remaining), the engineering team can deploy new features. When the drawer is empty (budget exhausted), all deployments stop and the team focuses on fixing reliability.

Understanding the Concepts

What is an SLI?

An SLI is a ratio that measures service quality. It answers the question: "How well is our service performing right now?"

Common SLI types for a banking API:

SLIFormulaExample
AvailabilitySuccessful requests / Total requests9,990 / 10,000 = 99.9%
LatencyRequests < threshold / Total requests9,800 below 500ms / 10,000 = 98%
Error rateFailed requests / Total requests10 / 10,000 = 0.1%
ThroughputRequests per second500 req/s
JAVA
package com.bank.sre;

public class SLIDemo {

    public static void main(String[] args) {
        long totalRequests = 10000;
        long successfulRequests = 9990;
        long requestsBelow500ms = 9800;
        long failedRequests = totalRequests - successfulRequests;

        double availability = (double) successfulRequests / totalRequests * 100;
        double latencySLI = (double) requestsBelow500ms / totalRequests * 100;
        double errorRate = (double) failedRequests / totalRequests * 100;

        System.out.println("Transfer API SLIs (last hour):");
        System.out.printf("  Availability: %.2f%% (%d/%d successful)%n",
            availability, successfulRequests, totalRequests);
        System.out.printf("  Latency (p500ms): %.2f%% (%d/%d below 500ms)%n",
            latencySLI, requestsBelow500ms, totalRequests);
        System.out.printf("  Error rate: %.2f%% (%d/%d failed)%n",
            errorRate, failedRequests, totalRequests);
    }
}
TEXT
Transfer API SLIs (last hour):
  Availability: 99.90% (9990/10000 successful)
  Latency (p500ms): 98.00% (9800/10000 below 500ms)
  Error rate: 0.10% (10/10000 failed)

What is an SLO?

An SLO is a target value for an SLI. It defines how reliable you want the service to be. Setting the right SLO is a business decision: higher reliability costs more engineering effort.

JAVA
package com.bank.sre;

public class SLODemo {

    public static void main(String[] args) {
        System.out.println("National Bank of India SLOs:");
        System.out.println();
        System.out.println("Transfer API:");
        System.out.println("  Availability SLO: 99.95% of requests return 2xx");
        System.out.println("  Latency SLO: 99% of requests complete within 500ms");
        System.out.println();
        System.out.println("Balance Check API:");
        System.out.println("  Availability SLO: 99.99% of requests return 2xx");
        System.out.println("  Latency SLO: 99.9% of requests complete within 200ms");
        System.out.println();
        System.out.println("Statement Generation (batch):");
        System.out.println("  Availability SLO: 99.9% of statements generated within 4 hours");
        System.out.println();
        System.out.println("Each SLO has a 30-day rolling window.");
    }
}
TEXT
National Bank of India SLOs:

Transfer API:
  Availability SLO: 99.95% of requests return 2xx
  Latency SLO: 99% of requests complete within 500ms

Balance Check API:
  Availability SLO: 99.99% of requests return 2xx
  Latency SLO: 99.9% of requests complete within 200ms

Statement Generation (batch):
  Availability SLO: 99.9% of statements generated within 4 hours

Each SLO has a 30-day rolling window.

What is an error budget?

The error budget is the amount of unreliability the SLO allows. If the SLO is 99.95%, the error budget is 0.05%. Over a 30-day window, this translates to a specific number of allowed failed requests or minutes of downtime.

JAVA
package com.bank.sre;

public class ErrorBudgetDemo {

    public static void main(String[] args) {
        double sloTarget = 99.95;
        double errorBudgetPercent = 100.0 - sloTarget;
        int minutesInMonth = 30 * 24 * 60;
        double allowedDowntimeMinutes = minutesInMonth * (errorBudgetPercent / 100);
        long totalMonthlyRequests = 10_000_000;
        long allowedFailedRequests = (long)(totalMonthlyRequests * errorBudgetPercent / 100);

        System.out.println("Error Budget for Transfer API:");
        System.out.printf("  SLO target: %.2f%%%n", sloTarget);
        System.out.printf("  Error budget: %.2f%%%n", errorBudgetPercent);
        System.out.printf("  Allowed downtime: %.1f minutes/month (%.1f hours)%n",
            allowedDowntimeMinutes, allowedDowntimeMinutes / 60);
        System.out.printf("  Allowed failed requests: %,d out of %,d%n",
            allowedFailedRequests, totalMonthlyRequests);
        System.out.println();

        // Simulate budget consumption
        long failedSoFar = 3000;
        long budgetRemaining = allowedFailedRequests - failedSoFar;
        double budgetUsedPercent = (double) failedSoFar / allowedFailedRequests * 100;

        System.out.println("Budget status (day 15 of 30):");
        System.out.printf("  Failed requests so far: %,d%n", failedSoFar);
        System.out.printf("  Budget used: %.1f%%%n", budgetUsedPercent);
        System.out.printf("  Budget remaining: %,d failures%n", budgetRemaining);
        System.out.println("  Status: " + (budgetUsedPercent < 50 ? "HEALTHY" : "AT RISK"));
    }
}
TEXT
Error Budget for Transfer API:
  SLO target: 99.95%
  Error budget: 0.05%
  Allowed downtime: 21.6 minutes/month (0.4 hours)
  Allowed failed requests: 5,000 out of 10,000,000

Budget status (day 15 of 30):
  Failed requests so far: 3,000
  Budget used: 60.0%
  Budget remaining: 2,000 failures
  Status: AT RISK

How do SLI, SLO, SLA, and error budget relate?

ConceptOwnerPurposeExample
SLIEngineeringMeasure current performance99.93% availability this week
SLOEngineering + ProductSet reliability target99.95% availability per month
SLABusiness + LegalContract with penalties99.9% or customer gets credits
Error budgetEngineeringBalance reliability vs velocity0.05% = 5,000 failures allowed

The SLA is always lower than the SLO. This gives a safety margin. If the SLO is 99.95%, the SLA might be 99.9%. The team has a buffer before contractual penalties kick in.

JAVA
package com.bank.sre;

public class SLAvsSODemo {
    public static void main(String[] args) {
        System.out.println("Relationship:");
        System.out.println("  SLA: 99.9%  (contract with RBI/customers)");
        System.out.println("  SLO: 99.95% (internal engineering target)");
        System.out.println("  SLI: 99.93% (actual measured performance)");
        System.out.println();
        System.out.println("  SLI (99.93%) < SLO (99.95%) -> Investigate");
        System.out.println("  SLI (99.93%) > SLA (99.9%)  -> No penalties yet");
        System.out.println();
        System.out.println("  The gap between SLO and SLA is the safety margin.");
    }
}
TEXT
Relationship:
  SLA: 99.9%  (contract with RBI/customers)
  SLO: 99.95% (internal engineering target)
  SLI: 99.93% (actual measured performance)

  SLI (99.93%) < SLO (99.95%) -> Investigate
  SLI (99.93%) > SLA (99.9%)  -> No penalties yet

  The gap between SLO and SLA is the safety margin.

How do you implement error budget policies?

An error budget policy defines what happens when the budget is consumed. This is the mechanism that balances reliability and feature velocity.

JAVA
package com.bank.sre;

public class ErrorBudgetPolicyDemo {
    public static void main(String[] args) {
        double budgetUsedPercent = 75.0;
        int dayOfMonth = 20;
        double expectedUsage = (dayOfMonth / 30.0) * 100; // 66.7%

        System.out.println("Error budget policy at National Bank of India:");
        System.out.println();
        System.out.printf("Day %d of 30: budget %.0f%% used (expected: %.0f%%)%n",
            dayOfMonth, budgetUsedPercent, expectedUsage);
        System.out.println();

        if (budgetUsedPercent < 50) {
            System.out.println("Policy: GREEN");
            System.out.println("  - Deploy features normally");
            System.out.println("  - Standard review process");
        } else if (budgetUsedPercent < 80) {
            System.out.println("Policy: YELLOW");
            System.out.println("  - Extra review for risky deployments");
            System.out.println("  - Prioritize one reliability improvement");
            System.out.println("  - On-call reviews recent incidents");
        } else {
            System.out.println("Policy: RED");
            System.out.println("  - Freeze feature deployments");
            System.out.println("  - All engineering on reliability");
            System.out.println("  - Daily incident review meetings");
            System.out.println("  - Postmortem for every error budget event");
        }
    }
}
TEXT
Error budget policy at National Bank of India:

Day 20 of 30: budget 75% used (expected: 67%)

Policy: YELLOW
  - Extra review for risky deployments
  - Prioritize one reliability improvement
  - On-call reviews recent incidents

What are common mistakes with SLOs?

Mistake 1: Setting the SLO at 100%

Wrong: a 100% SLO means zero error budget. Any failure, even a single timeout, violates the SLO. This is impossible to maintain and paralyzes the team.

Correct: set a realistic SLO that balances reliability with the cost of achieving it.

JAVA
package com.bank.sre;

public class SLOMistakeDemo {
    public static void main(String[] args) {
        System.out.println("WRONG: SLO = 100%");
        System.out.println("  Error budget: 0 failures allowed");
        System.out.println("  One timeout = SLO violated");
        System.out.println("  Team cannot deploy anything");
        System.out.println();
        System.out.println("CORRECT: SLO = 99.95%");
        System.out.println("  Error budget: 5,000 failures / 10M requests");
        System.out.println("  Room for deployments, experiments, and rare failures");
        System.out.println("  Team has clear guidelines for when to prioritize reliability");
    }
}
TEXT
WRONG: SLO = 100%
  Error budget: 0 failures allowed
  One timeout = SLO violated
  Team cannot deploy anything

CORRECT: SLO = 99.95%
  Error budget: 5,000 failures / 10M requests
  Room for deployments, experiments, and rare failures
  Team has clear guidelines for when to prioritize reliability

What about burn rate alerting?

Burn rate measures how fast the error budget is being consumed. A burn rate of 1x means the budget is consumed evenly over the SLO window. A burn rate of 10x means the budget will be exhausted in 1/10th of the window.

JAVA
package com.bank.sre;

public class BurnRateDemo {
    public static void main(String[] args) {
        double sloTarget = 99.95;
        double errorBudgetPercent = 100.0 - sloTarget;
        int windowDays = 30;

        System.out.println("Burn rate alerting:");
        System.out.println();
        System.out.println("Normal burn rate: 1x");
        System.out.printf("  Budget lasts: %d days%n", windowDays);
        System.out.println();
        System.out.println("Elevated burn rate: 5x");
        System.out.printf("  Budget lasts: %d days%n", windowDays / 5);
        System.out.println("  Action: page on-call engineer");
        System.out.println();
        System.out.println("Critical burn rate: 14x");
        System.out.printf("  Budget lasts: ~%.0f hours%n", (windowDays * 24.0) / 14);
        System.out.println("  Action: wake up on-call, all hands on deck");
    }
}
TEXT
Burn rate alerting:

Normal burn rate: 1x
  Budget lasts: 30 days

Elevated burn rate: 5x
  Budget lasts: 6 days
  Action: page on-call engineer

Critical burn rate: 14x
  Budget lasts: ~51 hours
  Action: wake up on-call, all hands on deck

What should a senior engineer know?

- Multi-window, multi-burn-rate alerts. Use short windows (5 min, 1 hour) for fast burn rates and long windows (6 hours, 3 days) for slow burn rates. This catches both sudden outages and gradual degradation.

- SLO document. Each service should have a document defining its SLIs, SLOs, the measurement method, the error budget policy, and the escalation path. This is reviewed quarterly.

- Toil budget. If the error budget is frequently consumed, it might be due to toil: manual, repetitive operational work. Investing in automation (auto-scaling, self-healing, automated rollback) reduces toil and protects the error budget.

- Dependency SLOs. The transfer service depends on the account service, the database, and Kafka. The transfer service's SLO cannot be higher than its weakest dependency's SLO. If the database has 99.95% availability, the transfer service cannot achieve 99.99%.

- SLO-based release gating. Integrate error budget checks into the CI/CD pipeline. If the error budget is below 20%, the pipeline blocks non-critical deployments.

What are common interview follow-up questions?

  • What is the difference between an SLO and an SLA?
  • How do you choose the right SLO for a new service?
  • What happens when the error budget is exhausted?
  • How do you measure availability for an event-driven system that does not have request/response?
  • What is the relationship between the number of nines and allowed downtime?

Visual Overview

DIAGRAM
  SLI -> SLO -> Error Budget
  ===========================

  SLI (measured)          SLO (target)           Error Budget
  ────────────────        ────────────────       ──────────────
  99.93% success    vs    99.95% target     ->   0.05% budget
                                                  = 5,000 failures
                                                  = 21.6 min downtime

  SLA = 99.9% (business contract, lower than SLO)
  Safety margin = SLO - SLA = 0.05%


  Error Budget Over 30 Days
  ==========================

  Budget %
  100% ─────────────────────────────
       ╲   expected consumption
  50%   ╲─────────────────────────
         ╲╲   actual (faster burn)
   0%     ╲╲──────────────────────
       Day 1          Day 15     Day 30

  If actual line is below expected -> at risk
  If budget reaches 0 -> freeze deployments


  Nines Table
  ============
  99%     -> 7.3 hours downtime/month
  99.9%   -> 43.8 minutes/month
  99.95%  -> 21.9 minutes/month
  99.99%  -> 4.4 minutes/month
  99.999% -> 26 seconds/month

Key Takeaway

SLIs, SLOs, and error budgets turn reliability from a vague goal into a measurable engineering practice. At the National Bank of India, the transfer API has an SLI (99.93% of requests succeed), an SLO (99.95% target), and an error budget (0.05% or 5,000 allowed failures per 10 million requests per month). These numbers tell the team exactly how reliable the service is and how much room they have for risk.

The error budget is the mechanism that balances speed and reliability. When the budget is healthy, the team deploys features freely. When the budget is running low, the team slows down and focuses on stability. When the budget is exhausted, feature deployments stop entirely until reliability improves. This removes the subjective argument of "should we focus on features or reliability" and replaces it with a data-driven policy.

Burn rate alerting catches problems before the budget is fully consumed. A 14x burn rate means the budget will be gone in about two days. A 5x burn rate means six days. Multi-window alerts combine short windows for fast detection with long windows for slow degradation.

The SLA is always set below the SLO to provide a safety margin. If the SLO is 99.95% and the SLA is 99.9%, the team has a 0.05% buffer before contractual penalties apply. The SLO triggers internal action. The SLA triggers business consequences.

One sentence to remember: the SLI measures how you are doing, the SLO sets the target, and the error budget tells you how much failure you can afford before you must stop and fix things.

---

Share
Use ← → arrow keys to navigate