Performance Efficiency & Cost Optimization
Pillars 2 & 3: DynamoDB Single-Table Design, compute form factors (Lambda vs Fargate vs EC2), NAT Gateway traps ($0.045/GB), and cross-AZ data transfer charges.
Source: AWS Well-Architected Tool:
- Performance Efficiency: PERF 1 – PERF 5 (5 Questions)
- Cost Optimization: COST 1 – COST 11 (11 Questions)
Core Concept: Maximizing throughput and minimizing latency while ruthlessly eliminating unnecessary cloud spend and data transfer waste.
1. Performance Efficiency (PERF 1 – PERF 5)
| ID | Question | Architectural Focus for Interviews |
|---|---|---|
| PERF 1 | How do you select the appropriate cloud resources and architecture patterns? | Microservices vs Serverless event-driven architectures, choosing between relational, key-value, document, graph, or time-series data models based on query access patterns. |
| PERF 2 | How do you select and use compute resources? | Choosing optimal compute form factors (Lambda vs Fargate vs EC2), leveraging Graviton3/ARM64 architecture for 20–40% better price/performance. |
| PERF 3 | How do you store, manage, and access data? | DynamoDB Single-Table Design, read replicas, caching tiers (DAX, Redis), S3 storage classes, optimizing partition key cardinality to eliminate hot partitions. |
| PERF 4 | How do you select and configure networking resources? | CloudFront CDN edge caching, AWS Global Accelerator (Anycast IP for TCP acceleration), Route 53 Latency-based routing, VPC Endpoints to avoid NAT Gateway bottlenecks. |
| PERF 5 | What process do you use to support more performance efficiency? | Load testing, tracing bottlenecks with AWS X-Ray, continuous benchmarking, automated load generation before peak events. |
2. Cost Optimization (COST 1 – COST 11)
| ID | Question | Architectural Focus for Interviews |
|---|---|---|
| COST 1 | How do you implement cloud financial management? | Tagging architectures by cost center/service, establishing budget alarms and anomaly detection. |
| COST 2 | How do you govern usage? | IAM service control policies (SCPs) preventing provisioning of unauthorized expensive instance types (e.g., p4d.24xlarge GPU instances). |
| COST 3 | How do you monitor your cost and usage? | AWS Cost Explorer, CloudWatch billing metrics, detailed cost allocation tags. |
| COST 4 | How do you decommission resources? | Automated cleanup of orphaned EBS volumes, unattached Elastic IPs, expired DynamoDB items via TTL, S3 bucket lifecycle rules. |
| COST 5 | How do you evaluate cost when you select services? | Total Cost of Ownership (TCO): comparing managed services (RDS/DynamoDB) vs self-hosted EC2 factoring in engineering operational maintenance cost. |
| COST 6 | How do you meet cost targets when you select resource type, size and number? | Right-sizing compute instances based on historical utilization (CloudWatch CPU/RAM metrics), auto-scaling down to zero when demand drops. |
| COST 7 | How do you use pricing models to reduce cost? | Compute Savings Plans (up to 66% discount for steady baseline), Reserved Instances, Spot Instances (up to 90% discount for stateless workers). |
| COST 8 | How do you plan for data transfer charges? | The AWS Data Transfer Trap: Keeping traffic inside the same AZ where possible, using VPC Gateway Endpoints for S3/DynamoDB (free vs NAT Gateway fees). |
| COST 9 | How do you manage demand, and supply resources? | Dynamic auto-scaling based on real-time metrics, queue-depth-based worker scaling, scheduled scaling for known promotional peaks. |
| COST 10 | How do you evaluate new services? | Benchmarking new instance generations (e.g., migrating from x86 to Graviton3 ARM instances to reduce costs by 20%). |
| COST 11 | How do you evaluate the cost of effort? | Avoiding speculative custom microservices when managed serverless primitives deliver 90% of the capability at 10% of the maintenance overhead. |
3. High-Performance Data Architecture: DynamoDB Single-Table Design
Amazon invented DynamoDB to power Amazon.com's shopping cart and order systems. In an interview, proposing a naive relational multi-table schema for massive scale shows lack of Senior SWE experience.
Synthesizing vector architecture diagram...
Why Single-Table Design Wins on Performance & Cost:
- Zero SQL Joins: In relational databases, fetching a user and their 10 recent orders requires
JOINoperations that consume CPU and memory on the database server. - Pre-computed Adjacency: By co-locating user profiles and their orders under the same Partition Key (
PK: USER#1024), a singleQueryoperation (PK = "USER#1024" AND SK begins_with "ORDER#") retrieves the user and all their orders in a single round-trip network call (). - Capacity Pooling: A single table shares provisioned or on-demand throughput across all entities, preventing fragmented capacity waste where 10 separate tables are all over-provisioned.
4. The Hidden AWS Data Transfer Traps (Cost Invariant)
Many candidates fail system design interviews because their architecture incurs millions of dollars in unexpected data transfer bills.
Synthesizing vector architecture diagram...
The 4 Data Transfer Invariants You Must State in Interviews:
- Intra-AZ vs Cross-AZ: Traffic between instances in the same Availability Zone using private IPs is FREE. Traffic crossing AZ boundaries costs 0.02/GB total).
- Mitigation: Enable AZ affinity (keep compute and caches in the same AZ) and use local read replicas.
- The NAT Gateway Trap: Routing internal traffic to S3 or DynamoDB through a NAT Gateway incurs a 0.045/GB data processing charge!
- Mitigation: Always configure VPC Gateway Endpoints for Amazon S3 and Amazon DynamoDB. Gateway Endpoints route traffic directly across AWS's internal private fiber at $0.00 cost and lower latency!
- Cross-Region Egress: Data transfer between AWS Regions costs **30,000/month in bandwidth alone.
- Mitigation: Compress payloads (Gzip, Zstandard, Protobuf) before cross-region replication and replicate only delta metadata, not raw blobs.
- Internet Egress: Direct egress from EC2 to the public internet costs up to $0.09/GB.
- Mitigation: Put Amazon CloudFront in front of the origin. CloudFront caching absorbs egress requests, and AWS offers significantly discounted data-out rates through CloudFront compared to raw EC2 egress.
5. Network Routing & Global Acceleration
For global applications (e.g., users in Tokyo, London, and New York accessing an application hosted in us-east-1):
Synthesizing vector architecture diagram...
- CloudFront: Best for HTTP/S caching of static and dynamic content at edge PoPs.
- AWS Global Accelerator: Best for non-HTTP protocols (TCP/UDP, gaming, VoIP, WebSockets). It provides two static Anycast IP addresses. Client traffic enters the nearest AWS edge location via BGP Anycast and travels across AWS's private, congestion-free fiber network directly to the origin, bypassing unpredictable public internet ISP hops and reducing TCP handshake latency by up to 60%.
Unlock Complete Architecture & Production Runbooks
You have explored the free architectural preview (~46%). Spend 1 Coin to unlock the remaining 3 production deep-dive sections for a full 24 hours.