Scenario: Netflix Cascading Failure
Diagram convention: Arrows and messages are labeled 1, 2, 3… to show processing order. Each diagram is followed by a Step-by-step flow table explaining every numbered step.
1. The Interview Question
"A downstream authentication service slows from 50ms to 8 seconds. Your API tier starts failing health checks. Walk through what happens and how you contain it."
2. Real-World Context
| Dimension | Detail |
|---|---|
| Company / system | Netflix — microservices at massive scale; pioneered Hystrix circuit breakers |
| Scale | Thousands of services; correlated failures during dependency degradation; edge + origin tiers |
| Why architects care | Root cause is often small (one dependency); blast radius is large due to thread pool exhaustion and retry amplification |
| Public references | Netflix tech blog on resilience; Nygard Release It!; Chaos Monkey |
AWS deployment context
Typical Netflix-style streaming API on AWS: ECS Fargate or EKS microservices behind ALB; Amazon ElastiCache Redis for session/token cache; Amazon DynamoDB or Aurora for entitlements; AWS App Mesh or Envoy sidecars for timeouts/retries; CloudWatch + X-Ray for SLO burn detection; AWS FIS for chaos experiments.
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | User request | Client opens home screen; BFF must validate session via Auth. |
| 2 | DNS route | Route 53 latency-based routing to nearest region. |
| 3 | ALB route | ALB forwards to healthy API task (initially all appear healthy). |
| 4 | BFF calls auth | Synchronous GET /auth/validate on critical path — no timeout configured. |
| 5 | Thread blocks 8s | Auth p99 latency spikes; API worker thread held for full 8s per request. |
| 6 | Cache miss | Redis session cache cold or TTL expired — every request hits Auth. |
| 7 | DB lookup | Auth itself slow on DynamoDB — compounds latency. |
| 8 | Health fail | Thread pool saturated → health endpoint times out → ALB marks instance unhealthy. |
3. Step-by-Step Interview Answer
Minutes 0–5: Scope
- Symptom: Auth p99 goes 50ms → 8s; API error rate climbs over 5–10 minutes.
- Constraint: Users must still browse catalog (degrade auth-heavy features).
- Non-goal: Fix auth root cause in this answer (focus containment).
- Assumption: Clients retry on 5xx; upstream services use default HTTP client (no retry budget).
Minutes 5–15: Failure propagation
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Request | Client loads home screen; BFF requires auth validation. |
| 2 | Forward | ALB routes to API instance with available capacity. |
| 3 | Acquire thread | Servlet/worker thread assigned from fixed pool (e.g. 200). |
| 4 | Sync auth call | Blocking HTTP call to Auth — no timeout or timeout > 8s. |
| 5 | Pool exhaust | All 200 threads blocked waiting on Auth; queue backs up. |
| 6 | Health fail | /health cannot get a thread → ALB marks instance unhealthy. |
| 7 | Drain instance | ALB stops sending traffic to API-1; load shifts to survivors. |
| 8 | Retry storm | Clients + upstream services retry failed requests — amplifies Auth load. |
| 9 | Survivors saturate | Remaining instances exhaust → metastable failure — won't self-heal when Auth recovers. |
Cascade summary (say aloud):
| Phase | Step | What happens |
|---|---|---|
| T+0 | 1 | Auth latency spikes (DB hotspot, GC pause, deploy bug) |
| T+2 min | 2–3 | API threads block; latency climbs; error rate still low |
| T+5 min | 4–5 | Thread pools full; new requests queue or timeout |
| T+7 min | 6–7 | Health checks fail; ALB removes instances |
| T+10 min | 8–9 | Retry storm; survivors fail; total API outage despite Auth still serving (slowly) |
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1–2 | Route traffic | ALB distributes across API fleet. |
| 3 | Concentrate load | As instances fail health checks, survivors get more traffic. |
| 4–6 | Blocked call | Every API thread waits on slow Auth — fan-in bottleneck. |
| 7–8 | Health fail | Saturated instances removed from rotation — negative feedback loop. |
| 9 | Retry storm | Retries add ~30–300% extra load on already-failing tier. |
Minutes 15–30: Containment layers
| Layer | Mechanism | Effect |
|---|---|---|
| 1. Timeout | Auth call timeout 200ms | Fail fast; free threads immediately |
| 2. Circuit breaker | Open after 50% errors in 10s window | Stop calling sick dependency |
| 3. Bulkhead | Separate thread pool for auth vs. catalog | Catalog survives auth saturation |
| 4. Retry budget | Max 1% of traffic retries | Prevent retry storm |
| 5. Load shed | Return 503 for non-critical paths | Protect core tier |
| 6. Degrade | Allow cached session / read-only mode | Partial UX vs. total outage |
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Single pool (before) | Auth slowness consumes all threads — catalog dies too. |
| 2 | Bulkhead split | Catalog pool isolated — home/browse keeps working. |
| 3 | Circuit breaker | After error threshold, fail fast without calling Auth. |
| 4 | Cache fallback | Serve stale session from Redis — degraded but available. |
| 5 | Fast fail | Return 401/503 in <5ms instead of blocking 8s. |
Minutes 30–45: Operations
- Detect: SLO burn rate on API;
thread_pool_active / thread_pool_max> 0.9; auth latency histogram shift; circuit breaker state = OPEN. - Respond: Manually trip circuit breaker fleet-wide; scale Auth horizontally; reduce retry limits in platform SDK; enable read-only degradation mode.
- Prevent: Chaos experiments (latency injection on auth); default timeouts in service mesh; retry budgets in platform SDK; bulkhead enforcement in golden-path library.
- Org: Platform team owns resilience libraries (Hystrix → Resilience4j / Envoy); exceptions via ADR.
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Normal operation | Circuit CLOSED — all auth calls pass through. |
| 2 | Trip open | Sliding window detects sustained failures → OPEN. |
| 3 | Cooldown | 30s pause — let dependency recover; no calls sent. |
| 4 | Probe success | Single canary request succeeds → CLOSED. |
| 5 | Probe fails | Re-open immediately — dependency still sick. |
| 6 | Fast-fail | OPEN state returns fallback in <1ms — threads freed. |
4. Whiteboard Guide
Draw left-to-right:
- Client → ALB → API tier (shade thread pool filling red)
- API → Auth (label arrow "8s blocking, no timeout")
- Show negative feedback loop: health fail → drain → concentrate → exhaust
- Add circuit breaker on Auth arrow — label "OPEN"
- Show bulkhead as separate pool: "catalog reads" vs "auth calls"
- Add Redis cache bypass path for degraded mode
AWS whiteboard layout
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Sync path | Client → CloudFront → ALB → BFF — auth on critical path. |
| 2 | Auth dependency | Blocking call — FAILURE zone when Auth slows. |
| 3 | Bulkhead | Catalog reads use separate thread pool. |
| 4 | Circuit breaker | Trip open when error rate exceeds threshold. |
| 5 | Degrade | Redis cached session or anonymous browse mode. |
5. Principal-Level Signals
- Names metastable failure and why recovery isn't automatic when Auth heals
- Quantifies retry amplification (1% retry × 10K RPS = +100 RPS; × 3 retries = +300 RPS on Auth)
- Separates root cause fix (Auth DB hotspot) from containment (circuit breaker)
- Mentions chaos engineering as validation, not heroics
- Explains bulkhead vs circuit breaker — bulkhead limits resource sharing; breaker stops calls entirely
- Discusses health check design — deep health checks that call dependencies cause cascading unhealthiness
6. Red Flags
- "Scale API horizontally" without fixing blocking — adds more threads that also block on Auth
- Infinite retries with exponential backoff only — backoff helps but doesn't cap total retry budget
- No bulkhead between critical and optional dependencies
- Health check calls Auth synchronously — unhealthy Auth makes entire API fleet unhealthy
- Circuit breaker per-instance only — need fleet-wide coordination or low threshold to trip quickly
7. Follow-Up Questions
| Question | Strong answer |
|---|---|
| Why doesn't Auth recovering fix the API tier? | Metastable state — queues full, clients still retrying, cold thread pools need drain + circuit half-open probes |
| Half-open vs closed? | Half-open sends probe traffic (1–3 requests) before fully closing circuit |
| Where to put timeout — client or mesh? | Both — mesh enforces platform default (200ms); client can be stricter for UX |
| How do you test this? | Chaos: inject 8s latency on Auth in staging; verify catalog still loads with bulkhead |
| gRPC vs HTTP blocking? | gRPC async doesn't eliminate cascade — semaphore/concurrency limits still required |
8. Related Study
- Resilience Patterns
- Partial Failure
- Chaos Engineering
- Lab: Chaos testing on
:8103
9. Practice Drill
Draw the cascade on paper in 5 minutes. Label steps 1–9. Explain containment in 10 minutes without notes. Then whiteboard the circuit breaker state machine from memory.
10. Production High-Level Design
This section is a build guide for implementing Netflix-style cascading-failure containment in production on AWS.
10.1 Architecture diagram index
| Section | Topic |
|---|---|
| §2 | End-to-end AWS deployment context |
| §3 | Failure propagation sequence |
| §10.2 | C4 logical context |
| §10.3 | Full VPC production stack |
| §10.4 | Containment layer stack |
| §11.4 | BFF request path sequence |
| §11.5 | Circuit breaker state machine + config |
| §12 | Multi-AZ, regional failover |
| §13 | AWS FIS chaos experiments |
| §14 | Security + observability |
| §15 | 6-week rollout |
| §16 | Load + chaos testing |
| §17 | Production readiness gates |
10.2 System context (C4 Level 1)
Logical view — technology-agnostic component boundaries.
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Ingress | Clients fetch static UI from CDN. |
| 2 | API calls | Dynamic requests hit API Gateway / BFF. |
| 3 | Aggregate | BFF composes home screen from multiple services. |
| 4 | Auth check | Session validation on critical path — cascade risk. |
| 5 | Catalog | Catalog reads can be bulkheaded separately from auth. |
| 6 | Cache | Redis holds hot session tokens — reduces Auth fan-in. |
| 7 | Entitlements | DynamoDB stores subscription state — Auth dependency. |
10.3 AWS production architecture (full stack)
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Edge | CloudFront terminates TLS; caches static responses. |
| 2 | WAF filter | Bot control, geo block, rate limiting. |
| 3 | DNS health | Route 53 fails over if regional ALB unhealthy. |
| 4 | ALB route | Cross-AZ load balance to BFF tasks. |
| 5 | BFF invoke | BFF aggregates home screen; calls Auth synchronously. |
| 6 | Auth call | Critical dependency — must have timeout + circuit breaker. |
| 7 | Session cache | Redis GET session — miss falls through to Auth DB. |
| 8 | User lookup | DynamoDB GetItem for entitlements. |
| 9 | Catalog | Parallel bulkheaded call — survives Auth degradation. |
| 10 | Policy enforce | App Mesh enforces 200ms timeout, retry budget, circuit breaker. |
| AWS component | Resilience responsibility |
|---|---|
| ALB | Health checks on shallow /health (not Auth); connection draining on deregister |
| ECS Fargate | Task-level thread pools; circuit breaker in app or sidecar |
| App Mesh | Platform-enforced timeouts, outlier detection, retry policies |
| ElastiCache Redis | Session cache for degraded-mode fallback |
| DynamoDB | Auth backing store — on-demand scales; DAX optional for hot keys |
| CloudWatch | ThreadPoolActive, CircuitBreakerState, SLO burn alarms |
| AWS FIS | Inject Auth latency in staging/prod game days |
10.4 Containment architecture (layers)
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Enter | Request hits BFF; passes through containment stack in order. |
| 2 | Trip check | Circuit breaker — fast-fail if OPEN. |
| 3 | Pool select | Bulkhead routes to catalog or auth pool. |
| 4 | Retry gate | Retry only if budget allows (≤1% of RPS). |
| 5 | Shed check | Non-critical paths return 503 immediately under pressure. |
| 6 | Fallback | Serve degraded UX from Redis cache or anonymous mode. |
10.5 Service sizing at 10K RPS peak
| Metric | Value | Reasoning |
|---|---|---|
| Peak BFF RPS | 10K | Mid-size streaming API |
| Auth calls per home load | 1 | Session validate on critical path |
| Auth p99 (healthy) | 50ms | Baseline |
| Auth p99 (degraded) | 8s | Incident scenario |
| BFF thread pool | 200 / instance | Tomcat / Netty worker threads |
| BFF instances | 20 | 10K RPS ÷ 500 RPS/instance |
| Time to exhaust (no timeout) | ~2 min | 200 threads × 8s = 25 RPS capacity vs 500 RPS demand |
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Demand | 10K RPS hits BFF during peak evening traffic. |
| 2 | Capacity | With 8s Auth latency, each thread handles 0.125 RPS. |
| 3 | Deficit | 95% of requests queue or timeout — cascade in minutes. |
11. Production Low-Level Design
11.1 API contract — BFF home endpoint
Endpoint: GET /v1/home
Required headers:
| Header | Rule |
|---|---|
Authorization | Bearer <session_token> |
X-Request-ID | UUID for distributed tracing |
X-Client-Version | App version for degradation routing |
Response semantics (degradation modes):
| HTTP | Meaning | Client action |
|---|---|---|
200 | Full home screen (auth + catalog + recommendations) | Render normally |
200 + X-Degraded: auth | Catalog only; recommendations omitted | Show banner "personalization unavailable" |
401 | Session invalid (circuit OPEN, cache miss) | Redirect to login |
503 + Retry-After: 30 | Load shed — system under pressure | Backoff; do not retry more than 2× |
504 | BFF timeout (auth + catalog > 500ms budget) | Show cached home if available |
11.2 Thread pool and bulkhead configuration
application.yml (Spring Boot + Resilience4j example):
resilience4j:
thread-pool-bulkhead:
instances:
catalogBulkhead:
max-thread-pool-size: 150
core-thread-pool-size: 50
queue-capacity: 100
authBulkhead:
max-thread-pool-size: 50
core-thread-pool-size: 20
queue-capacity: 25
circuitbreaker:
instances:
authService:
sliding-window-size: 100
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
permitted-number-of-calls-in-half-open-state: 3
slow-call-rate-threshold: 80
slow-call-duration-threshold: 200ms
timelimiter:
instances:
authService:
timeout-duration: 200ms
retry:
instances:
authService:
max-attempts: 2
wait-duration: 50ms
retry-exceptions:
- java.net.SocketTimeoutException
| Parameter | Value | Why |
|---|---|---|
authBulkhead.max-thread-pool-size | 50 | Caps auth fan-in — catalog pool unaffected |
failure-rate-threshold | 50% | Trip after half of sliding window fails |
slow-call-duration-threshold | 200ms | Treat slow calls as failures — trip before 8s |
wait-duration-in-open-state | 30s | Cooldown before half-open probes |
max-attempts | 2 | One retry max — prevents retry storm |
11.3 HTTP client configuration
// OkHttp client for Auth service calls
OkHttpClient authClient = new OkHttpClient.Builder()
.connectTimeout(Duration.ofMillis(100))
.readTimeout(Duration.ofMillis(200))
.writeTimeout(Duration.ofMillis(100))
.connectionPool(new ConnectionPool(50, 5, TimeUnit.MINUTES))
.addInterceptor(new RetryBudgetInterceptor(maxRetryPercent = 0.01))
.build();
| Setting | Value | Failure prevented |
|---|---|---|
readTimeout | 200ms | Thread blocked 8s on slow Auth |
connectionPool max | 50 | Connection exhaustion to Auth |
RetryBudgetInterceptor | 1% fleet cap | Retry storm amplification |
11.4 BFF request handler — step-by-step (low level)
AWS request path — end to end:
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | GET /v1/home | Client requests home screen composition. |
| 2 | Cache miss | CloudFront forwards dynamic API to ALB. |
| 3 | Route to task | ALB picks healthy BFF task with capacity. |
| 4 | GET session | Check Redis for cached session validation. |
| 5a | Cache hit | Skip Auth entirely — fast path during incident. |
| 5b | Cache miss | Must validate; check circuit breaker state first. |
| 6 | Auth validate | CLOSED: call Auth with 200ms timeout. |
| 6b | Fast-fail | OPEN: skip Auth; degrade to catalog-only mode. |
| 7 | Response | Auth returns entitlements or times out → counts as failure. |
| 8 | Cache write | On success, cache session for 300s — reduces Auth fan-in. |
| 9 | Catalog fetch | Parallel call on separate bulkhead pool. |
| 10 | Catalog rows | Home metadata from Catalog service. |
| 11 | Home JSON | BFF composes and returns response to client. |
11.5 Circuit breaker implementation
Handler pseudocode:
def validate_session(token: str) -> SessionResult:
# Step 1: Check circuit breaker state
if auth_circuit.state == OPEN:
cached = redis.get(f"session:{token}")
if cached:
return SessionResult(degraded=True, data=cached)
raise AuthUnavailableError() # fast-fail < 1ms
# Step 2: Attempt auth with timeout (bulkhead pool)
try:
with auth_bulkhead.acquire(timeout=0.05):
response = auth_client.get(
"/validate",
headers={"Authorization": f"Bearer {token}"},
timeout=0.2,
)
except (Timeout, CircuitOpen, BulkheadFull):
auth_circuit.record_failure()
return fallback_session(token)
# Step 3: Cache success + record metrics
auth_circuit.record_success()
redis.setex(f"session:{token}", 300, response.json())
return SessionResult(degraded=False, data=response.json())
Step-by-step flow (code path):
| Step | Action | Explanation |
|---|---|---|
| 1 | Check CB state | OPEN → skip Auth call entirely. |
| 2 | Bulkhead acquire | Wait max 50ms for auth pool slot; reject if full. |
| 3 | HTTP call | 200ms read timeout — fail fast, free thread. |
| 4 | Record failure | Timeout/error increments sliding window toward OPEN. |
| 5 | Fallback | Return cached session or degraded catalog-only mode. |
| 6 | Cache success | Write-through to Redis — reduce future Auth load. |
11.6 Health check design
Anti-pattern (causes cascade):
GET /health
→ calls Auth /validate synchronously
→ Auth slow → all BFF instances unhealthy → total outage
Correct pattern — shallow liveness:
GET /health/live → 200 if process up + thread pool < 95%
GET /health/ready → 200 if can accept traffic (bulkhead has capacity)
GET /health/deep → calls Auth — for monitoring only, NOT used by ALB
| Check | ALB uses? | Calls Auth? | Purpose |
|---|---|---|---|
/health/live | Yes | No | Process alive; thread pool not saturated |
/health/ready | Optional | No | Bulkhead has queue capacity |
/health/deep | No | Yes | Dashboard / synthetic monitoring only |
11.7 Retry budget (fleet-wide)
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Client retry | Mobile app retries on 503 — must be capped. |
| 2 | Upstream retry | Other services retry BFF calls — compounds load. |
| 3 | Check budget | Token bucket: max 100 retry RPS fleet-wide. |
| 4 | Allow | Retry proceeds if budget has tokens. |
| 5 | Reject | Return 429 — forces client backoff. |
Retry amplification math:
| Source | RPS | Retry rate | Extra load |
|---|---|---|---|
| Clients | 10,000 | 3% × 2 retries | +600 RPS |
| Upstream services | 2,000 | 5% × 1 retry | +100 RPS |
| Total amplification | +700 RPS on Auth |
11.8 App Mesh policy (Envoy sidecar)
# AWS App Mesh virtual node — auth dependency
spec:
listeners:
- portMapping:
port: 8080
protocol: http
timeout:
perRequest:
value: 0.2 # 200ms
backends:
- virtualService:
virtualServiceName: auth-service
connectionPool:
http:
maxConnections: 50
maxPendingRequests: 25
outlierDetection:
maxServerErrors: 5
interval: 10s
baseEjectionTime: 30s
maxEjectionPercent: 50
| Policy | Value | Effect |
|---|---|---|
perRequest.timeout | 200ms | Platform-enforced — apps can't override without ADR |
maxConnections | 50 | Connection bulkhead to Auth per task |
outlierDetection | 5 errors / 10s | Envoy-level circuit breaker |
12. HA/DR and Failover
12.1 Single-region multi-AZ (baseline)
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1–3 | Route | ALB distributes across 3 AZs — survives single AZ loss. |
| 4 | Auth call | Prefer same-AZ Auth via locality routing (optional). |
| 5–6 | Replicate | Redis cluster mode — automatic failover on node loss. |
Cascading failure interaction: Multi-AZ does not prevent cascade — it only survives AZ hardware failure. Auth slowness affects all AZs simultaneously.
12.2 Regional failover
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Health check fail | Regional ALB health degrades as BFF fleet exhausts. |
| 2 | Failover DNS | Route 53 shifts traffic to healthy region. |
| 3 | West healthy | West region Auth + BFF operating normally. |
| 4 | Regional recovery | Users in failover region get full service. |
Caution: Failover does not fix metastable East — drain connections, reset circuit breakers, clear retry queues before re-admitting traffic.
12.3 Recovery runbook (metastable failure)
| Step | Action | Owner | Duration |
|---|---|---|---|
| 1 | Confirm Auth root cause identified (or still investigating) | Auth team | — |
| 2 | Manually OPEN circuit breaker fleet-wide on BFF | Platform SRE | 2 min |
| 3 | Enable degraded mode (X-Degraded: auth catalog-only) | BFF team | 1 min |
| 4 | Reduce client retry rate via feature flag (SSM Parameter) | Client platform | 5 min |
| 5 | Scale Auth horizontally (if CPU-bound) | Auth team | 10 min |
| 6 | Wait for BFF thread pools to drain (no new Auth calls) | — | 5–15 min |
| 7 | HALF_OPEN probe — 3 canary requests to Auth | SRE | 1 min |
| 8 | CLOSE circuit breaker; re-enable full home screen | SRE | 2 min |
| 9 | Post-incident: verify retry budget metrics returned to baseline | SRE | 30 min |
13. Chaos Engineering and Validation
13.1 AWS FIS experiment — Auth latency injection
Step-by-step flow:
| Step | Action | Explanation |
|---|---|---|
| 1 | Start experiment | FIS adds 8s latency to Auth tasks in staging. |
| 2 | Observe | Catalog latency must stay < 500ms — bulkhead proof. |
| 3 | Trip CB | Circuit opens within 30s of slow-call threshold. |
| 4 | Bulkhead holds | BFF /health/live stays 200 — shallow health check. |
| 5 | Degrade works | Clients receive catalog-only home with X-Degraded: auth. |
13.2 Chaos experiment catalog
| Experiment | Injection | Pass criteria |
|---|---|---|
| Auth latency 8s | FIS network latency | Catalog unaffected; CB opens |
| Auth 100% error | FIS HTTP 500 | Fast-fail < 5ms; no thread exhaustion |
| Auth complete down | Scale Auth to 0 | Degraded mode; no cascade |
| Retry storm | Load test 3% retry rate | Retry budget caps at 1% |
| AZ failure | FIS terminate AZ-a | ALB reroutes; no user impact |
| Metastable recovery | Latency injection → heal → verify | Manual CB reset required |
14. Security, Observability, and Operations
14.1 Security architecture
| Topic | Implementation |
|---|---|
| Session tokens | Short-lived JWT; Redis encrypted at rest (KMS) |
| Degraded mode | Never bypass entitlements for paid content — catalog-only is safe |
| Rate limit | WAF + per-client token bucket on BFF |
| Circuit breaker admin | Manual trip requires break-glass IAM role + CloudTrail audit |
14.2 Observability architecture
Required metrics:
| Metric | Alert threshold | Why |
|---|---|---|
bff_thread_pool_active_ratio | > 0.9 for 2 min | Cascade imminent |
auth_circuit_breaker_state | OPEN for > 5 min | Sustained Auth degradation |
auth_client_latency_p99 | > 200ms for 1 min | Slow-call threshold breach |
retry_budget_utilization | > 80% | Retry storm building |
degraded_response_rate | > 10% | User-visible degradation |
catalog_bulkhead_rejected | > 0 | Catalog pool saturated — escalate |
Structured log (every auth call):
{
"request_id": "req_8f3a",
"auth_outcome": "success|timeout|circuit_open|bulkhead_rejected",
"auth_latency_ms": 45,
"circuit_state": "CLOSED",
"degraded": false,
"bulkhead_pool": "auth"
}
15. Implementation Roadmap (6-Week Rollout)
| Week | Deliverable | AWS services |
|---|---|---|
| 1 | Timeouts + shallow health | ALB, ECS, CloudWatch |
| 2 | Circuit breaker + bulkhead | ECS, Resilience4j library |
| 3 | Session cache + degraded mode | ElastiCache Redis |
| 4 | Mesh policies + retry budget | App Mesh, SSM Parameter Store |
| 5 | Chaos experiments | AWS FIS, staging VPC |
| 6 | Game day + production gates | CloudWatch dashboards, PagerDuty |
16. Testing Strategy
| Test type | Tool | Scenario |
|---|---|---|
| Unit | JUnit / pytest | Circuit breaker state transitions |
| Integration | Testcontainers | Auth timeout → fallback path |
| Load | k6 / Gatling | 10K RPS with 3% client retry |
| Chaos | AWS FIS | 8s Auth latency injection |
| Game day | Manual + FIS | Full metastable recovery runbook |
Load test pass criteria:
| Metric | Threshold |
|---|---|
| Catalog p99 during Auth degradation | < 500ms |
| BFF error rate | < 0.1% (excluding degraded 200s) |
| Thread pool saturation | < 80% on catalog bulkhead |
| Circuit breaker trip time | < 30s from injection start |
17. Architecture Review Checklist
| # | Gate | Status |
|---|---|---|
| 1 | Every outbound HTTP call has explicit timeout ≤ 200ms | ☐ |
| 2 | Circuit breaker on all synchronous dependencies | ☐ |
| 3 | Bulkhead separates critical vs optional dependency pools | ☐ |
| 4 | ALB health check does NOT call downstream dependencies | ☐ |
| 5 | Retry budget caps fleet-wide retry rate ≤ 1% | ☐ |
| 6 | Degraded mode defined and tested for each critical dependency | ☐ |
| 7 | Redis session cache with TTL + encryption at rest | ☐ |
| 8 | FIS chaos experiment passes in staging | ☐ |
| 9 | Metastable recovery runbook documented and drilled | ☐ |
| 10 | Dashboards: thread pool, CB state, retry budget, degraded rate | ☐ |
| 11 | App Mesh / sidecar enforces platform timeout defaults | ☐ |
| 12 | Post-incident: Auth latency injection in CI pipeline (weekly) | ☐ |