vendredi 23 novembre 2018

Scalable newsfeed design

What kind of programming patterns are useful to utilize in real-time, social newsfeed? How should state be managed?

Imagine a user with the following attributes:

"first_name": "John",
    "last_name": "Doe",
    "dob": "01/01/1990",
    "interests": [
        "piano",
        "coding",
        "reading"
    ],
    "subscriptions": [
        "lotr_reading_group",
        "spacex_fans_club",
    ...

Whenever one of these users/orgs makes a post, John should be able to see it in his newsfeed.

For MVP, this could be simply done via a db query, where the newsfeed GETs all the latest posts from subscribers every minute or so. As the db scales though, this might become too computationally expensive to make every single time. What kind of design patterns could i use to enable this functionality then?

Aucun commentaire:

Enregistrer un commentaire