Designing a Feed System

functional_requirement

  1. Feed must be generated based on what user is following.
  2. Post can have text, image or video.
  3. New posts should be appended to user’s feed based on some ranking mechanism.

Non Functional requirements

  1. Scalable: Support any number of users.
  2. fault_tolerancePartition_Tolerance
  3. Availability: PACELC theorem

back_of_the_envelope calc

database_design

  1. metadata_table
  • Process of feeding post to customer is called fanout.
  • fan_out simply can be thought of delivering a message to multiple people.
  • Redis vs Memcache
  • task

Questions

  • Q. In non functional requirement partition tolerance and fault tolerance have been mentioned, what is the difference in both? Is it fine to cover them in same point.
  • Q. What isnetwork_partitioning? If one part of the system goes down the other system works as usual.
  • Q. Why are we keeping each post for every user, can’t we have a link or something? Will there be duplicate posts if user is subscribed to same topic?
  • Q. What will be stored in the cache? How to connect cache with metadata table?
  • Q.fan_out in reactive programming and Messaging Queue vs here?
  • Q. Where will n sqaure better than n log n? When n is between 0 to 1?
  • Q. Can you explain more about cache layer and what data will be stored there? Trying to connect DB and cache layer so cache storage can be minimized.