Design a global chat service like Whatsapp or
a facebook messenger.
- What
     are some of the required features?
- Allow
      users to chat over the internet.
- Provide
      support for one-on-one and group chats.
- Messages
      need to be stored for better viewing.
- Messages
      need to be encrypted for security purposes.
- What
     are some of the common problems that can be encountered?
- What
      would happen to a message if it is sent without an internet connection?
- Will
      encrypting and decrypting increase the latency?
- How
      are the messages sent and notified to the device?
- Possible
     Tips for consideration:
- Split
      database schema into multiple tables such as user table, chat table,
      massage table etc.
- Make
      use of web sockets for bi-directional communication between the device
      and the server.
- Make
      use of push notifications for notifying the members even if they are
      online.
How do you design a URL shortening service like TinyURL or bit.ly?
TinyURL or
bit.ly takes a long URL and generates a new unique short URL. These systems are
also capable of taking the shortened URL and returning the original full URL.
- What
     are some of the Required Features?
- Generate
      a short URL having a length shorter than the original URL.
- Store
      the original URL and map it to the shortened one.
- Allow
      redirects in the shortened URLs.
- Support
      custom names for short URLs.
- Handle
      multiple requests at the same time.
- Delete expired URLs
- The system should be highly available
- What
     are some of the Common Problems encountered?
- What
      if two users input the same custom URL?
- What
      happens if there are more user load than expected?
- How
      do you regulate the database storage space?
- Possible
     tips for consideration:
- The
      concept of hashing can be used for linking original and new URLs.
- REST
      API can be used for balancing high traffic and handling front-end
      communication.
- Multithreading
      concept for handling multiple requests at the same time.
- NoSQL
      databases for storing original URLs.
 Design
a forum-like systems like Quora, Reddit or HackerNews.
These sites
are meant for posting questions and answering them, showing newsfeed
highlighting popular questions based on tags and related topics. 
- What
     are some of the Required Features?
- Users
      should be able to create public posts and apply tags to them.
- Posts
      should be sortable based on tags.
- Post
      comments in real-time by users.
- Display posts on newsfeed based on followed tags.
- News feed generation which means users can see the list of top questions from all the users and topics they follow on their timeline.
- Approach to record stats of each answer such as the number of views, up-votes/down-votes, etc.
- What
     are some of the Common Problems encountered?
- Should
      it be just a web application?
- Where
      to store the uploaded images and links?
- How
      can you determine the related tags?
- How
      can you distribute posts across a server network?
- Possible
     tips for consideration:
- Check
      on using SQL database for mapping relational data between users, posts,
      comments, likes, tags, posts etc.
- Incorporate
      multithreading and load balancer for supporting high traffic.
- Make
      use of sharding for distributing the data across different systems.
- Incorporate
      machine learning algorithms for finding correlations between the tags.
 Design
Facebook’s newsfeed system.
Facebook’s
newsfeed allows users to see what is happening in their friend's circle, liked
pages and groups followed.
- What
     are some of the Required Features?
- Generate
      newsfeed using posts from other system entities that the user follows.
- Newsfeed
      posts can be of text, image, audio or video format.
- Append
      new posts to the user’s newsfeed in close to real-time.
- What
     are some of the Common Problems encountered?
- What
      happens if the new post sees a lot of latency to get appended to the news
      feed?
- Can
      the algorithm handle sudden user load?
- What
      posts should take priority for displaying in the news feed?
- Possible
     tips for consideration:
- Evaluate
      the process of fanout for publishing posts to the followers
- Check
      how sharding can be achieved efficiently for handling heavy user load.
      The feed data of a user shouldn't be put into multiple servers. Instead,
      sharding can be done on user ids.
Design a parking lot system?
- What
     are some of the Required Features?
- The
      parking lot can have multiple levels where each level has multiple rows
      for parking spots.
- The
      parking lot can support parking for cars, buses, motorcycles hence spots
      can be of multiple sizes.
- Consider
      the parking lot capacity at the time of designing the system.
- Design
      appropriate pricing for each parking spot.
- What
     are some of the Common Problems encountered?
- What
      should happen to the parking lot system if every spot is occupied?
- Assigning
      parking lot spots of smaller size to vehicles of a bigger size.
- Possible
     tips for consideration:
- Think
      of an algorithm for assigning an appropriate parking spot to a vehicle.
- Think
      of different entities required for designing the system.
How do you design a recommendation system?
Recommendation
systems are used for helping users identify what they want efficiently by
assisting them by offering various choices and alternatives based on their
history or interests.
- What
     are some of the Required Features?
- Discuss
      what kind of recommendation system is required - whether it is for
      movies, e-commerce websites, songs etc.
- What
     are some of the common problems encountered?
- Figure
      out how to recommend fresh and relevant content in real-time.
- Possible
     tips for consideration:
- Discuss
      how to use the Eval component for understanding the working of the
      system.
- Discuss
      how to train a collaborative filtering approach.
Design an API Rate Limiter system for GitHub
or Firebase sites.
API Rate
Limiters limit the API calls that a service receives in a given time period for
avoiding request overload. This question can start with the coding algorithm on
a single machine to the distributed network.
- What
     are some of the Required Features?
- What
      is the required request count per hour or second? Let us assume that the
      requirement can be 10 requests per second.
- Should
      the limiter notify the user if the requests are blocked?
- The
      limiter should handle traffic suitable according to the scale.
- What
     are some of the common problems encountered?
- How
      to measure the requests per given time?
- How
      to design the rate limiter for the distributed systems when compared to a
      local system?
- Possible
     tips for consideration:
