Interview with a Meta engineer.
A System Design interview with a Meta/Facebook engineer
Watch someone solve the facebook timeline service problem in an interview with a Meta engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.
Interview Summary
Problem type
Facebook Timeline Service
Interview question
Design the backend for Facebook timeline service.
Interview Feedback
Feedback about Epic Ibex (the interviewee)
Advance this person to the next round?
Yes
How were their technical skills?
4/4
How was their problem solving ability?
4/4
What about their communication ability?
4/4
Overall:
TC did almost everything(requirement gathering, API design, estimations, High level design, trade-off analysis) perfectly.
Strengths:
+ TC gathered the functional requirements well:
- TC clarified if they need to provide functionality of making the friends.
- TC clarified if they need to provide functionality of looking at specific user's posts.
- TC clarified that they would design for the different surfaces/devices.
+ TC gathered the non-functional requirements well:
- TC talked about the trade-off between availability and consistency.
- TC talked about durability.
- TC talked about the latency.
+ TC did the QPS estimations.
+ TC did the API design well.
+ TC came up with the right trade-offs between the push and pull model.
+ TC was able to complete the overall high-level design.
+ TC came up with the high-level components.
+ TC did well in database schema design.Improvement Areas:
- TC could have done the storage estimation and API discussion prior to high-level discussion.
- TC could have done more event-driven design.General Read:
- CQRS architecture.
- Event Driven Architecture.
Feedback about Red Maelstrom (the interviewer)
Would you want to work with this person?
Yes
How excited would you be to work with them?
4/4
How good were the questions?
4/4
How helpful was your interviewer in guiding you to the solution(s)?
4/4
Thanks for very actionable and useful feedback. Very helpful for my upcoming interviews.
Interview Transcript
Epic Ibexstrom: So we'll do the classic back end for Facebook timeline kind of a service. So basically where user can post things and the different users can see the post from different other users which they follow up with.\nEpic Ibex: So just the timeline is what we are concerned. Right, right. As a Facebook user there are two types of user, one set of users. As a user I could post and then people that I'm friends with end up seeing those posting on their timeline. Right, okay. Do we want to care about following friending with people or do we assume those services?\nRead Maelstrom: Yeah, that's a good question. You can assume like such service already exists.\nEpic Ibex: Okay. They're all the same users. But there are two pieces to this timeline that I'm thinking. One is like posting, like creating a new post and the other one is a passive user that opens their home page timeline and then sees a bunch of stuff. Do we care about interaction with a given post, like comment or like things like that?\nRead Maelstrom: That's a good question. Maybe as a follow up, once we are done with the basic functioning we can think about it.\nEpic Ibex: Okay, yeah, that sounds good. So I'll start noting down. So some of the requirements user could create a post and all their friends see that on their timeline. We'll see there could be a delay, but yeah, we want to keep it as real time as possible. So do posts include just the text or do we want to handle multimedia also?\nRead Maelstrom: That's again a good question. Yeah, same thing. Start with the text and maybe once we are done with the basic thing we can discuss how to introduce multimedia.\nEpic Ibex: Okay, so I’m assuming people are coming from different platforms like desktop, mobile and things like that. So we don't have to design for a specific thing. What else is on the timeline? Do we care about how posts are ranked? Is it like chronological or do we try to you can assume like, there.\nRead Maelstrom: Is a black box service called Ranking which will rank the post for you.\nEpic Ibex: Okay, so if I'm a user with this, I could create a post, and if I'm the other user, I would open my timeline and I expect to see something. Okay. Do you want to see anything other than this? These seem like I think these are.\nRead Maelstrom: Good set to start with. These are a good set of requirements to start with.\nEpic Ibex: So number of users, how many are we talking about here? Like daily active users? Yeah.\nRead Maelstrom: So daily active users are in terms of like 50 million active users.\nEpic Ibex: 50 million users active. So I'm assuming there's like average one post by daily active user per day. Is that okay?\nRead Maelstrom: 2.5 or something? Yeah, 2.5.\nEpic Ibex: Okay. Let's round up to just to have the number then. Is there any limit on how big your post could be? Can I put one MB of text into my post? Hello? Can you hear me? Hey, can you hear me?\nRead Maelstrom: Hey, I can hear you. Sorry, I lost my connection.\nEpic Ibex: Yeah, no worries. So I added a couple of questions in the meanwhile. So for the post site, is there like a system limit that we want to enforce?\nRead Maelstrom: Yeah, that's a good question. Again.\nEpic Ibex: Yeah.\nRead Maelstrom: One KB. Let's assume that it should be less than one KB.\nEpic Ibex: Okay, so post size is like max. One KB of text. For simplicity, I'm assuming this is like ASCII text, just English so I don't have to worry about any code number of bytes in them, how many friends, and an average a user would have so that I know.\nRead Maelstrom: Yeah, maybe 200.\nEpic Ibex: 200 friends per user. So there would definitely be some delay between as a user posting something and then my friend saying, do we want to provide any sort of rough SLA for that?\nRead Maelstrom: No, we will try to be as real time as possible. We don't have any hard SLA.\nEpic Ibex: Okay. I'll just say as quick as we could. Reason I see kind of one more question. So I know how many users, I know how many friends one might have. Do posts expire? So I create a post and it appears on someone's timeline. Can they keep scrolling to years and years back? Do we keep all the posts forever?\nRead Maelstrom: That's a good question. Maybe we will like to keep it for the past three years.\nEpic Ibex: Okay, got it. Is there anything that's important that you want to see in this particular system? Like any guarantees?\nRead Maelstrom: Yeah, so basically we would like to focus more on availability.\nEpic Ibex: Okay. Yeah, definitely. As a user, it makes sense I get to see something than seeing very accurate things. So consistency is less important for me. I see. Okay.
Key Learnings:
- Clear definition of functional and non-functional requirements is essential in system design interviews.
- Understanding user experience and interaction with the system is crucial for designing a responsive service.
- Discussing trade-offs between consistency and availability helps in making informed architectural decisions.
- Identifying the need for scalability when handling a large user base allows for better long-term planning.
- Proposing a solid API design with emphasis on usability and performance can lead to a more robust system architecture.