1. What
- Feed: feed
- Classic scenarios, such as Weibo, Twitter, Facebook and other social networking sites, Moments, etc.
- Characteristic is single person to write, multiple person to read
- Data: relationships, fans, published feed messages
- 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
-
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) -
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)