- Evaluate
      the usage of sliding time windows for avoiding hourly resets.
- Try
      using a counter integer instead of a request for saving space.
How do you design global file storage and file
sharing services like Google Drive, Dropbox etc?
Design a file or image hosting service
that allows users to upload, store, share, delete, and download files or images
on their servers and provides synchronization across various devices.
- What
     are some of the Required Features?
- Users
      should be able to upload, delete, share and download files over the web.
- File updates should be synced across multiple devices.
- The system should support storing large files up to a GB.
- What
     are some of the common problems encountered?
- Where
      to store the files?
- How
      can you handle updates? Should the files be re-uploaded or does just the
      modified version has to be updated?
- How
      to handle updation of two documents at the same time?
- Possible
     tips for consideration:
- Consider
      using chunking for splitting files into multiple sections for supporting
      re-uploads of a particular section rather than the whole file.
- Make
      use of cloud storage for storing the files.
Design a type-ahead search engine service.
This
service partially completes the search queries by displaying n number of
suggestions for completing the query that the user intended to search.
- What
     are some of the Required Features?
- Service
      has to match partial queries with popularly searched queries.
- The
      system has to display n number of suggestions (say 5, for example) based
      on the written query.
- The suggestions have to be updated based on the query updation.
- Approach to storing previous search queries
- Real-time requirement of the system
- Approach to keep the data fresh.
- Approach to find the best matches to the already typed string
- Queries per second are to be handled by the system.
- Criteria for choosing the suggestions.
- A total number of data to be stored.
- Approach to find the best matches to the already typed string
- What
     are some of the common problems encountered?
- How
      to update the suggestions without much latency?
- How
      to determine the most likely suggestion?
- Are
      the suggestions adapting to the user’s search results?
- When
      do the suggestions appear? Is it updated on the fly or once the user
      stops writing?
- Possible
     tips for consideration:
- Evaluate
      the usage of natural language processing for anticipating the next
      characters.
- Markov
      chain rule for ranking the probabilities of top queries.
Design Netflix/Youtube.
Design a video streaming service like
Youtube/Netflix where users can upload/view/search videos. The service should
be scalable where a large number of users can watch and share the videos
simultaneously. It will be storing and transmitting petabytes and petabytes of
data. 
Netflix is
a video streaming service.
- What
     are some of the Required Features?
- Uninterrupted
      video streaming to be made available for the users.
- Likes
      and reviews of videos.
- Recommend
      new videos.
- Support
      high traffic of users.
- Adding comments on videos in real-time.
- Approach to record stats about videos e.g. the total number of views, up-votes/down-votes, etc.
- What
     are some of the common problems encountered?
- Is it
      acceptable to have lags while uploading videos?
- What
      happens if many users are accessing the same video concurrently?
- Possible
     tips for consideration:
- Make
      use of cloud technology to store and transmit video data
- There
      are three components of Netflix: OC (Content Delivery Network), Backend
      database, Client device for accessing the application.
Design a traffic control system.
Generally,
in a traffic control system, we see that the lights transition from RED To
GREEN, GREEN to ORANGE and then to RED.
- What
     are some of the Required Features?
- Transition
      traffic lights based on the conventions.
- What
     are some of the common problems encountered?
- Determine
      the time interval for which the state of the traffic lights has to
      change.
- What
      happens in worst-case scenarios where the state is wrongly shown?
- Possible
     tips for consideration:
- Make
      use of state design patterns and scheduling algorithms for the transition
      of the state from one colour to another.
Design Web Crawler.
The Web
crawler is a search engine-related service like Google, DuckDuckGo and is used
for indexing website contents over the Internet for making them available for
every result.
- What
     are some of the Required Features?
- Design
      and develop a Scalable service for collecting information from the entire
      web and fetching millions of web documents.
- Fresh
      data has to be fetched for every search query.
- What
     are some of the common problems encountered?
- How
      to handle the updates when users are typing very fast?
- How
      to prioritize dynamically changing web pages?
- Possible
     tips for consideration:
- Look
      into URL Frontier Architecture for implementing this system.
- Know
      how crawling is different from scraping.
Design ATM system.
ATMs are
used for depositing and withdrawing money from customers. It is also useful for
checking the account balance.
- What
     are some of the required features?
- Each
      user should have at least one bank account that is linked to the card for
      performing transactions.
- ATM
      to authenticate the user based on 4 digit PIN associated with the card.
- User
      to perform only one transaction at a given time.
- What
     are some of the common problems encountered?
- What
      happens during transaction timeout?
- What
      happens if the money is deducted from the bank account but the user
      hasn't received it from the machine?
- Possible
     tips for consideration:
- Divide
      the problem into different entities like Card, Card Reader etc and
      establish a relationship between each of the entities.
Design Uber, Ola or Lyft type of systems.
These
platforms help user request rides and the driver picks them up from the
location and drop them at the destination selected by the user.
- What
     are some of the required features?
- Real-time
      service for booking rides
- Should
      have the capability of assigning rides that lets the user reach the
      destination fast.
- Show
      the ETA (Estimated Time of Arrival) of the driver after booking the ride
      and once the ride has been started, show the ETA of the vehicle arriving
      at the destination.
- What
     are some of the common problems encountered?
- How
      to store geographical locations for drivers always on move?
- How
      to assign drivers to the customers efficiently?
- How
      do you calculate the ETA of the driver arrival or the destination
      arrival?
- Possible
     tips for consideration:
- Make
      use of the microservices concept with fast databases for booking rides
      faster.
- Evaluate
      Dispatch System for assigning drivers to the users.
 
No comments:
Post a Comment