Architecture case-Feed business architecture design practice

1. What

  1. Feed: feed
  2. Classic scenarios, such as Weibo, Twitter, Facebook and other social networking sites, Moments, etc.
  3. Characteristic is single person to write, multiple person to read
  4. Data: relationships, fans, published feed messages
  5. Difficulty: Your homepage is composed of feeds published by others. When the amount of concurrency is high (for example, Guo Degang posted a feed), if the design is not good, it will cause fans to pull the homepage very slowly.

Two, How

  1. Pull mode (read diffusion):
    Suitable for the start-up stage with small data volume and small concurrency. When the amount of data and concurrency goes up, the homepage will be slow to read.
    Advantages: save one feed, small storage, simple logic.
    Disadvantages: users access data in a centralized manner , poor performance (referring to slow homepage pull)

  2. Push mode (write diffusion):
    Suitable for the mature stage with large data volume and large concurrency.
    Advantages: multiple feeds, redundant storage for lock conflicts, high performance (fast homepage pull)
    Disadvantages: complex logic, any operation (such as following, unfollowing, publishing a feed) will have write proliferation, such as publishing A feed, to be sent to all fans (that is, every fan will receive the id of the message, or id+content)

Guess you like

Origin blog.csdn.net/hudmhacker/article/details/108124806