0%
Product Architecture Interviews: User Flows, APIs, Data Models, Feeds, Real Time and Privacy
Walkthrough: Live Comments on a Stream
This walkthrough designs live comments for a video product: a creator goes live, viewers watch, and a column of comments scrolls next to the video while hearts and other reactions float across it. After the stream ends, the recording stays up and the comments replay alongside it. It is a favourite product architecture prompt because the read side is huge and spiky, the write side is chatty, ordering matters to users in a visible way, and abuse shows up within seconds of a popular stream starting. We will follow the six steps from the first lesson of this course: requirements and user flows, entities and data model, APIs, high level architecture, product deep dives, and trade offs with a wrap up.
The goal is not to reproduce what any particular company built. It is to show what a strong forty five minute answer looks like, including the questions an interviewer is likely to push on and the places where you should slow down and justify a choice.
Restating the prompt and finding the core flow
Start by restating the prompt in your own words and naming the single flow that matters most. Something like: viewers of a live video can post short text comments that every other viewer sees within a couple of seconds, can tap reactions, and later viewers of the recording see the same comments at the same points in the video. Then ask what the interviewer cares about. Are we designing the comment experience only, or the video pipeline too? In most versions of this prompt the video itself is out of scope; you can say the stream is delivered by an existing media system and you are designing the conversation layer on top of it. Pointing at the media lesson in this course for the upload and playback side keeps your time on the part the prompt is about.
The core flows, written as user stories, are short:
- As a viewer, I open a live stream and see the most recent comments immediately, then new ones as they arrive.
- As a viewer, I post a comment and see it appear in the list within about a second.
- As a viewer, I tap a reaction and see the reaction animation, plus a rough sense that others are reacting too.
- As the creator, I see comments in near real time and can pin one, delete one, or block a user from my stream.
- As a viewer of the recording, I see comments appear at the moment in the video they were written.
Nice to have items you name and park: replies and threads, translated comments, paid highlighted comments, polls, and comment search. Saying them out loud shows product sense; parking them protects the time you need for fan out, ordering and moderation.
Personas and their different needs
Three personas behave very differently. The viewer wants freshness and a column that is readable rather than a blur. The creator wants control: they need to see the room, remove abuse quickly and trust that a removed comment disappears for everyone. The moderator or trust and safety reviewer, sometimes an automated system, needs queues, context and an audit trail. A fourth, quieter persona is the replay viewer, who arrives hours or days later and expects the conversation to line up with the video.
Naming personas early pays off later. When the interviewer asks who can delete a comment, you already have the creator, the author and the moderator as the three actors with different permissions. When they ask about freshness, you can say the viewer cares about two seconds while the replay viewer only cares that the offsets are right.
Edge cases that shape the design
A good list of edge cases in the first ten minutes is evidence of product thinking. For live comments the ones worth naming are:
- A stream with ten viewers and a stream with two million viewers must both work, and a stream can jump from one to the other in minutes when it gets shared.
- A viewer joins late and needs the last fifty or so comments, not the whole history.
- A viewer's connection drops for twenty seconds on a train; when it returns they should catch up without a duplicate or a gap.
- A comment is deleted by the creator after thousands of people have already seen it.
- A blocked user keeps commenting; their comments should not appear to the creator or, depending on the policy you choose, to anyone.
- The stream ends while comments are in flight.
Non functional needs as product promises
Turn vague qualities into promises a user would notice. Freshness: a comment you post appears on your own screen immediately and on other screens within about one to two seconds at the 95th percentile. Readability: in a massive stream the column must stay readable, which means the product shows a sample of comments rather than all of them. Ordering: every viewer sees comments in the same relative order, and your own comment does not jump around after you post it. Durability: a comment that was shown live must exist in the replay. Availability: if comments fail, the video keeps playing; comments are a feature on top of the stream, not a dependency of it.
That last promise is worth saying explicitly. It tells the interviewer you will isolate the comment system so its failure degrades the experience rather than breaking it.
Rough numbers
Keep estimates brief and use them to drive decisions. Suppose the largest streams have two million concurrent viewers. If two percent of viewers comment once a minute, that is forty thousand viewers each sending about one comment every sixty seconds, roughly seven hundred comments per second for that stream. Reactions are far higher: at a big moment half the audience may tap a few times, which is millions of taps within a few seconds. The fan out is the scary number. Delivering seven hundred comments per second to two million sockets would be 1.4 billion deliveries per second, which no reasonable system should do and no human could read.
That arithmetic is the first real insight of the interview, and you should say it out loud: the product cannot show every comment to every viewer in a huge stream. A human can read perhaps five to ten comments per second in a scrolling column. So the design will deliver every comment in small streams and a sampled, prioritised subset in large ones. This is a product decision driven by a number, which is exactly what this round rewards.
Storage is modest by comparison. Seven hundred comments per second at about three hundred bytes each, including metadata, is around two hundred kilobytes per second, under a gigabyte for an hour long stream. Even across thousands of concurrent streams, the comment store is not the hard part. The connection layer is.
Scoping questions worth asking
A short bank of questions keeps the first minutes efficient. Is this for any live stream or only for large creators? The answer decides whether sampling is a core feature or an edge case. Can anyone comment, or only followers or subscribers? That determines whether permission checks sit on the write path. Do comments need to be visible in replay, and for how long? That decides retention and the offset field. Are there reply threads? If not, the comment model stays flat and the column stays a single ordered list. Does the creator need moderators of their own? That adds a role to stream membership. Is there a paid tier of comments? That adds a payment step and a priority. You will rarely ask all of these, but having them ready means you never stall.
Listen for the answers that change the architecture rather than the ones that only add a field. Followers only commenting is a cheap permission check. Comments in replay forever is a storage and retention decision. Paid comments add money to the write path, which raises the bar for idempotency and auditing. When an answer changes the architecture, repeat it back so the interviewer knows you heard the consequence, not only the words.
Checking in before moving on
Close the step by summarising: five core flows, three personas plus the replay viewer, sampling in huge streams, comments as a non critical layer over the video, and the numbers that matter. Ask whether the interviewer wants to emphasise any flow. Some will want to go straight to fan out; others care most about moderation. Thirty seconds here saves a deep dive in the wrong direction.
Nobody can read hundreds of comments per second. Saying this early turns an impossible fan out number into a product decision: deliver everything in small streams and a ranked sample in large ones.