A home feed must return the newest posts from every account a user follows, in time order, within a latency budget, while reads outnumber posts by about a hundred to one. The design question is where the work of merging those posts happens: on every read, on every write, or split between the two, and what each choice costs in operations, memory and tail latency. Interview question: "Design the home feed of a photo app for 100 million daily users."
Prerequisites
Requests per second and peak load. Capacity is planned for the busiest second: divide a daily count by 86,400, then multiply by a stated peak factor, as in the ticket sale spike that separates performance from scalability .
Big-O cost. O(log N) means the work grows with the logarithm of the input size: doubling N adds one step. It says how cost scales, not how long it takes.
Binary heap. An array kept as a tree where each parent is no larger than its children.…