mardi 16 octobre 2018

Best approach for implementing comments and likes system like Instagram or Twitter

We are designing a database (MySQL) for the course project. This is exactly what we're stuck in: comments and likes system. So we have found this ref: Implementing Comments and Likes in database

It is beautifully and precisely explained. But every likes or comments has to be a new row. The Instagram's Like button is hit an average of ~4.5 billion times per day. This is too huge for likes table. 4.5bx30 days=135 trillion per month! I don't believe they're doing a design that way.

  • The Main question that we have in mind: How can we design the most appropriate design structure used by large companies? (Twitter, Instagram, etc.) (Minimal query execution, most optimized, etc.)

That's how we actually thought:

  • If someone comment on the post, the JSON will be updated in the comments column. Is this method more efficient than adding a new row for every comment or like?

struct

  • We found this class diagram: https://stackoverflow.com/a/1120491/5685796 This design was shared in 2009. If we are doing large projects, does implementing this schema create an optimization problem for us in the future? (Suppose each share comes with 1 million likes and 1 million comments. :))

Aucun commentaire:

Enregistrer un commentaire