System Design

Design Quora

Q&A feeds, topic graph, ranking, and moderation at hundreds of millions of questions.

Interview tip Model Question, Answer, Topic, User. Feed = mix of topic interest + social graph + quality score. Search overlaps with distributed search patterns.

① Functional requirements

  • Post question with topics
  • Write/edit answers with rich text
  • Upvote/downvote answers
  • Follow topics and users
  • Personalized home feed of questions
  • Search questions and answers

② Non-functional requirements

  • Feed generation p99 < 300ms
  • 99.9% availability
  • Moderation queue for flagged content
  • Global CDN for read-heavy traffic
  • Eventual consistency OK for vote counts

③ Back-of-the-envelope scale

Assumptions
  • 10M DAU × 50 feed items = 500M feed cells/day precomputed
  • 200 writes/sec answers peak
  • Vote bursts on viral answer: 10K/sec incr
  • Search: 2K QPS

④ High-level architecture

Quora Architecture
Web / mobile clients
API gateway
Q&A service
Feed service
Vote/counter service
Search index
PostgreSQL + Cassandra
Questions/answers in SQL for ACID edits. Feed candidates precomputed on write fan-out to followers. Votes via counter service.

⑤ Data flow & execution path

New answer fan-out
① Post answer② Persist Q&A DB③ Fan-out feed cells④ Index search⑤ Notify followers
Feed read: pull precomputed cells + rank on read
Topic graph expands candidate pool
Quality score decays spam answers
Async moderation ML scan
Contrast fan-out on write (followers) vs fan-in on read for home feed — pick hybrid for celebrity authors.

⑥ API & interfaces

Endpoint / flowPurposeNotes
POST /questionsCreate questiontopics[] required
POST /answersPost answerquestion_id + body
GET /feedHome feedcursor pagination
POST /voteUpvote answeridempotent per user
GET /searchSearch Q&Adelegates to search cluster

⑦ Data model & storage

Question, Answer, Topic, UserTopic, Vote(user, answer), FeedCell(user, question, score, ts).
StoreWhatWhy
PostgreSQLQ&A contentACID edits
CassandraFeed cells per userWide rows by user_id
RedisHot feeds cacheTop stories
Search clusterFull-textQuestions + answers

⑧ Deep dive — core components

Feed ranking features

Score = topic_match × author_quality × recency × social_proof (votes). Train logistic model offline; serve weighted sum online for speed.

Celebrity fan-out

User with 10M followers: skip write fan-out — merge celebrity posts at read time from celebrity bucket.

⑨ Trade-offs & alternatives

DecisionOption AOption BPick when
FeedFan-out writeFan-in readHybrid for celebrities
VotesCounter serviceDB rowCounter service for hot answers
ContentSQLNoSQLSQL for editable rich text
ModerationSync blockAsync queueAsync ML + human review queue

⑩ 45-minute interview script

  1. 0–5 min: Q&A + feed requirements
  2. 5–12 min: Scale and DAU math
  3. 12–22 min: Services diagram
  4. 22–32 min: Feed fan-out + ranking
  5. 32–40 min: Search + moderation

⑪ Likely follow-up questions

QuestionShort answer
Duplicate questions merge?Detect similar titles via embedding similarity; moderator merges canonical question
Anonymous posting?Pseudonymous user_id; still rate limit; reduced trust weight in ranking
Multi-language?Language detect on post; separate search indices or multilingual embeddings

⑫ Revision checklist

  • Q&A data model
  • Topic graph
  • Feed precomputation
  • Celebrity hybrid fan-out
  • Vote counter service
  • Search indexing
  • Moderation pipeline
  • CDN for static assets
quorafeedqarankingsocial