12,000 Writes / 350,000 Reads Peak
Sustained peak request volume during high-traffic events.
Design a high-throughput microblogging feed with fan-out-on-write vs fan-out-on-read for celebrity accounts.
Target production parameters expected in a senior or staff interview round.
Sustained peak request volume during high-traffic events.
Daily active users generating read and write operations.
Projected data ingestion and replication storage capacity.
Strict end-to-end percentile latency SLA constraint.
Establish clear problem boundaries before proposing architectural components.
Step-by-step arithmetic conversions for QPS, storage, and bandwidth.
| Dimension | Calculation Formula | Estimated Result |
|---|---|---|
| Peak Tweet Ingestion QPS | 500M tweets / 86,400s = 5,787 avg QPS * 2x peak factor | 11,574 peak write QPS |
| Home Timeline Read QPS | 300M DAU * 5 visits/day / 86,400s * 20 page refreshes | 347,222 read QPS |
| Daily Tweet Text & Metadata Storage | 500M tweets * 500 bytes metadata/text payload | 250 GB/day storage growth |
| Active Timeline Memory Cache | 30M daily active users * 800 tweet IDs * 8 bytes (6.4 KB per user) | 192 GB RAM Redis Cluster |
How requests navigate ingress gateways, application logic, caching, and persistence.
TLS termination, OAuth2/JWT verification, token bucket rate limiting, and request routing.
Validate tweet payloads, mint chronological 64-bit IDs, persist to append-only tables, and publish to Kafka.
Push tweet IDs to active followers' timeline caches for standard users; merge celebrity tweets dynamically on read.
Real-time tokenized inverted indexing and trending hashtag aggregation with sliding window counters.
Entity models, indexing, and primary key partitioning.
Clustered on Snowflake tweet_id for natural time-ordered distribution across partition shards.
Secondary index on followee_id for rapid fan-out worker recipient resolution.
Redis Sorted Set scored by tweet_id timestamp capped at 800 items per user.
How to defend engineering compromises when challenged by interviewers.
Rationale: Celebrities with 100M+ followers cause millions of writes per second that saturate queues. A hybrid model precomputes timelines for ordinary users while merging celebrity tweets dynamically at read time.
Rationale: Caching full payloads consumes tens of terabytes of expensive RAM. Caching 800 64-bit integers takes under 7 KB per user and hydrates in <2ms via batched multi-key gets.
Key interview questions and conceptual defenses.
Inactive users are dropped from active Redis timeline caches. When they log in again, their timeline is generated on demand via fan-out on read.
Snowflake IDs encode a 41-bit millisecond timestamp, allowing database indices and Redis ZSETs to remain naturally sorted chronologically without secondary index lookups.