Help us with your details

Oops! Something went wrong while submitting the form.

How to Answer System Design Interview Questions like “Design Twitter or Instagram”

You can download a PDF version of  
How to Answer System Design Interview Questions like “Design Twitter or Instagram”
Download PDF

Interview questions on system design are a standard part of any evaluation for software engineers. The most common system design questions asked are on cache design, front-end system design, or building systems like Twitter, Instagram, Facebook, etc. These questions assess your capability of building a large-scale and complex product. The funny thing is that there is no right or wrong way to answer systems design problems. This open-ended nature of questions makes system architecture interview questions tricky for most candidates.

You have come to the right place if you want to know about the best ways of answering system design interview questions or software design problems. At Interview Kickstart, we believe that you can crack these interviews and land a data engineer job at leading tech companies with the correct preparation strategy.

We’ve trained over 9,000 software engineers, and we know what it takes to crack the most challenging tech interviews. Since 2014, Interview Kickstart alums have landed lucrative offers from FAANG and Tier-1 tech companies, with an average salary hike of 49%. The highest ever offer received by an IK alum is a whopping $933,000! 

At IK, you get the unique opportunity to learn from expert instructors who are hiring managers and tech leads at Google, Facebook, Apple, and other top Silicon Valley tech companies. That’s not all! We offer domain-specific interview prep programs, including a masterclass dedicated to preparing for interviews at companies such as Amazon, Apple, Google, and Facebook.

Want to nail your next tech interview? Sign up for our FREE Webinar here!

In this article, we will discuss tips to answer system design interview questions like ‘design Twitter’ or ‘design Instagram.’ These are the points we’ll cover:

  • How to Design Twitter — Best Way to Answer System Design Interview Questions
  • How to Design Instagram — Best Way to Answer System Design Interview Questions
  • Tips to Crack System Design Interview Questions
  • FAQs on How to Answer System Design Questions

How to Design Twitter — Best Way to Answer This System Design Interview Question

System design interview questions like ‘Design Twitter’ are one of the most commonly asked questions during a systems design interview. Here’s how you can answer it:

Step I: Define the Scope

To begin, never jump right into the technical details when solving system architecture interview questions. Focus on the bare minimum requirements for the application as the interviewer wants you to present some high-level ideas. Also, make sure to confirm the requirements with your interviewer before you dive deep into the design.

How you define the problem statement, design the solution, and analyze every step will matter to the interviewer. So ensure that you keep it straightforward. Here are some system design questions you can ask:

  • Should users be able to comment and reply to the tweets?
  • Should images and video links be included in tweets?
  • Can users follow their friends and celebrities?
  • Can users register an account, delete an account and recover the password?
  • Should users have the ability to create new tweets, delete the existing ones, and bookmark tweets?
  • Should the system inform users when their followers send new tweets?

Also, keep in mind that the interviewer does not want you to develop Twitter altogether during the system design interview. They expect you to come up with the minimum viable product and develop only the core features. The minimum requirements of Twitter will include:

  • Sending tweets
  • Following other users
  • Reading tweets on the timeline
  • The application should load quickly
  • The system design is reliable and scalable

Step II: Establish the Scope of API 

The next step to answer the system design interview question is to outline the endpoints for the API design. You’ll need to include the following:

  • sendTweet(message)
  • getFeed(page)
  • followUser(userID)
  • unfollowUser(userID)

SOAP, REST APIs, or Graph APIs are useful APIs you can use to answer this. Remember that your interviewer is interested to know how you will be handling scrolling and pagination. Here’s a list of APIs used for managing the backend of Twitter:

  • Login API- Post API to authenticate the user.
  • Signup API- Post API to create a user.
  • Get all Tweets- Get API /api/users/${userName}/tweets?page=1&size=30
  • Create a tweet- Post API /api/users/${userName}/tweets
  • Get all followers- Get API /api/users/${userName}/followers?page=1&size=30
  • Get all following- Get API api/users/${userName}/followers?page=1&size=30

For the front-end systems design interview questions, you will need to talk about React, Redux, and reverse proxy and touch upon issues like notification and offline browsing. Next, you can start sketching out the architecture that will support the various features. You can begin with the user who makes a request to the server.

