Distributed Systems: When One Computer Isn't Enough
"A distributed system is one where the failure of a computer you didn't even know existed can render your own computer unusable." — Leslie Lamport
It's 2:37 AM. Your phone buzzes. PagerDuty alert: "Payment success rate dropped to 34%."
You SSH into the dashboard. Everything looks green. All servers healthy. Database responding. Redis humming along.
But payments are failing.
After 45 minutes of debugging, you find it: a single Redis node in your rate limiting cluster had its clock drift by 3 seconds. This caused token bucket refills to happen at the wrong time, which triggered cascading rate limit failures across 47 API endpoints.
A 3-second clock drift. On a server you'd never heard of. Brought down your entire payment system.
Welcome to distributed systems.
Why This is Hard
When you have one computer, debugging is straightforward. Add a log, reproduce the bug, fix it.
When you have 100 computers, things get weird:
- Events happen simultaneously (sort of)
- Messages arrive out of order
- Servers lie (Byzantine faults)
- Networks partition at the worst possible time
- Clocks disagree about what time it is
The challenges we'll tackle today:
- Rate limiting across 100 servers without a bottleneck
- Notifications to 10 million users without melting
- Fraud detection in 100 milliseconds
- Reconciliation when systems disagree about what happened
- Sagas for undoing distributed transactions
Let's dive in.
Building a Distributed Rate Limiter
The Problem
You're running an API gateway for a fintech app. Traffic: 50,000 requests per second. You need to enforce limits:
- 100 requests/minute per user
- 10,000 requests/minute per partner app
- 1,000,000 requests/minute total
Here's the catch: you have 20 gateway servers. Each request might land on any of them.
Naive approach: Each server tracks its own counts.
Server 1: "User X made 50 requests to me. Under limit!" Server 2: "User X made 50 requests to me. Under limit!" ... Server 20: "User X made 50 requests to me. Under limit!" Total: 1,000 requests. Limit was 100. Oops.

Distributed Problem
The Algorithms
Before solving distribution, let's understand the rate limiting algorithms.
Token Bucket:
Imagine a bucket that holds 100 tokens. Tokens refill at 10/second. Each request takes one token. No tokens? Request rejected.

