System design questions can be asked for any level with different expectations from the candidate, but to get a Senior offer, you have to rock this round. Practice makes perfect - like for anything else, it applies to system design interviews too. So, keep practicing without taking shortcuts, practice as if it’s the real interview, and always follow the same steps to make it perfect.
This is based on my personal experience over the years in the interviews I conducted as well as the ones I was the candidate, which turned into a senior job offer. Feel free to adjust based on your needs.
Even if the question is “Design Instagram”, and you already mastered it during preparation, don’t jump to the solution just yet. It will be a 99% rejection for a senior position. Start clarifying the requirements and listing down the features
What features do we want
You might feel strange asking all these questions for a widely known app. But please don’t, and ask even very obvious questions. After this part, you’ll get a tick in the interviewer’s notes: “Deals with ambiguity and asks questions to clarify the problem: check”.
Before throwing all those boxes: “Service X”, “Service Y”, “Service Z” and their interactions, just take a step back and define what kind of entities you need. Some people prefer defining the APIs first, but I feel more comfortable figuring out the main entities first and defining APIs around those.
Based on the requirements and features you discussed in the previous step, start listing down the entities and what fields they have. For example, you can start with something like this
List of the features you collected in step 1 and the entities you defined in step 2 will construct your APIs here. Let’s say the interviewer requested the following features
Based on that info, the APIs you’re going to need will be something like below (I know there is another 1M way of doing this):
/posts: Returns all the posts (probably paginated for infinite scroll)
input: GetPostsRequest
/posts: Creates a new post
input: CreatePostRequest
/posts/{postId}: Updates an existing post
/relationships/{userId}: Follows/Unfollows a user
input RelationshipRequest
It might be a good idea to mention that in step2 you designed DB entities while here you’ll use API entities that are similar to DB entities with small differences:
Now, it’s the right time to start drawing those boxes and show off your microservice architecture skills. First, define the main components you’re going to need, and add things like “Management”, “Authority”, “Processor” etc in the service name ;)
A common approach is putting a Gateway that users will talk to, and initiate calls to your backend services from this gateway. For example, to create a new post, send your HTTP request to the Gateway, and Gateway will first talk to AuthService to extract the user info and make sure the user is authenticated/authorized and then call PostManagementService to create the post. Your diagram will look something like this:
After this point, start throwing all system design concepts you know:
Please note experienced interviewers will dive deep into these concepts. So, make sure you know what they do, how they work, and the advantages/disadvantages between different approaches.
If all went smoothly, you might have some time in the end. At this point, the interviewer will most likely ask how you measure the system health, what kind of things you monitor.
A common approach is having monitors like below and creating alarms with some threshold for each, which will notify the team automatically if something is wrong. This is not the exhaustive list for a service you’re launching to production, but it should be enough for the interviewer.
Here are all the steps. Write it on a paper, put it next to your screen, and keep practicing.
Good luck with your interview!