How do you build a culture where latency SLOs are enforced like uptime SLAs in a streaming org?
Show the answer
The gap between uptime SLAs (binary — up or down) and latency SLOs (percentile-based, nuanced) is mostly cultural, not technical. Closing it requires three things: visibility, accountability, and consequence.
1. Make latency as visible as uptime:
Every team dashboard has p50/p95/p99 latency for their service front-and-center alongside error rate and availability. If you have to dig for latency, it won't get fixed.
Define SLOs in terms that resonate with the business: "95% of stream start times < 2s" lands harder than "p95 < 2000ms."
In a streaming org specifically: track stream start time, buffering ratio, and rebuffering events — these are the metrics viewers feel. Wire them to Grafana alerts alongside uptime.
2. Burn rate alerts tied to SLO budgets:
Calculate an error budget per SLO: if the p99 SLO is 500ms over a 30-day window, how many requests can exceed 500ms before the budget is exhausted?
Alert when burn rate > 2× normal (budget burning too fast). This makes latency degradation page the on-call before users notice — same urgency as an outage.
3. Embed latency in the deployment gate:
Load tests in CI measure p99 latency against the SLO target. A deploy that regresses p99 by > 10% is rejected automatically — no manual override without VP approval.
Canary deployments (Argo Rollouts or Flagger) check latency SLOs on the canary slice before promoting to 100%.
4. Ownership and consequence:
Each service has a named team that owns its SLO. SLO compliance (not just uptime) is reviewed in quarterly engineering reviews.
Error budget policies: if budget is < 10% remaining, the team freezes feature deploys and focuses only on reliability work. Leadership sees this on the same dashboard as revenue metrics.
5. Blameless retrospectives for latency SLO breaches — same rigor as post-mortems for outages. The cultural message is: latency regressions are production incidents.
A batch job missed SLA by 14 minutes due to downstream API throttling. How would you implement an adaptive backoff + SLA-aware retry policy?
Show the answer
Standard exponential backoff ignores time remaining in the SLA window. An SLA-aware retry policy has to be deadline-conscious.
Design:
import time
import random
from datetime import datetime, timezone
def sla_aware_retry(fn, sla_deadline: datetime, max_attempts: int = 10):
"""
Retries fn() with adaptive backoff that accelerates as the SLA deadline approaches.
"""
attempt = 0
base_delay = 1.0 # seconds
max_delay = 60.0
while attempt < max_attempts:
try:
return fn()
except ThrottlingError as e:
attempt += 1
now = datetime.now(timezone.utc)
time_remaining = (sla_deadline - now).total_seconds()
if time_remaining <= 0:
raise SLAExceeded(f"SLA deadline exceeded after {attempt} attempts") from e
# Exponential backoff with jitter, but capped by time remaining
delay = min(
base_delay * (2 ** attempt) + random.uniform(0, 1),
max_delay,
time_remaining * 0.5 # never wait more than half remaining budget
)
if delay <= 0:
raise SLAExceeded("Insufficient time remaining to retry") from e
time.sleep(delay)
except NonRetriableError:
raise # don't retry 4xx auth errors, etc.
raise MaxAttemptsExceeded()
Key principles:
Deadline propagation: pass the SLA deadline through every layer of the call stack (use context deadlines in Go, asyncio timeouts in Python). The downstream call timeout shrinks as the deadline approaches.
Adaptive backoff ceiling: min(exponential_backoff, remaining_time * 0.5) prevents wasting the last few seconds on a long sleep.
Jitter: random.uniform(0, 1) spreads retries across time to avoid synchronized thundering herd when many jobs are throttled simultaneously.
Circuit breaker: wrap the retry loop in a circuit breaker (using pybreaker or Resilience4j). If the downstream API is throttling at the account level, continuing to retry burns your quota faster. Open the circuit after N consecutive throttle responses; let it half-open after a configurable timeout.
Observability: emit metrics on retry_attempt_count, delay_applied_ms, sla_headroom_remaining_s so you can detect systematic throttling patterns and negotiate higher quotas proactively.
Infrastructure-level complement: use an SQS queue with a dead-letter queue and visibility timeout tuned to the SLA window. If the job can be made async, the queue handles retry scheduling without the job process blocking.
How do you define "SLOs that actually matter" in financial systems, where failure isn't an error, it's a loss?
Show the answer
In financial systems, the standard "availability and latency" SLO framing misses the point. A payment that succeeds in 200ms but debits the wrong amount is infinitely worse than a payment that fails cleanly with a retryable error. The SLO framework must capture correctness alongside performance.
Framework for financially meaningful SLOs:
1. Identify the user journeys that generate or protect money:
Payment initiation → settlement: every millisecond of latency has a cost (cash drag, FX exposure).
Fraud detection: false negative rate (missed fraud) is a direct loss; false positive rate is customer experience loss.
Reconciliation: late or incorrect reconciliation = regulatory risk and potential fines.
2. Define SLOs in terms of the business invariant, not technical metrics:
Journey
Technical SLO ❌
Business SLO ✅
Payment processing
API p99 < 500ms
≥ 99.95% of submitted payments reach terminal state (success/failure) within 30s
Fraud scoring
Service availability > 99.9%
≤ 0.01% of transactions processed without a fraud score
Daily settlement
Batch completes by T+1 09:00
Settlement file delivered to counterparty by 08:45 with zero row-count discrepancy
3. "Failure modes" are not all equal — weight them:
A silent data corruption (wrong amount processed) is a severity-1 SLO breach even if the system returned HTTP 200.
Use end-to-end synthetic monitors that simulate real transactions and validate the outcome, not just the HTTP status code.
4. Error budget policy tied to financial risk:
When the correctness SLO error budget falls below 20%, freeze all changes to the payment processing path.
When it hits 0%, activate the incident runbook: pause new payment acceptance, engage the on-call CFO/risk officer.
5. Regulatory dimension:
SLOs must reflect regulatory SLAs (PCI-DSS, SOX, MiFID II): audit log write latency < 1s, encryption key rotation completed within 24h of detection of compromise. These are non-negotiable SLOs with external accountability.
3 more in the member app, with practice sets and your own marks. Join free