Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra instead of MySQL for social networking app

I am in the middle of building a new app which will have very similar features to Facebook and although obviously it wont ever have to deal with the likes of 400,000,000 million users it will still be used by a substantial user base and most of them will demand it run very very quickly.

I have extensive experience with MySQL but a social app offers complexities which MySQL is not well suited too. I know Facebook, Twitter etc have moved towards Cassandra for a lot of their data but I am not sure how far to go with it.

For example would you store such things as user data - username, passwords, addresses etc in Cassandra? Would you store e-mails, comments, status updates etc in Cassandra? I have also read alot that something like neo4j is much better for representing the friend relationships used by social apps as it is a graph database. I am only just starting down the NoSQL route so any guidance is greatly appreciated.

Would anyone be able to advise me on this? I hope I am not being too general!

like image 933
christophmccann Avatar asked Apr 05 '10 22:04

christophmccann


People also ask

Which database is best for social media app?

If the database is going to be embedded in the application, then SQLite would be ideal. If the database is going to house the communication data of the users, then you'll need a back-end platform. Facebook uses MySQL. PostgreSQL is ACID compliant.

Is Cassandra better than MySQL?

Cassandra provides Eventual Consistency and Immediate Consistency methods to ensure consistency in a distributed system. MySQL only provides Immediate Consistency method to ensure consistency in a distributed system.

Why is NoSQL better for social media?

Modern social media is growing crazily, and data it generates is voluminous and complex. Big Data is a fresh new idea of this phenomenon. Compared with tradi- tional SQL technology, NoSQL has many benefits including simplicity of design, scalability of data model, concurrency control, consistency in storage, etc.

Is MongoDB good for social network?

To be honest, I think the answer is no. MongoDB doesn't seem to fit really well with many-to-many relationships.


1 Answers

For example would you store such things as user data - username, passwords, addresses etc in Cassandra?

No, since it does not guarantee consistency. Cassandra is eventually consistent. Surely there shouldn't be concurrency on a certain user account's data, but I wouldn't want to bet on it. You might not need consistency on your fulltext search, your message inbox, etc. but you want consistency in anything that is security-related.

I have also read alot that something like neo4j is much better for representing the friend relationships used by social apps as it is a graph database.

I'm a big fan of the right tool for the right job. I haven't used neo4j but I've been using db4o (which is an object database) and find it very helpful. It makes development easier to use a tool that natively supports your needs. Since you need graphs and working with graphs in SQL is a pain, I'd recommend to give it a look, and evaluate whether it fits your specific needs.

Mixing databases sounds like a good idea to me as long as the choice is natural (i.e. the respective database is helpful with the specific jobs, a graph databases for graphs, a table for tables, ACID databases for anything that needs transaction safety, etc...).

like image 133
mnemosyn Avatar answered Oct 04 '22 02:10

mnemosyn