Token Bucket Algorithm
gotype TokenBucket struct { tokens float64 maxTokens float64 refillRate float64 // tokens per second lastRefill time.Time mu sync.Mutex } func (b *TokenBucket) Allow() bool { b.mu.Lock() defer b.mu.Unlock() // Refill tokens based on time elapsed now := time.Now() elapsed := now.Sub(b.lastRefill).Seconds() b.tokens = math.Min(b.maxTokens, b.tokens + elapsed*b.refillRate) b.lastRefill = now // Try to consume a token if b.tokens >= 1 { b.tokens-- return true } return false }
Why token bucket? It allows bursts. A user who's been quiet can suddenly make 100 requests, then must wait for refill. Good for real-world traffic patterns.
Sliding Window:
Count requests in a moving time window.

Sliding Window
The naive "fixed window" has a problem:
- 11:00:59 → 100 requests (allowed, resets at 11:01:00)
- 11:01:01 → 100 requests (allowed, new window)
- Result: 200 requests in 2 seconds!
Sliding window fixes this by weighting requests based on how far into the current window we are.
gofunc (sw *SlidingWindow) Allow() bool { now := time.Now() currentWindow := now.Truncate(sw.windowSize) previousWindow := currentWindow.Add(-sw.windowSize) // Get counts for current and previous window currentCount := sw.getCount(currentWindow) previousCount := sw.getCount(previousWindow) // Calculate position in current window (0.0 to 1.0) elapsed := now.Sub(currentWindow).Seconds() windowSeconds := sw.windowSize.Seconds() weight := elapsed / windowSeconds // Weighted count: full weight for current, partial for previous weightedCount := currentCount + previousCount*(1-weight) return weightedCount < sw.limit }
Going Distributed: The Redis Solution
For distributed rate limiting, we need a shared counter. Redis is the obvious choice.

Redis Solution
But there's a race condition:
Server A: GET user:123:count → 99 Server B: GET user:123:count → 99 Server A: SET user:123:count 100 → "Under limit, allow" Server B: SET user:123:count 100 → "Under limit, allow" Both requests allowed! But limit was 100.
The fix: Lua scripts
Redis executes Lua scripts atomically. No race conditions.
-- rate_limit.lua local key = KEYS[1] local limit = tonumber(ARGV[1]) local window = tonumber(ARGV[2]) local current = redis.call('INCR', key) if current == 1 then redis.call('EXPIRE', key, window) end if current > limit then return 0 -- Rejected end return 1 -- Allowed
Scaling Beyond Redis
At 1 million requests/second, even Redis becomes a bottleneck. Every request requires a network round-trip.
The solution: Hybrid rate limiting

Hybrid Rate Limiting
gotype HybridRateLimiter struct { localBucket *TokenBucket // Fast path redis *RedisLimiter // Coordination localLimit int // 10% of total limit syncInterval time.Duration } func (rl *HybridRateLimiter) Allow(ctx context.Context, userID string) bool { // Fast path: check local bucket first if rl.localBucket.Tokens() > 0 { rl.localBucket.Take(1) return true } // Slow path: check Redis for more tokens allowed := rl.redis.Allow(ctx, userID) if allowed { // Replenish local bucket from Redis rl.localBucket.Add(rl.localLimit) } return allowed }
Trade-off: You might allow 10-20% more requests than the limit during sync gaps. For most applications, this is acceptable. For payment systems, stick with Redis-only.
A Real Incident: The Token Bucket Overflow
We had a bug in production that took us a week to find.
The symptom: Random users getting rate limited despite being way under their limits.
The investigation:
Our token bucket implementation looked fine. Tests passed. Code review approved.
But we'd made a subtle mistake:
go// The bug b.tokens = b.tokens + elapsed*b.refillRate // Should have been: b.tokens = math.Min(b.maxTokens, b.tokens + elapsed*b.refillRate)
When a server was idle for hours, tokens would accumulate to millions. This seemed harmless—users could make lots of requests!
But our counter was a float64. After enough accumulation, we hit floating-point precision issues. Comparisons started failing randomly.
The fix: Always cap tokens at maxTokens. And add monitoring for token values that seem too high.
The lesson: Simple algorithms have subtle edge cases. Test with extreme values, not just normal traffic.
Notification System at Scale
The Challenge
Your app has 50 million users. You need to send a notification to all of them about a new feature.
Do the math:
- 50 million push notifications
- FCM (Firebase Cloud Messaging) allows 500 requests/second per project
- Time to send all: 50,000,000 / 500 = 100,000 seconds ≈ 28 hours
That's too slow for a "real-time" notification.
The Architecture

Notification Architecture
The fan-out pattern:
- Notification Service receives request: "Send to all users"
- Segmenter breaks this into batches: 1000 users per batch
- Queue (Kafka) holds 50,000 batch jobs
- Workers (100 instances) each process batches in parallel
- Provider Clients (FCM, APNs, SMS) handle delivery
With 100 workers, each processing 500 notifications/second, you can send 50,000/second. 50 million notifications in ~17 minutes.
The Journey of a Single Notification
Let's trace one notification through the system.

Notification Journey
gotype Notification struct { ID string UserID string Title string Body string Channel string // push, sms, email Priority int // 0=low, 1=normal, 2=high ScheduledAt time.Time Attempts int LastError string Status string // pending, sent, delivered, failed } func (s *NotificationService) Send(ctx context.Context, n *Notification) error { // 1. Validate if err := n.Validate(); err != nil { return err } // 2. Enrich with user preferences prefs, _ := s.userService.GetPreferences(ctx, n.UserID) if !prefs.Allows(n.Channel) { return ErrUserOptedOut } // 3. Queue for delivery n.Status = "pending" if err := s.queue.Enqueue(ctx, n); err != nil { return err } // 4. Track s.metrics.NotificationsQueued.Inc() return nil }
Handling Failures
FCM goes down. APNs is slow. SMS provider is rate limiting you.

Retry Strategy
Exponential backoff with jitter:
gofunc (w *Worker) processWithRetry(ctx context.Context, n *Notification) error { maxAttempts := 5 baseDelay := 1 * time.Second for attempt := 1; attempt <= maxAttempts; attempt++ { err := w.deliver(ctx, n) if err == nil { return nil } // Permanent failure - don't retry if isPermanentError(err) { n.Status = "failed" n.LastError = err.Error() return w.markFailed(ctx, n) } // Transient failure - retry with backoff n.Attempts = attempt n.LastError = err.Error() // Exponential backoff: 1s, 2s, 4s, 8s, 16s delay := baseDelay * time.Duration(1<<(attempt-1)) // Add jitter (±25%) to prevent thundering herd jitter := time.Duration(rand.Float64()*0.5-0.25) * delay delay += jitter select { case <-ctx.Done(): return ctx.Err() case <-time.After(delay): continue } } // Move to dead letter queue for manual review return w.moveToDLQ(ctx, n) } func isPermanentError(err error) bool { // Invalid device token - user uninstalled app // Invalid phone number - can't send SMS // User blocked notifications return errors.Is(err, ErrInvalidToken) || errors.Is(err, ErrInvalidPhone) || errors.Is(err, ErrUserBlocked) }
The dead letter queue (DLQ):
After max retries, notifications go to DLQ for manual review. Common reasons:
- Provider outage lasting longer than retry window
- Bug in notification payload
- Rate limit exceeded
Monitor DLQ size. If it's growing, something's wrong.
Priority Queues
Not all notifications are equal.
- High priority: Payment alerts, security warnings
- Normal priority: Order updates, delivery status
- Low priority: Marketing, feature announcements
go// Use separate Kafka topics per priority highPriorityTopic := "notifications.high" normalPriorityTopic := "notifications.normal" lowPriorityTopic := "notifications.low" // Workers consume high priority first func (w *Worker) Run(ctx context.Context) { for { // Try high priority first msg, err := w.consumer.Poll(ctx, highPriorityTopic, 10*time.Millisecond) if err == nil { w.process(msg) continue } // Then normal msg, err = w.consumer.Poll(ctx, normalPriorityTopic, 10*time.Millisecond) if err == nil { w.process(msg) continue } // Then low (only if others empty) msg, err = w.consumer.Poll(ctx, lowPriorityTopic, 100*time.Millisecond) if err == nil { w.process(msg) } } }
Fraud Detection in 100ms
The Challenge
A payment request comes in. You have 100 milliseconds to decide: legitimate or fraud?
For context:
- Human blink: 300ms
- Your fraud check: 100ms
- User patience: ~3 seconds total
If fraud detection is slow, either users get frustrated or you skip the check and lose money.

Fraud Detection Timeline
The Three-Layer Defense

Fraud Detection Layers
Layer 1: Rules Engine (5-10ms)
Fast, deterministic checks. No ML, just logic.
gotype Rule interface { Evaluate(txn *Transaction) *RuleResult } type VelocityRule struct { MaxTransactions int TimeWindow time.Duration } func (r *VelocityRule) Evaluate(txn *Transaction) *RuleResult { count := r.cache.GetTransactionCount(txn.UserID, r.TimeWindow) if count > r.MaxTransactions { return &RuleResult{ RuleName: "velocity_check", Blocked: true, Reason: fmt.Sprintf("%d transactions in %v exceeds limit", count, r.TimeWindow), } } return &RuleResult{Blocked: false} } // Rules evaluated in parallel func (e *RulesEngine) Evaluate(ctx context.Context, txn *Transaction) []*RuleResult { results := make([]*RuleResult, len(e.rules)) var wg sync.WaitGroup for i, rule := range e.rules { wg.Add(1) go func(idx int, r Rule) { defer wg.Done() results[idx] = r.Evaluate(txn) }(i, rule) } wg.Wait() return results }
Common rules:
- Velocity: >10 transactions in 1 minute
- Amount: Transaction >5x user's average
- Time: Transaction at 3 AM in user's timezone
- Location: Transaction from new country
Layer 2: ML Model (20-40ms)
For patterns too complex for rules.
gotype FraudMLModel struct { endpoint string // ML model serving endpoint client *http.Client } func (m *FraudMLModel) Score(ctx context.Context, features *Features) (float64, error) { // Prepare feature vector payload := features.ToVector() // Call model endpoint (usually TensorFlow Serving or similar) resp, err := m.client.Post(ctx, m.endpoint, payload) if err != nil { // Model unavailable - fall back to rules-only return 0.5, nil // Neutral score } return resp.FraudProbability, nil } type Features struct { UserAge int // Days since account creation TransactionAmount float64 AvgTransactionAmount float64 TransactionCount24h int NewDevice bool NewLocation bool DistanceFromUsual float64 // km TimeSinceLastTxn float64 // minutes // ... 50+ features }
Layer 3: Graph Analysis (50-80ms)
Fraud rings involve multiple accounts. Graph analysis catches them.
User A → paid → User B → paid → User C → paid → User A ↑ Circular flow! Suspicious.
Graph databases like Neo4j or Amazon Neptune help here, but they're too slow for real-time. Solution: pre-compute risk scores nightly, cache them for real-time lookup.
The Impossible Travel Rule
This rule deserves special attention because it's elegant and effective.

Impossible Travel Detection
gofunc (r *ImpossibleTravelRule) Evaluate(txn *Transaction) *RuleResult { lastTxn := r.cache.GetLastTransaction(txn.UserID) if lastTxn == nil { return &RuleResult{Blocked: false} } // Calculate distance and time distance := haversineDistance(lastTxn.Location, txn.Location) // km timeDelta := txn.Time.Sub(lastTxn.Time).Hours() // Calculate required speed // 900 km/h is max commercial flight speed requiredSpeed := distance / timeDelta if requiredSpeed > 900 { return &RuleResult{ Blocked: true, Reason: fmt.Sprintf( "Impossible travel: %d km in %.1f hours (%.0f km/h required)", int(distance), timeDelta, requiredSpeed, ), } } return &RuleResult{Blocked: false} } func haversineDistance(a, b Location) float64 { // Earth radius in km const R = 6371 lat1 := a.Lat * math.Pi / 180 lat2 := b.Lat * math.Pi / 180 dLat := (b.Lat - a.Lat) * math.Pi / 180 dLon := (b.Lng - a.Lng) * math.Pi / 180 h := math.Sin(dLat/2)*math.Sin(dLat/2) + math.Cos(lat1)*math.Cos(lat2)* math.Sin(dLon/2)*math.Sin(dLon/2) c := 2 * math.Atan2(math.Sqrt(h), math.Sqrt(1-h)) return R * c }
Real example: User made a purchase in Mumbai at 10:00 AM. At 10:30 AM, same card used in London. Mumbai to London is 7,200 km. Required speed: 14,400 km/h. Commercial jets max out at 900 km/h.
Blocked.
Transaction Reconciliation
Why Reconciliation Exists
In a perfect world, every system agrees on what happened. In the real world:
- Your database says you debited the user
- The bank says they never received the request
- NPCI says the transaction timed out
- The user says they were charged twice
Every night, financial systems run reconciliation to answer: "What actually happened?"

Reconciliation Sources
The Three-Way Match
Your Records Bank Records NPCI Records ↓ ↓ ↓ ┌────────────────────────┐ │ Reconciliation Job │ └────────────────────────┘ ↓ ┌────────────────────────┐ │ Matched │ Mismatched │ │ 98.5% │ 1.5% │ └────────────────────────┘
Exception Types

Exception Types
1. Missing at bank:
- You debited, bank has no record
- Usually: network failure during transmission
- Resolution: Refund the user
2. Missing at you:
- Bank debited, you have no record
- Usually: your system crashed before logging
- Resolution: Investigate, possibly refund
3. Amount mismatch:
- You say ₹100, bank says ₹1000
- Usually: data corruption or bug
- Resolution: Manual investigation
4. Status mismatch:
- You say success, bank says failed
- Usually: timeout handling bug
- Resolution: Trust the bank, refund if needed
The Reconciliation Flow
gotype ReconciliationJob struct { date time.Time ourTxns map[string]*Transaction bankTxns map[string]*BankTransaction npciTxns map[string]*NPCITransaction } func (j *ReconciliationJob) Run(ctx context.Context) (*ReconciliationReport, error) { report := &ReconciliationReport{} // Load all transactions for the date j.ourTxns = j.loadOurTransactions(ctx, j.date) j.bankTxns = j.loadBankTransactions(ctx, j.date) j.npciTxns = j.loadNPCITransactions(ctx, j.date) // Match transactions for txnID, ourTxn := range j.ourTxns { bankTxn := j.bankTxns[txnID] npciTxn := j.npciTxns[txnID] result := j.matchTransaction(ourTxn, bankTxn, npciTxn) report.Add(result) } // Find transactions bank has but we don't for txnID, bankTxn := range j.bankTxns { if _, exists := j.ourTxns[txnID]; !exists { report.Add(&MatchResult{ Type: ExceptionMissingAtUs, BankTxn: bankTxn, }) } } return report, nil } func (j *ReconciliationJob) matchTransaction( our *Transaction, bank *BankTransaction, npci *NPCITransaction, ) *MatchResult { if bank == nil { return &MatchResult{Type: ExceptionMissingAtBank, OurTxn: our} } if our.Amount != bank.Amount { return &MatchResult{ Type: ExceptionAmountMismatch, OurTxn: our, BankTxn: bank, } } if our.Status != bank.Status { return &MatchResult{ Type: ExceptionStatusMismatch, OurTxn: our, BankTxn: bank, } } return &MatchResult{Type: Matched, OurTxn: our, BankTxn: bank} }
Resolution Workflows

Resolution Flow
Not all exceptions need manual review. Many can be auto-resolved:
gofunc (r *Resolver) AutoResolve(ctx context.Context, exception *Exception) (bool, error) { switch exception.Type { case ExceptionMissingAtBank: // If we debited but bank didn't receive, auto-refund if exception.OurTxn.Status == StatusDebited { return true, r.initiateRefund(ctx, exception.OurTxn) } case ExceptionStatusMismatch: // If we say success but bank says failed, trust the bank if exception.OurTxn.Status == StatusSuccess && exception.BankTxn.Status == StatusFailed { return true, r.markAsFailedAndRefund(ctx, exception.OurTxn) } } // Cannot auto-resolve - needs manual review return false, nil }
The Saga Pattern: Undoing Distributed Transactions
The Problem
You're processing an e-commerce order:
- Reserve inventory ✅
- Charge payment ✅
- Create order ❌ (database crashed)
- Send confirmation ❌
Now you have:
- Inventory reserved (but no order)
- Money charged (but no order)
- Customer confused
Traditional solution: Distributed transactions (2PC).
Problem with 2PC: It's slow, it doesn't scale, and if the coordinator crashes mid-transaction, everything locks up.
Better solution: Sagas.
What's a Saga?
A saga is a sequence of local transactions. Each transaction has a compensating action that can undo it.

Saga Pattern
Forward actions: Compensating actions: 1. Reserve inventory → 1. Release inventory 2. Charge payment → 2. Refund payment 3. Create order → 3. Cancel order 4. Send confirmation → 4. (no compensation needed)
Saga in Action

Saga in Action
gotype OrderSaga struct { steps []SagaStep state *SagaState } type SagaStep struct { Name string Execute func(ctx context.Context, state *SagaState) error Compensate func(ctx context.Context, state *SagaState) error } func NewOrderSaga() *OrderSaga { return &OrderSaga{ steps: []SagaStep{ { Name: "reserve_inventory", Execute: func(ctx context.Context, s *SagaState) error { return inventoryService.Reserve(ctx, s.OrderID, s.Items) }, Compensate: func(ctx context.Context, s *SagaState) error { return inventoryService.Release(ctx, s.OrderID) }, }, { Name: "charge_payment", Execute: func(ctx context.Context, s *SagaState) error { return paymentService.Charge(ctx, s.OrderID, s.Amount) }, Compensate: func(ctx context.Context, s *SagaState) error { return paymentService.Refund(ctx, s.OrderID) }, }, { Name: "create_order", Execute: func(ctx context.Context, s *SagaState) error { return orderService.Create(ctx, s.OrderID, s.Items) }, Compensate: func(ctx context.Context, s *SagaState) error { return orderService.Cancel(ctx, s.OrderID) }, }, { Name: "send_confirmation", Execute: func(ctx context.Context, s *SagaState) error { return notificationService.SendOrderConfirmation(ctx, s.OrderID) }, Compensate: nil, // Can't unsend an email }, }, } } func (s *OrderSaga) Run(ctx context.Context) error { completedSteps := []int{} for i, step := range s.steps { s.state.CurrentStep = step.Name s.state.Status = "running" s.persist() err := step.Execute(ctx, s.state) if err != nil { // Step failed - start compensation s.state.Status = "compensating" s.state.FailedAt = step.Name s.persist() // Compensate in reverse order for j := len(completedSteps) - 1; j >= 0; j-- { stepIdx := completedSteps[j] if s.steps[stepIdx].Compensate != nil { s.steps[stepIdx].Compensate(ctx, s.state) } } s.state.Status = "compensated" s.persist() return err } completedSteps = append(completedSteps, i) } s.state.Status = "completed" s.persist() return nil }
Persisted Saga: Surviving Crashes
What if your saga orchestrator crashes mid-execution?

Persisted Saga
sqlCREATE TABLE saga_states ( saga_id UUID PRIMARY KEY, saga_type VARCHAR(50) NOT NULL, status VARCHAR(20) NOT NULL, -- running, compensating, completed, failed current_step VARCHAR(50), failed_at VARCHAR(50), state_data JSONB, created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW() ); -- Index for recovery queries CREATE INDEX idx_stuck_sagas ON saga_states(status, updated_at) WHERE status IN ('running', 'compensating');
Recovery worker:
gofunc (w *SagaRecoveryWorker) Run(ctx context.Context) { ticker := time.NewTicker(1 * time.Minute) for range ticker.C { // Find stuck sagas (no update in 5 minutes) stuckSagas, _ := w.db.Query(ctx, ` SELECT * FROM saga_states WHERE status IN ('running', 'compensating') AND updated_at < NOW() - INTERVAL '5 minutes' FOR UPDATE SKIP LOCKED `) for _, saga := range stuckSagas { w.recover(ctx, saga) } } } func (w *SagaRecoveryWorker) recover(ctx context.Context, saga *SagaState) { switch saga.Status { case "running": // Was executing forward - need to check if step completed completed := w.checkStepCompletion(ctx, saga) if completed { // Continue to next step w.continueForward(ctx, saga) } else { // Step didn't complete - start compensation w.startCompensation(ctx, saga) } case "compensating": // Was compensating - continue compensation w.continueCompensation(ctx, saga) } }
Security Considerations
Distributed systems have unique security challenges.
Clock Skew Attacks
If servers' clocks disagree, attackers can exploit this:
Server A clock: 10:00:00 Server B clock: 10:00:05 (5 seconds ahead) Attacker: 1. Gets rate limit token from Server A (valid 10:00:00 - 10:01:00) 2. Token expires on Server A 3. Server B still thinks token is valid for 5 more seconds 4. Attacker uses expired token on Server B
Defense: Use NTP on all servers. Monitor clock drift. Design systems to tolerate small drift.
Replay Attacks on Messages
In distributed systems, attackers can capture and replay messages.
Defense:
- Include timestamp in messages, reject if too old
- Include nonce (one-time random value), track seen nonces
- Sign messages with HMAC
Distributed Denial of Service
With 20 servers, an attacker needs to overwhelm all 20 to succeed. But if all 20 share a Redis instance for rate limiting, attacking Redis takes down all 20.
Defense:
- Local rate limiting as first line
- Multiple Redis clusters for redundancy
- Geographic distribution
Interview Tips
When distributed systems come up:
1. Identify the Hard Problems
"The main challenges here are: consistency across nodes, handling partial failures, and dealing with network partitions."
2. Start with the Happy Path
"Let me first walk through what happens when everything works, then we'll discuss failure modes."
3. Discuss Trade-offs
"We could use strong consistency with 2PC, but that's slow and doesn't scale. Saga pattern gives us eventual consistency with better fault tolerance."
4. Mention Specific Technologies
"For distributed rate limiting, Redis with Lua scripts gives us atomic operations. At higher scale, we'd add local token buckets to reduce Redis traffic."
5. Address Monitoring
"We'd need metrics on: request latency per service, error rates, saga completion times, and reconciliation exception rates."
Key Takeaways

Distributed Systems Mindmap
Rate limiting:
- Token bucket for bursty traffic, sliding window for strict limits
- Redis + Lua for distributed atomicity
- Hybrid (local + Redis) for extreme scale
Notifications:
4. Fan-out pattern with parallel workers
5. Priority queues for different urgency levels
6. Exponential backoff with jitter for retries
Fraud detection:
7. Three layers: rules, ML, graph analysis
8. Parallel evaluation to meet 100ms budget
9. Impossible travel is elegant and effective
Reconciliation:
10. Three-way match: your records, bank, NPCI
11. Auto-resolve common exceptions
12. Manual review for ambiguous cases
Sagas:
13. Local transactions with compensating actions
14. Persist state for crash recovery
15. Recovery workers find and resume stuck sagas
What's Next?
In Part 3: Go Concurrency Patterns, we'll explore:
- Worker pools that actually work
- Context cancellation done right
- Finding and fixing race conditions
- Performance optimization with profiling
Found this helpful? Share it with someone preparing for distributed systems interviews.