Amazon
The everything store at planetary scale — handling Black Friday rushes
Amazon Architecture Blueprint
Click ▶ RUN to animate active particle streams across microservices
How Traffic Flows Through Amazon
1. Ingress & Edge Routing
User requests arrive at the edge network. Global CDNs cache static assets and media. API Gateways terminate TLS, validate JWT authentication tokens, enforce token-bucket rate limits, and scrub malicious bot traffic before forwarding to internal services.
2. Microservice Processing
Stateless domain services execute core business logic. Microservices communicate via high-performance internal gRPC/REST APIs and autoscaling worker pods, ensuring that high load on one domain never exhausts compute resources of another.
3. In-Memory Caching & Storage
Read-heavy traffic is served from in-memory Redis clusters with sub-millisecond latencies, protecting primary databases. Persistent databases (PostgreSQL, Cassandra, DynamoDB) maintain ACID consistency for financial ledgers, user accounts, and immutable state records.
4. Asynchronous Event Streams
Heavy operations (notifications, audit logging, analytics, ML training, fan-out delivery) are decoupled into durable event logs like Kafka and SQS. This prevents user-facing requests from blocking on slow external networks.
Study Amazon's database schemas, capacity math & production contracts
Beyond the visual blueprint, explore the exhaustive 7-section engineering whitepaper with real DDL schemas, API endpoints, failure mitigation matrices, and 45-minute FAANG interview scripts.
Preventing Inventory Overselling During 100x Black Friday Spikes
Traditional relational databases use pessimistic row locks (`SELECT ... FOR UPDATE`). When 50,000 shoppers compete for 500 limited flash sale items simultaneously, pessimistic locks cause massive thread deadlocks and server crashes.
Amazon pioneered optimistic concurrency control with DynamoDB conditional writes: `SET stock = stock - 1 WHERE stock > 0 AND version = current_version`. Only the first 500 requests successfully decrement the counter; remaining requests fail gracefully and receive "Item Sold Out" without database locks.
⚖️ Architectural Trade-Offs & Decisions
Why the engineering team chose this specific stack over competing alternatives
Two-Phase Commit requires all participating microservices (Payment, Inventory, Shipping) to hold database locks until every service acknowledges readiness. If one service is slow, the entire checkout pipeline freezes. Saga uses asynchronous local transactions with automated compensating rollbacks if any step fails.
DynamoDB partitions data across storage nodes using consistent hashing on primary keys. Read and write latencies remain strictly under 10ms whether the database stores 1,000 items or 1 billion items, making it impervious to holiday traffic spikes.
Prime Day 2018 Homepage & Cart Crash
Within minutes of Prime Day 2018 launching, Amazon's homepage crashed, displaying photos of employee dogs ("Dogs of Amazon"), and checkout buttons failed globally.
A global internal service dependency (Sable document store) was saturated by excessive read traffic from the personalized homepage recommendation widget, cascading into API gateway timeouts.
Amazon adopted strict Cell-Based Architecture where services are partitioned into isolated "cells". If one cell experiences high load, it cannot cascade to other customers, and non-essential widgets are automatically shed during peak traffic.
📋 Complete Microservice Specifications
Every service in the Amazon ecosystem with production tech stacks and failure impact
| Component | Tier / Layer | Tech Stack | Production Function | Status / Chaos |
|---|---|---|---|---|
| User Client | CLIENT | ReactMobileAlexa | Web, iOS, Android, and Alexa consumers shopping and purchasing items | |
| CloudFront CDN | CDN | AWS CloudFront | Global edge CDN caching product images, CSS/JS bundles, and static catalog pages | |
| API Gateway & WAF | GATEWAY | API GWAWS WAF | AWS API Gateway protected by AWS WAF for bot mitigation and rate limiting | |
| Application Load Balancer | LB | AWS ALB | Layer 7 ALB routing traffic across multiple Availability Zones | |
| Product Catalog Service | SERVICE | JavaDynamoDB | Manages product metadata, descriptions, specifications, and seller listings | |
| Search & Discovery | SERVICE | ElasticsearchLucene | Elasticsearch search cluster powering typo-tolerant autocomplete and filters | |
| Shopping Cart Service | SERVICE | JavaRedis | High-availability cart service storing active shopping sessions in ElastiCache | |
| Order Orchestrator (Saga) | SERVICE | JavaAWS Step Functions | Orchestrates distributed Saga pattern across payment, inventory, and fulfillment | |
| Payment Service | SERVICE | JavaPCI-DSS | Payment gateway integrating credit cards, Amazon Pay, gift cards, and BNPL | |
| Inventory Service | SERVICE | JavaDynamoDB | Maintains real-time stock levels across fulfillment centers with optimistic locks | |
| Fulfillment & Shipping | SERVICE | JavaSQS | Routes orders to nearest Amazon Fulfillment Center with available inventory | |
| Notification Service | SERVICE | SESSNS | Dispatches order confirmation emails, delivery tracking SMS, and app notifications | |
| DynamoDB Cluster | DATABASE | Amazon DynamoDB | Planetary NoSQL database invented at Amazon for low-latency predictable scaling | |
| SQS / EventBridge | QUEUE | AWS SQSEventBridge | Decoupled event streaming bus connecting order orchestration to background workers | |
| ElastiCache (Redis) | CACHE | Redis | Distributed in-memory cache for shopping carts, user sessions, and hot products |