Step III: Move on to the Databases and Data Modeling 

You’ll also need to talk about databases during your system design interview. Remember that the API should be scalable, and you need a database that is easy to share. The database should be able to handle a large number of tweets on the API servers. So use an accessible database. The common databases used by the Twitter app includes:

  • MemCache and Redis – for storing cache data used for generating a timeline.
  • FlockDB – for storing social graphs.
  • Metrics DB for storing data metrics of Twitter.
  • Hadoop – for storing massive data like trends Analytics, storing user logs, recommendations, etc.
  • MySQL and Manhattan as master DB – for storing data of end-users. 
  • BlobStore – for storing binary large objects and images, videos, and other files.

You can talk about data modeling and how to serve feeds. Using a database like MySQL for data modeling, you can define the feed object and user object. The idea is that the users can follow each other, and each feed has an owner. When it comes to server feeds, you can talk about obtaining feeds from the people you follow and rendering them by time.

Step IV: Start Big and Then Go Deeper 

It is best to stick to a high-level explanation while answering system design interview questions for Twitter. But having said that, remember that the interview won’t stop here and may ask you several follow-up questions.

Take a look at the Google System Design Interview Questions too!

How to Design Instagram —  Best Way to Answer This System Design Interview Question

As you may know, Instagram is a photo-sharing app through which users can upload and share their photos and videos with other users. For cracking system design interview questions like ‘Design Instagram,’ you can focus on designing a simpler app version. 

On their timeline, the user can share photos, follow other users, and get a news feed of top images from other people they follow. The answer will not address commenting on photos, tagging users, or sharing the pictures to other social networking platforms like Facebook or Flickr.

Step I: Outline the Functional Requirements 

Begin answering your system design interview question for ‘Design Instagram’ by outlining the system requirements. You can discuss the functional requirements, which are the primary goal of the app design. You can ask the following questions:

  • Should the user be able to upload and view photos?
  • Can they perform an image search based on tiles?
  • Can users follow each other?
  • Can users see the news feed on their timeline?

Step II: Don’t Forget the Non-Functional Requirements 

Some vital non-functional system design requirements would include performance, availability, consistency, scalability, and reliability. And since Instagram is a photo-sharing app, the users should have no limitations on the number of image uploads. Hence, there should be an efficient mechanism to handle storage.

Step III: Stick to a High-Level System Design

The focus should be on creating a high-level system design. The app should be able to upload photos and also allow users to view/search photos. To do this, you will need a scalable database schema to support fast scanning and information retrieval. Talk about using a relational database such as MySQL. Then discuss the data flow between different components. You will need to show a table that stores all data regarding photos and can be indexed. These could be:

  • Table Name : table index1,index2, etc.
  • Photo: PhotoID (pk), UserID, PhotoLocation, CreationDate
  • User: UserID(pk), Name, Email, DOB, LastLoginTime
  • Follow: UserID1, UserID2 (paired pk)
  • FeedItem: FeedID(pk), UserID,Contents, PhotoID,CreationDate

When answering the system design interview question like ‘Design Instagram’, be sure to mention any bottlenecks that users may encounter while submitting photos. Uploading is a slow process, and if the same server has to handle both write and read photo requests, it will get jammed. That’s why you need to design web servers with a connection limit. 

You can talk about using responsibility segregation to split the reads and writes as distinct services. This allows you to grow operations by having different servers fulfill different roles.

Step IV: Move on to the Newsfeed

For newsfeed, you can create a single API to pre-generate the feed. Generating a newsfeed in real-time can leave you with very high latency. The single API (can be REST-based) is as follows: 

  • User New Feed - Post[] newsFeed(UserID): /user/feed

Following this API means that the feed gets updated with all the latest photos automatically. The User News Feed API simply returns a stream of posts in reverse chronological order. Plus, it also supports pagination of the news feed items. For example, the API can return 50 posts in one request, and then the user can ask for the next 50 posts. Moreover, you can cache the output of this API to increase the performance of the application.

Step V: Talk About Scaling 

