BLUEPRINT #01Social & Real-Time
Design a Scalable News Feed System
Referenced Architecture Primitives (7)
Click any primitive to study its algorithmic deep dive10-Stage Structure:1. Requirementsβ2. Sizingβ3. Topologyβ4. Data Modelβ5. AWS Topologyβ6. Deep-Diveβ7. Failuresβ8. SRE Playbooks
1. Problem Statement & Scope
System Mission
Design a massive-scale social news feed system (similar to Facebook News Feed, Twitter/X Timeline, or LinkedIn Feed) capable of publishing posts, aggregating updates in real-time, and rendering ranked feeds with sub-second latency for hundreds of millions of users.
Functional Requirements
- Feed Publishing: Users can publish text posts, images, and videos.
- Feed Generation (Fan-out): A user's timeline displays aggregated posts from followed users/friends, sorted chronologically and ranked by relevance.
- Pagination: Seamless infinite scrolling pagination.
Non-Functional Requirements (SLAs/SLOs)
- High Availability: uptime SLA.
- Latency: Feed read latency P99; post publishing .
- Consistency: Eventual consistency for timeline aggregation; immediate consistency for post creation.
2. Capacity & Scale Estimation
- Daily Active Users (DAU): 300 Million ().
- Daily Posts: 100 Million posts/day.
- Feed Reads: 1.5 Billion feed requests/day.
- Throughput (QPS):
- Read QPS: (Peak : ).
- Write QPS: (Peak : ).
- 5-Year Metadata Storage: (Post media stored in Amazon S3).
3. AWS-First High-Level Architecture
Interactive Architecture DiagramSynthesizing vector architecture diagram...
4. API Interface Design
httpPOST /v1/posts Host: api.social.aws.internal Authorization: Bearer <jwt_token> Content-Type: application/json { "content": "Designing high-scale distributed systems on AWS!", "media_urls": ["https://cdn.social.com/media/img_9981.webp"], "privacy": "PUBLIC" } Response: 201 Created { "post_id": "718293847561029384", "author_id": "usr_1029", "created_at": 1718000000 }
5. Data Models & Storage Architecture
DynamoDB Single-Table Design (SocialCoreTable)
The core social graph and post metadata reside in a single-table DynamoDB cluster optimized for point lookups:
sql-- Partition Key (PK) | Sort Key (SK) | Attributes / Payload ---------------------------------------------------------------------------------------- -- User Profile USER#usr_102 | METADATA | name, avatar_url, follower_count, is_verified -- User Published Post USER#usr_102 | POST#1718000000#p_9912 | content, media_urls[], created_at, likes_count -- Follower Edge (Graph) USER#usr_102 | FOLLOWS#usr_404 | followed_at, notification_level -- Followee Inverted Index (GSI1: Inverted Follower Graph) -- GSI1_PK = FOLLOWS#usr_404 | GSI1_SK = USER#usr_102 (Enables fast retrieval of all followers)
ElastiCache Redis Timeline Cache Layout
- Key:
timeline:user:<user_id>(Redis Sorted Set -ZSET). - Member:
post_id(64-bit integer string). - Score:
created_atUNIX millisecond timestamp. - Capacity Policy: Capped to latest per user via
ZREMRANGEBYRANK.
Part 2: Production Deep-Dive Locked1 Coin = 24 Hours
Unlock Complete Architecture & Production Runbooks
Your Balance:40 Coins
You have explored the free architectural preview (~37%). Spend 1 Coin to unlock the remaining 5 production deep-dive sections for a full 24 hours.
Sections Included in This 24-Hour Pass:
6. Component Deep Dives & Workflows
7. Architectural Trade-Off Matrix & Primitive Links
8. Critical Edge Cases & Distributed Failure Modes
9. Production Pitfalls & Anti-Patterns (The "Gotchas")
10. Production Runbook & Operational Best Practices
Keeps page unlocked for exactly 24 hoursSpend coins to fund LLM & compute infrastructure