0%
Product Architecture Interviews: User Flows, APIs, Data Models, Feeds, Real Time and Privacy
Real Time Updates and Notifications
Almost every product prompt in this round has a moment where the interviewer asks some version of the same question: how does the other person find out? A friend comes online. Someone starts typing. A like lands on your photo. A seller accepts your offer. A new comment appears under the video you are watching. Each of these is a small product promise about time, and each one can be delivered in very different ways at very different costs. This lesson is about making those choices deliberately, from the product side first and the infrastructure side second.
The previous lessons gave you the framework: requirements and flows, the data model, the APIs, the high level architecture and then product deep dives. Real time behaviour usually shows up in two places. It appears in the requirements as a freshness promise, and it appears in the deep dives as the part of the design that the interviewer pushes on. If you have already decided which features need to be live and why, the deep dive goes well. If you have not, you end up bolting WebSockets onto everything and then struggling to explain what they cost.
Not everything needs to be live
The most useful sentence you can say early in this part of the interview is that only some features need real time delivery. Users notice when a chat message takes ten seconds to arrive. They do not notice when the follower count on someone else's profile is two minutes old. They notice when a typing indicator lags behind the actual typing, because the indicator then lies to them. They do not notice when a recommendation carousel was computed an hour ago.
A practical way to sort features is to ask what the user is doing at the moment the change happens. If two people are in a conversation, both are waiting on each other, so latency is felt directly. If a creator is watching their post go live, the first few likes are emotionally important, so near real time counts matter for the first minutes and much less afterwards. If a user is browsing a feed, they are not waiting on any particular item, so it is enough that new items exist the next time they pull to refresh. Lesson five covers how the feed itself gets those items; here the question is only whether the screen should change while the user is looking at it.
Write the answer down as a short table in the requirements step. Chat messages: under one second. Typing and presence: under a second or two, and allowed to be lossy. Like counts on your own new post: a few seconds. Notifications about replies: a few seconds when the app is open, push when it is closed. Everything else: refreshed on navigation. That table becomes the justification for every component you add later.
Latency users actually notice
Product latency budgets are not the same as service level objectives on an API. A user perceives an interaction as instant at roughly a tenth of a second, as responsive within about a second, and as broken somewhere past a few seconds if they are actively waiting. For background awareness, such as seeing that a friend is online, much looser numbers are fine as long as the signal is not wrong for long.
Two kinds of error matter here, and they are worth naming separately. A late update is a freshness problem: the like count is behind. A wrong update is a correctness problem from the user's point of view: the app shows a friend as online when they closed the app ten minutes ago, or the badge says you have three unread messages when you have read them all. Users forgive lateness much more readily than wrongness. A design that sometimes delivers a typing indicator late is acceptable; a design that leaves a typing indicator stuck on forever is a bug report.
Three ways to reach a user
There are only three basic paths from your servers to a person. The first is an open connection while the app is in the foreground, such as a WebSocket or a server sent events stream. The second is the operating system push channel when the app is closed or backgrounded, which goes through the platform push service on mobile and through the web push service in browsers. The third is the client asking, which covers polling, pull to refresh and simply loading data when the user navigates.
Most products use all three, and the skill is to assign each feature to the right ones. A new direct message uses the open connection if the recipient has the conversation open, a push notification if the app is closed, and is also stored so that the next fetch of the inbox shows it regardless. That last part is important. The real time path is an optimisation on top of a durable path, never a replacement for it. If the event over the socket is lost, the next load must still show the truth.
The shape of the live path
The common architecture for the open connection path is simple to describe. Clients hold long lived connections to a fleet of connection gateways. Gateways are thin: they authenticate the connection, keep a record of which user and which topics the connection cares about, and forward events. Product services, such as the comment service or the messaging service, write the change to their own storage first and then publish an event to a pub/sub layer, keyed by a topic such as a conversation id or a post id. Gateways subscribe to the topics their connected clients care about and push matching events down the right sockets.
The order in that flow matters, and interviewers often check it. Store first, then publish. If you publish before the write commits, a viewer can see a comment that then fails to save, or a reader can fetch the thread a moment later and not find the comment they were just shown. Storing first means the published event is a notification that something durable changed, and every client can reconcile with the stored state at any time.
The gateway should not make product decisions. It should not decide who is allowed to see a comment or whether a user muted the thread; those checks belong in the services that own the data, either before publishing or in a filter step that the gateway calls. Keeping gateways dumb lets you scale them by connection count alone, and it keeps permission logic in one place, which lesson eight relies on when it discusses enforcing visibility on every read path.
Sizing the connection layer
A few numbers make the connection layer concrete. A well tuned gateway process can hold tens of thousands to a few hundred thousand idle connections, limited mostly by memory per connection and by the rate of messages it has to push. If a product has ten million daily users and perhaps a fifth of them have the app open at peak, that is two million concurrent connections, which is a fleet of tens of gateways rather than thousands. The expensive part is rarely holding the connections. It is the fan out of events through them, especially when one event has to reach a very large audience.
That gives you the right question to ask about each live feature: how many connections does one event touch? A direct message touches two or three devices. A comment on a friend's post touches the handful of people who have that post open. A reaction on a live stream with half a million viewers touches half a million sockets, which is a different problem and is covered in depth in the live comments walkthrough later in the course. When you can say the fan out per event for each feature, you can say which ones need special handling.
What the interviewer is checking
In this part of the round, the interviewer wants to see three things. First, that you chose real time for reasons the user would recognise, rather than because it sounds advanced. Second, that the live path sits on top of durable storage so nothing depends on a socket staying open. Third, that you know where the cost lives, which is in fan out and in connection churn, and can say roughly how big it is. Candidates who make every feature live, or who describe WebSockets without saying what happens when the connection drops, give weak evidence on all three.
A good habit is to say the decision out loud with its cost attached. For example: messages and typing are live over the socket because both people are waiting; like counts on other people's posts refresh when you open the post, because nobody is waiting on them and pushing every like to every viewer would multiply our fan out for no visible benefit. One sentence like that is worth more than a detailed diagram of a gateway fleet.
A worked example: a team chat product
Suppose the prompt is a team chat product with channels, direct messages and reactions. The table you might write is: new messages in the open channel, live, under a second; typing indicators, live, lossy, only for the open channel; reactions on messages, live when the channel is open, batched to a few per second per message; unread counts on other channels, live but coalesced, sent as absolute numbers; mentions when the app is closed, push within seconds; everything else, such as member lists and channel topics, loaded on navigation. That table took a minute to say and it now tells you what the gateway subscribes to (the open channel and the user's own topic), what needs batching (reactions and unread counts) and what needs the push pipeline (mentions).
Treat every real time path as a hint that something durable changed. If a socket event is lost, the next fetch must still show the truth, so the stored state, not the stream, is the source of record.