Request-Based vs. Window-Based SLIs
You'll learn the two fundamental approaches to measuring SLIs and how to choose the right one for your service.
What Are the Two Measurement Approaches?
When defining Service Level Indicators (SLIs), you need to decide how to collect and aggregate your measurements. There are two main methodologies:
Request-Based SLIs
Request-based SLIs evaluate each individual request or event as either "good" or "bad," then calculate the percentage of good events. This is like grading every single homework assignment and computing your overall grade from those scores.
Example: Out of 1,000 API requests in the last hour, 995 completed successfully within your latency target. Your SLI is 99.5% (995/1,000).
Best for:
- Services with discrete, countable events (API calls, HTTP requests, database queries)
- High-traffic systems where individual request granularity matters
- When you need precise attribution of failures
Window-Based SLIs
Window-based SLIs divide time into fixed intervals (windows) and evaluate whether each window was "good" or "bad" based on aggregate behavior. Think of it like pass/fail exams given at regular intervals—you either pass the entire exam period or you don't.
Example: You check every 5-minute window. If average latency stays under 200ms, that window is "good." Over 24 hours (288 windows), 285 were good. Your SLI is 98.96% (285/288).
Best for:
- Batch jobs or periodic processes
- Monitoring aggregate system health
- Services where continuous availability matters more than individual transactions
Choosing Your Approach
Use request-based when you have identifiable events and want precise error budgets. Use window-based when measuring ongoing state or when individual events aren't trackable.
Key Takeaway: Request-based SLIs measure the quality of individual events, while window-based SLIs measure the quality of time periods—choose based on your service's operational model and what matters most to your users.