MySql vs NoSql - Social network comments and notifications data structure and implementation

Sambhav Sharma

I am really finding it tough to figure out the insights about how does a social networking site (Facebook being a reference) manage their comments and notifications for its users.

How would they actually store the comments data? also how would a notification be stored and sent to all the users that. An example scenario would be that a friend comments on my status and everyone that has liked my status including me gets a notification for that. Also each user has their own read/unread functionality implemented, So I guess there is a notification reference that is stored for each user. But then there would be a lot of redundancy of notification information. If we use a separate table/collection to store these with reference of actual notificatin, then that would create realtime scalability issues. So how would you decide which way to trade-off. My brain crashes when I think about all this. Too much stuff to figure with not a ot of help available over the web.

Now how would each notification be sent to the all the users who are supposed to receive that.. and how would the data structure look like.

I read a lot of implementations those suggest to use MySql. My understanding was that the kind of data (size) that is, it would be better to use a NoSql for scalability purpose. So how does MySql work well for such use cases, and why is a NoSql like Mongo not suggested anywhere for such implementation, when these are meant to be heavily scalable.

Well, I know a lot of questions in one. But I am not looking for a complete answer here, insights on particular things would also be a great help for me to build my own application.

user3181113

The question is extremely broad, but I'll try to answer it to the best of my ability.

How would they actually store the comments data? also how would a notification be stored and sent to all the users that.

I generally don't like answering questions like this because it appears as if you did very little research before coming to SO. It also seems like you're confused with application and database roles. I'll at least start you off with some material/ideas and let you decide on your own.

There is no "silver bullet" for a backend design, especially when it comes to databases. SQL databases are generally very good at most database functionality, and rightfully so; it's a technology that is very mature and has stood the test of time for a reason. Most NOSQL solutions are specialized for particular purposes. For instance: if you were logging a lot of information, you might want to look at Cassandra. If you were dealing with a lot of relational data, you would want to use something like Neo4j (or PostgreSQL/MySQL for RMDBS). If you were dealing with a lot of real-time data, you might want to look at Redis.

It's dumb to ask NOSQL vs SQL for a few reasons:

NOSQL is a bad term in general. And it doesn't mean "No SQL". It means "Not Only SQL". Unfortunately the term has encapsulated even the most polar opposite of databases.

Only you know your application's full functionality. Even if I knew the basics of what you wanted to achieve, I still couldn't give you a definitive answer. Nor can anyone else. It's highly subjective, and again, only YOU know EXACTLY what your application should do.

The biggest reason: It's 2014. Why one database? Ten years ago "DatabaseX vs DatabaseY" would have been a practical question. Now, you can configure many application frameworks to reliably use multiple databases in a matter of minutes. Moral of the story: Use each database for its specialized purpose. More on polyglot persistence here.

As far as Facebook goes: a five minute Google search reveals what backend technologies they've used in the past, and it's not that difficult to research some of their current backend solutions. You're not Facebook. You don't need to prepare for a billion users right now. Start with simple, proven technologies. This will let you naturally scale your application. When those technologies start to become a bottleneck, then be worried about scalability.

I hope this helped you with starting your coding journey, but please use Stack Overflow as a last resort if you're having trouble with code. Not an immediate go-to.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySql vs NoSql - Social network comments and notifications data structure and implementation

From Dev

NoSQL documents structure vs SQL tables structure

From Dev

NoSQL documents structure vs SQL tables structure

From Java

Given a data structure representing a social network implement method canBeConnected on class Friend

From Dev

Cassandra data modeling for a social network

From Dev

Correct Flattened Data Model and noSQL data structure

From Dev

Correct Flattened Data Model and noSQL data structure

From Dev

Forum like data structure: NoSQL appropriate?

From Dev

Amount of data storage : HDFS vs NoSQL

From Dev

Mongodb data structure on posts, comments, save and likes

From Dev

What are the pitfalls for using ElasticSearch as a nosql db for a social application vs a graph database?

From Dev

Ruby proper data structure for this implementation

From Dev

Whether to use WebSocket or Server Sent Event for sending notifications from server which retrieves social network presence in realtime?

From Dev

NoSQL DAO implementation

From Dev

Load Social Network Data into Neo4J

From Dev

NoSQL tree structure

From Dev

Firebase/NoSQL Database Structure

From Dev

Nosql database structure with Realm

From Dev

issue in making Queue data structure as array implementation

From Dev

Data structure for callback matrix implementation in C++

From Dev

data structure confusion over implementation of perceptron in java

From Dev

Best Data Structure for Priority Queue implementation

From Dev

TDD implementation of a set data structure in Ruby

From Dev

Generating comments for a data structure that *wasn't* loaded via RoundTripLoader?

From Dev

In App Notifications For Social App IOS

From Dev

NoSQL ( Cassandara ) coming from MySQL, Duplicate data db design

From Dev

Neural Network-like Data Structure

From Dev

Best python data structure for network device properties

From Dev

Social network - Suggested friends

Related Related

  1. 1

    MySql vs NoSql - Social network comments and notifications data structure and implementation

  2. 2

    NoSQL documents structure vs SQL tables structure

  3. 3

    NoSQL documents structure vs SQL tables structure

  4. 4

    Given a data structure representing a social network implement method canBeConnected on class Friend

  5. 5

    Cassandra data modeling for a social network

  6. 6

    Correct Flattened Data Model and noSQL data structure

  7. 7

    Correct Flattened Data Model and noSQL data structure

  8. 8

    Forum like data structure: NoSQL appropriate?

  9. 9

    Amount of data storage : HDFS vs NoSQL

  10. 10

    Mongodb data structure on posts, comments, save and likes

  11. 11

    What are the pitfalls for using ElasticSearch as a nosql db for a social application vs a graph database?

  12. 12

    Ruby proper data structure for this implementation

  13. 13

    Whether to use WebSocket or Server Sent Event for sending notifications from server which retrieves social network presence in realtime?

  14. 14

    NoSQL DAO implementation

  15. 15

    Load Social Network Data into Neo4J

  16. 16

    NoSQL tree structure

  17. 17

    Firebase/NoSQL Database Structure

  18. 18

    Nosql database structure with Realm

  19. 19

    issue in making Queue data structure as array implementation

  20. 20

    Data structure for callback matrix implementation in C++

  21. 21

    data structure confusion over implementation of perceptron in java

  22. 22

    Best Data Structure for Priority Queue implementation

  23. 23

    TDD implementation of a set data structure in Ruby

  24. 24

    Generating comments for a data structure that *wasn't* loaded via RoundTripLoader?

  25. 25

    In App Notifications For Social App IOS

  26. 26

    NoSQL ( Cassandara ) coming from MySQL, Duplicate data db design

  27. 27

    Neural Network-like Data Structure

  28. 28

    Best python data structure for network device properties

  29. 29

    Social network - Suggested friends

HotTag

Archive