Design Quora
Learn to design a system similar to Quora.
We'll cover the following...
What is Quora?
Quora is a social question-and-answer service that allows users to ask questions to other users. Quora was created because of the issue that asking questions from search engines results in fast answers but shallow information. Instead, we can ask the general public, which feels more conversational and can result in deeper understanding, even if it’s slower. Quora enables anyone to ask questions, and anyone can reply. Furthermore, there are domain experts that have in-depth knowledge of a specific topic who occasionally share their expertise by answering questions.
Requirements
Let’s go over the functional and non-functional requirements below.
Functional requirements
A user should be able to perform the following functionalities:
- Questions and answers: Users can ask questions and give answers. Questions and answers can include images and videos.
- Upvote, downvote, and comment: It’s possible for users to upvote, downvote, and comment on answers.
- Search: Users should have a search feature to find questions already asked on the platform by other users.
- Recommendation system: A user can view their feed, which includes topics they’re interested in. The feed can also include questions that need answers or answers that interest the reader. The system should facilitate user discovery with a recommender system.
- Ranking answers: We enhance user experience by ranking answers according to their usefulness. The most helpful answer will be ranked highest and listed at the top.
Non-functional requirements
- Scalability: The system should scale well as the number of features and users grow with time. It means that the performance and usability should not be impacted by an increasing number of users.
- Consistency: The design should ensure that different users’ views of the same content should be consistent. In particular, critical content like questions and answers should be the same for any collection of viewers. However, all users of Quora don’t need to see a newly posted question, answer, or comment right away.
- Availability: The system should have high availability. This applies to cases where servers receive a large number of concurrent requests.
- Performance: The system should provide a smooth experience to the user without a noticeable delay.
Building blocks and design
We’ll use the following building blocks for the initial design of Quora:
-
Load balancers will be used to divide the traffic load among the service hosts.
-
Databases are essential for storing all sorts of data, such as user questions and answers, comments, and likes and dislikes. Also, user data will be stored in the databases. We may use different types of databases to store different data.
-
A distributed caching system will be used to store frequently accessed data. We can also use caching to store our view counters for different questions.
-
The blob store will keep images and video files.
Components
The design of Quora will be composed of the following building blocks and components:
- Web and application servers: A typical Quora page is generated by various services. The web and application servers maintain various processes to generate a webpage. The web servers have manager processes and the application servers have worker processes for handling various requests. The manager processes distribute work among the worker processes using a router library. The router library is enqueued with tasks