1 introduction

Moments, weibo, are all Feed streaming products, and Pinterest, Petal, etc. are another form of Feed streaming products. Many apps also have a module called Feed Feed or Message plaza, which are also Feed streaming products.

The core concept

  • Feed

Each state or message in the Feed flow. For example, a status in moments is a Feed, and a microblog is a Feed.

  • The Feed flow

An information flow that continually updates and presents content to users. Everyone’s moments, Micro blog page and so on is a Feed stream.

  • Timeline

One type of Feed stream, microblog and moments are all Timeline Feed streams. However, Timeline is the earliest, most widely used and most well-known type, and sometimes Timeline is used to represent Feed streams.

  • Focus on page Timeline

A page that displays other people’s feeds, such as moments, or the front page of a microblog.

  • Personal page Timeline

The page showing the Feed messages sent by oneself, such as the photo album in wechat and the personal page of Weibo.

2 the characteristics of

  • Multi-account content streaming

There must be thousands of accounts in the Feed stream system, among which you can follow, unfriend, add friends and block. As long as this is true, you can design it as a Feed flow system.

  • An unstable account relationship

The relationship between users in the system will always be changing due to the existence of concerns and close operations, which is an unstable state.

  • The read-write ratio is 100:1

There is a serious imbalance in reading and writing, with more reading and less writing, and the average reading and writing ratio is 10:1 or even more than 100:1.

  • The message must be reachable

For example, after sending a circle of friends, the result is that some friends see it, some friends do not see it, if the girlfriend did not see it, then it may produce a very serious emotional conflict, the consequences are very serious.

3 classification

  • Timeline

According to the chronological order of publication, the first to publish is first seen, and the last to publish is ranked at the top, similar to wechat moments, Weibo, etc. This is also the most common form. If the product selects the Timeline type, it assumes that there are not many feeds in the Feed stream, but each Feed is important and needs to be seen by the user.

  • Rank

Sort by a non-time factor, generally according to the user’s preference, the user’s favorite in the first row, the second favorite in the second row. This general assumption assumes that the user may see a large number of feeds, and the user’s time is limited, so the user chooses the Top N results that the user most wants to see. The application scenarios include picture sharing, news recommendation, product recommendation, etc.

4 the difficulty

4.1 storage

As the Feed in this project is relatively simple, it can be stored by MySQL. If the Feed flow with complex data structure is stored by NoSQL database, such as MongoDB or HBase, it is more convenient and efficient.

4.2 push

There are three schemes in the push scheme, which are:

Pull mode

Also known as read diffusion, users actively pull content from followers’ feeds. That is, when a user (especially one who follows a lot of people) triggers an action, it pulls its own feed, retrieves the user’s follow table, and then retrieves the newly posted feed based on the follow table. If a user follows too much, querying that user’s follow list also has a high data cost.

Push mode

Also known as write proliferation, when a user adds a Feed, the Feed is automatically notified to those who follow it (preferably). That is, when a user triggers a behavior (such as tweeting), their behavior is recorded in the behavior table, which also corresponds to the user’s fans table, and a feed is inserted for each fan. However, for the large V with more than 10,000 followers, it costs a lot to store data by inserting a feed for each follower.

Use Redis Sorted Timeline Sets (convenient to sort Timeline by time) to maintain the Feed collection of fans. When bloggers add feeds, they actively push the content to the Feed collection of fans, so that users can easily and quickly read from the collection

Push-pull combination

For example, on Weibo, most users have several hundred accounts, but some users only use the account with more than 10 million.

Push online, pull offline

  • Big V hair dynamic, only synchronous release dynamic to the online fans at the same time, offline fans online, and then to pull dynamic. To push and pull.

Timing push, offline pull

After big V sends the dynamic, in the way of resident process regularly push to the fans dynamic table.

5 table design

reference

  • www.zhihu.com/question/20…
  • Developer.aliyun.com/article/224…