The user has a news feed, where he sees new content from friends and public, I’m curious to know how such a tape is saved and such a tape is given, the very first thing that comes to mind is how this should be implemented: There is a database, it contains an array of news JSON strings , this array of lines is replenished as follows, I publish the news, and this news is recorded in the array of news lines to all my friends and subscribers, and it turns out that if I have 1000 friends and subscribers, then every time I publish the news, the database should do 1000 records. Is that what happens? or is there smarter everything done?
- Most likely your news only to you in the tape is stored in the database. - Vladimir Gamalyan
- And how then does my news get into the news feed of my friends and subscribers? - Gennady
- With a query to the database, they pull out N news, which were published by the groups / people they subscribed to + everything is optimized somehow. And save the news 1 time. Why more? Think about it yourself, if you have 5 million subscribers, do you think it is possible to make 5 million entries in the database for each news item? - Floyat
- With a sample of the database, we take all the news from which the author enters my friends and show. - Vladimir Gamalyan
- It turns out contact every time the user in the news tab, out of 100 million users, finds 1000 friends + publics and pulls out a fresh sub-site from their news array, adds 1000 subarrays into the user's news feed, plus builds it hierarchically by date? - Gennady
|