System Design Interview: Facebook Messenger
Rumors say Facebook likes to ask candidates how they would design messenger. That’s probably why there are so many materials online for this topic. Utilitarian reasons aside, I think it’s indeed a good system design question to practice. After all, there is no shortcut to system design ability; only practice makes perfect. Facebook messenger has a rich feature set. I can’t cover all of them in one post, so I am going to willfully pick the areas I see as the core of messenger and dive into those.
Let’s clarify the requirements of a simple messenger system. I’ve annotated each feature with a number suffix corresponding to the visual on the figure.
A user has a list of contacts (1), from which she can see who is online/offline (2). The user can pick any one or multiple of her contacts and start a chat (3). In a chat, all participants can send messages (4). The messages will be displayed in chronological order (5). A message can be “liked” by any participant, whose avatar is then attached to the “liked” message (6). A participant’s avatar is also displayed after the last message she read, signaling her progress to other participants (7). A participant can delete any message in her own chat view (8). Only the sender of a message can delete it for all participants (9). Any user can leave a chat (10).