Now that you have outlined the structure of Instagram, you will also need to discuss a few ways to scale the design for fulfilling the non-functional requirements. Here are some strategies that you can talk about in the system design interview:

  • Using PhotoID to partition the database: You can create a unique ID for each photo. While each DB shard will need an auto-increment sequence for PhotoIDs, it will also have the same photo ID in its portion. 
  • Using UserID to partition the database: This approach can help you keep all the user photos within the same shard. If you divide the database into 100 shards, by doing UserID%100, you can determine which shard will store the user's data. You can keep it limited to 10 shards and find the shard number by UserID%10 to improve performance. However, this can be an issue if a user is a celebrity and a portion of shards are hit excessively compared to the rest.
  • Using Load Balancer: When you have multiple copies of any server, you need to distribute the user traffic efficiently. During the system design interview with a load balancer, you can uniformly distribute the user requests to different servers. You can also talk about using IP-based routing for the Newsfeed service to get a faster response.

Read our System Design Interview Guide to understand some of the basic concepts of system design interviews.

Tips for Acing System Design Interview Questions Like “Design Twitter/Instagram”

Given the complexity of system design interviews, no one can cover all the various topics and considerations for designing a product in under 45 mins. Plus, there isn’t a single optimal solution you can fall back on. However, the good news is that you don’t have to know everything or give fully detailed features as long as your thought process is straightforward and you can answer the open-ended questions. 

Here are some ideas to help you ace your system design interview questions:

  • Start by defining the scope of your system design before you get into the technical details. 
  • Make sure to tell your interviewer all the decisions you are making as you work through the solution. You should be able to show that the option you are choosing is the best one given the circumstances.
  • Always define the features that you think of. Ask the interviewer if you have any doubts. For example, you can ask if you need to discuss the end-to-end experience or simply the API?
  • Start simple with a high-level design and then drill down to specifics if needed.
  • Look for potential bottlenecks that could slow or obstruct the system's functions. Discuss these with your interviewer and find possible solutions to eliminate or redesign that part of the design.

Check some more Preparation Tips on System Design Interview Questions here. 

FAQs on How to Answer System Design Questions

How do you answer system design interview questions?

While there is no right or wrong way to answer this question, there are some steps you can follow. These are: understanding the goals, confirming the requirements, stating an outline, high-level designing, data structure, and algorithms, identifying and eliminating bottlenecks.

How common are specialized system design interviews?

It often depends on the role and the company you are applying to. If you’re applying for a junior position, you will have more interview rounds focused on coding and have no system design interviews. However, if you apply for a senior software engineer position, you can expect many system design interview questions.

Are system design interviews tough to crack?

Because of their open-ended character, system design interview questions are tricky. Junior and senior software engineers have different requirements. These questions assess your ability to design a complex, large-scale product.

What are the core technical concepts for a system design interview?

Caching, load balancing, network protocol, proxies, leader election, and sharding are essential elements to understand for a system architecture interview. While you don’t have to know them inside out, you should have a high-level understanding of how different components relate to each other.

Should a system design engineer be familiar with specialized software?

Hiring managers are looking for system designers who have a solid knowledge of 3D animation, illustration, and programming languages. Familiarity with specialized software can be a bonus. Some of the common ones include Unity, Maya, Adobe Creative Cloud, Substance Painter, Unreal 4, C, C++.

Are You Ready to Crack Your Next System Design Interview?

If you are unsure about how to answer cache design interview questions or distributed systems interview questions, you are not alone. Preparing for these interviews can be confusing since there are multiple approaches to answer the same question. With Interview Kickstart by your side, you will find it easier to practice for such interviews and impress the hiring managers on D-Day.

At IK, you get an opportunity to learn from the best and practice 1-on-1 with tech leads and hiring managers from FAANG+ companies. You can quickly level up your skills for any technical or coding interview and perform effortlessly. Plus, our dedicated boot camps are specially designed for coding engineers and software developers to guide them through interview prep

Register for a free webinar now and to uplevel your career. 

Recommended Posts

About usWhy usInstructorsReviewsCostFAQContactBlogRegister for Webinar