Based on the SAP-C02 exam guideReport an error
There is one unavoidable truth in distributed systems: Networks always break, nodes always die, and messages always get duplicated or disappear. Reliability (Stability) is the pillar that doesn't deny this truth but accepts and designs for it. Performance Efficiency is the pillar of processing faster and more efficiently with the same resources. The two pillars frequently conflict — sync replication across all regions for strong consistency improves reliability but degrades latency (performance). A pro architect's job is deciding where to cut this trade-off.
In SAP-C02, these two pillars appear with keywords like "RTO 5 minutes, RPO 1 minute," "ultra-low inter-node latency HPC," "message inflow faster than consumer," "global caching." Today we decompose distributed systems theory from the roots: CAP theorem and PACELC, the mathematics of idempotency and retries, principles of caching layers, and the physics of HPC networking.
The five design principles of Reliability stem from one assumption: "failures happen." Auto-recovery, test recovery procedures, horizontal scaling, capacity measurement via monitoring (not guessing), automate changes. The key is the third and second principles. Horizontal scale-out (scale-out) eliminates single points of failure, and testing recovery procedures acknowledges the difference between "backup exists" and "recovery actually works."
| Pattern | Tool | When Applied |
|---|---|---|
| Multi-AZ | ALB, RDS Multi-AZ, EFS, DynamoDB | Guard against single-AZ failure (sync replication) |
| Multi-Region | Aurora Global, DynamoDB Global Table, Route 53, S3 CRR | Guard against region failure, low RTO/RPO |
| Auto Scaling | ASG, Application Auto Scaling, Karpenter | Adapt to load changes |
| Health Check | Route 53, ELB, app-level | Auto-exclude unhealthy nodes |
| Retry + Backoff + Jitter | Built into SDKs | Absorb transient failures |
| Queuing + Decoupling | SQS, SNS, Kinesis | Decouple components, buffer |
| Backup + DR | AWS Backup, MGN, DRS | Recover data and systems |
| Chaos Testing | FIS | Verify recovery procedures |
💡 Related Theory: Behind Multi-AZ vs Multi-Region choice lies CAP Theorem (Brewer, 2000). CAP states: "When network partitioning occurs, you can only choose between Consistency and Availability." RDS Multi-AZ uses sync replication for strong consistency (CP)—the standby is always current, but if one AZ is cut off, there's brief unavailability during failover. DynamoDB Global Table chooses availability (AP)—all regions accept writes, but tolerates temporary inconsistency via last-writer-wins. In exams, "all regions write simultaneously + always available" is an AP (DynamoDB Global) signal; "always latest data guaranteed" is a CP (sync replication) signal.
🔍 Deeper Dive: CAP is incomplete because it says nothing about "when there's no partition." PACELC Theorem (Abadi, 2012) supplements it: "Partition means choose A or C, Else choose between Latency and Consistency." Even in normal operation, strong consistency requires tolerating latency via sync replication. Aurora Global Database advertises "sub-1-second RPO + sub-1-minute recovery" but uses async replication—this is the EL trade-off of PACELC. Syncing all regions would spike latency, so it accepts async replication to reduce latency instead, tolerating a sub-1-second data loss window. In exams, when RPO is "sub-1-second, not 0," you recognize async replication (Aurora Global).
📚 Case Study: The February 2017 AWS S3 us-east-1 massive outage started when an engineer mistyped a command during debugging, shutting down more servers than intended. Countless services depending on S3 (even AWS's own status dashboard) went down simultaneously. Two lessons emerged: (1) Architecture depending solely on us-east-1 collapses entirely on that region's failure (Multi-Region necessity), (2) if operational tools are bound to a single region, you can't respond during an outage (control plane independence). Afterward, many organizations redesigned critical workloads to Multi-Region and status dashboards to region-independent architectures.
📚 Case Study: During the October 2012 AWS EBS us-east-1 outage, Netflix was barely affected—notable because it had built a chaos engineering culture that same year. The secret: Chaos Monkey randomly killed instances to eliminate single points of failure, and deployed workloads stateless across multiple AZs so one AZ or component dying was auto-bypassed. Lesson: Reliability isn't ensured by responding after failures—it's ensured by regularly injecting failures to validate beforehand. AWS absorbed this philosophy into FIS (Fault Injection Simulator). "Backup exists" differs from "recovery actually works"—this is Reliability's essence.
💡 Related Theory: The four DR strategies are a spectrum of RTO/RPO and cost trade-offs — Backup/Restore (RTO hours, lowest cost) → Pilot Light (minimal active resources) → Warm Standby (scaled-down always-active) → Multi-Site Active-Active (full redundancy, RTO ~0, highest cost). Shorter RTO/RPO means more always-on resources, raising costs. In exams, "RTO in minutes" signals Warm Standby or better; "RTO hours + lowest cost" signals Backup/Restore. This spectrum is a key collision point between Reliability and Cost pillars.
Retry is basic to Reliability, but done wrong, it amplifies failures. Two concepts must be precise.
Idempotency: Executing the same request multiple times produces the same result as executing once. When a network timeout leaves "was the request processed?" unknown, safe retry requires idempotent operations. Non-idempotent operations like payments add an idempotency key—the server filters duplicates. SQS FIFO's message deduplication ID and Lambda's idempotent processing follow the same idea.
Exponential Backoff with Jitter: When all clients retry simultaneously on failure, a retry storm can collapse the server right before recovery (thundering herd). Backoff increases retry intervals exponentially (1s→2s→4s→8s) to spread load. Jitter adds randomness so clients don't spike simultaneously.
💡 Related Theory: Jitter's effect is explained by probability. Without jitter, backoff alone synchronizes all clients' retry times—causing load spikes at 1s, 2s, 4s moments. Adding jitter distributes retry times uniformly across [0, backoff] interval, flattening load over time. AWS Architecture Blog's "Exponential Backoff And Jitter" showed via simulation that full jitter (
random(0, base*2^n)) minimizes both retry count and server load. This is why AWS SDK defaults include jitter. In exams, "simultaneous retry overload" points toward backoff + jitter.
⚠️ Pitfall: In a "messages arrive faster than consumer can process" scenario, choosing sync calls (direct Lambda invocation, etc.) is wrong. Producer-consumer speed mismatch must use queue (SQS) buffering to absorb backpressure—the consumer polls at its own pace, and failed messages route to DLQ (Dead Letter Queue) for isolation, not blocking normal flow. Direct SNS fan-out or sync calls lose messages or timeout if the consumer can't keep up. In exams, "absorb inflow surge and decouple" is SQS + DLQ.
Performance's five principles are "democratize latest tech (managed), global reach, serverless first, experiment and measure, empathy-driven design." In practice, it boils down to choosing services in four domains—Compute, Storage, Database, Network—that match the workload.
Compute: EC2 (Graviton, Spot, Auto Scaling), Fargate, Lambda. Placement strategies — Cluster (low latency), Spread (isolation), Partition (large-scale distributed). Storage: gp3, io2 (block); st1, sc1 (throughput, cold); Instance Store (NVMe ultra-low-latency ephemeral); FSx (Lustre, Windows, NetApp ONTAP, OpenZFS). Database: Relational (RDS, Aurora), Key-Value (DynamoDB), Document (DocumentDB), Graph (Neptune), Time-series (Timestream), Ledger (QLDB), Wide-column (Keyspaces) + caching (ElastiCache, DAX, MemoryDB). Network: CloudFront, Global Accelerator, Enhanced Networking (ENA, EFA), Cluster Placement Group.
Client → CloudFront(edge) → API GW Cache → ElastiCache/DAX(app) → DB(source)
Each layer keeps frequently-used data in faster, cheaper storage, reducing requests reaching the slow, expensive source (DB). This is caching's essence — layering via locality principle.
💡 Related Theory: Caching mirrors memory hierarchy and principle of locality from computer architecture into distributed systems. Just as CPU L1/L2/L3 cache → RAM → disk tiers ("closer = faster and smaller and more expensive"), CloudFront → ElastiCache → DB follows the same structure. Cache efficiency depends on temporal locality (recently-used data used again) and spatial locality (nearby data used together). Cache strategies (write-through, write-back, cache-aside) and invalidation are identical to OS and DB cache theory. The joke "cache invalidation is one of two hardest problems in CS" applies to distributed caching too—DAX and ElastiCache TTL/invalidation design is key to consistency.
🎯 Scenario: "A read-heavy app reads the same DynamoDB item tens of thousands of times per second, hitting both cost and latency. Want microsecond response with minimal code changes. What to add?" — Answer: DAX (DynamoDB Accelerator). DAX is in-memory cache purpose-built for DynamoDB with API compatibility to DynamoDB—nearly zero code changes, plus microsecond response and reduced read costs on cache hits. ElastiCache (Redis/Memcached) is general-purpose but requires hand-written cache-aside logic. "DynamoDB-specific + minimal code change + microseconds" is DAX's direct answer.
HPC (high-performance computing) and distributed ML training exchange gradients every step across hundreds of nodes, so inter-node communication latency governs overall performance. Here, the physics of light speed and network stack overhead determines design.
🔍 Deeper Dive: Why is EFA's "OS-bypass" decisive? Regular TCP/IP communication incurs kernel mode switches, copying, and interrupts per packet—microsecond overhead accumulates. In distributed learning with hundreds of nodes communicating every step, this overhead idles GPUs. EFA uses SRD (Scalable Reliable Datagram) protocol, bypasses the kernel, and lets user space communicate directly with NIC—reducing latency by orders of magnitude. This is why Cluster PG (physical packing) + EFA (stack bypass) + Lustre (data supply) is the standard triple for HPC and large-scale ML training. In exams, "inter-node ultra-low latency + MPI/distributed learning" signals this combination.
Reliability assumes failures occur and expands from Multi-AZ (CP, sync) to Multi-Region (AP, async), makes retries safe via idempotency and exponential backoff with jitter, and validates recovery procedures with FIS. Performance Efficiency chooses services in four domains (Compute, Storage, Database, Network) matching the workload, reduces latency and cost simultaneously through caching (CloudFront, ElastiCache, DAX) using memory hierarchy principles, and HPC breaks physical limits with Cluster PG + EFA + Lustre.
SAP exam frequent mappings: (1) "RTO/RPO in minutes + global" → Aurora Global (async, sub-1-second RPO), DynamoDB Global Table, (2) "all regions write + always available" → DynamoDB Global (AP), (3) "inter-node ultra-low latency HPC/distributed learning" → Cluster PG + EFA + FSx Lustre, (4) "DynamoDB-specific microsecond cache + minimal code change" → DAX, (5) "absorb inflow surge and decouple" → SQS + DLQ, (6) "regularly validate recovery procedures" → FIS, (7) "simultaneous retry storm" → exponential backoff + jitter, (8) "ARM cost/performance/power" → Graviton. Next day dives into Cost and Sustainability pillars through unit economics and carbon accounting.
Click a choice to reveal the answer and explanation.
Question 1
A global service reads and writes simultaneously in multiple Regions, and even if one Region fails, other Regions must continue to accept writes without interruption. Temporary data inconsistency is acceptable to the business. What is the most appropriate database?
Question 2
A distributed ML training job exchanges gradients across hundreds of nodes at every step, and inter-node communication latency determines training speed. Communication performance takes priority over availability. What is the most appropriate configuration?
Question 3
A read-intensive application reads the same items from DynamoDB tens of thousands of times per second, resulting in high latency and cost. You want microsecond responses while minimizing application code changes. What is the most appropriate solution?
Question 4
In a mobile backend, when recovering from a failure, many clients retry at the same time, and the server repeatedly collapses again just before recovering. What is the most appropriate response?
Question 5
In a system, producers push messages faster than consumers can process them, causing message loss and timeouts. You want messages that fail processing to be isolated and reprocessed separately without blocking the normal flow. What is the most appropriate design?
Question 6
A team adopted Aurora Global Database, and the documentation states that the RPO is "not 0 but under 1 second." What best explains this RPO characteristic?