NoSQL databases are fast becoming popular for web apps because of the simplicity and scalability they provide as compared to regular relational databases. This is especially helpful when designing social networking apps because of the sheer amount of data that needs to be processed and served.
Key advantages of using NoSQL database are:
1. Flexible key/value store – This makes reading and writing data super-fast.
2. Schema less – This makes then a great fit for non-structured or semi-structured data.
3. High Scalability – Most NoSQL databases are designed from ground up to run on multiple servers, which makes partitioning and hence scaling for higher loads much easier compared to regular relations databases.
But of course, everything comes with a cost, NoSQL databases sacrifice a little bit on consistency in favour of scalability and latency. So, they are not a good choice for mission critical data, like banking, stock markets, or any other financial institutions.
In light of these pros and cons, whether to use NoSQL or not in social networking apps is largely a design decision and is dependent on several factors like is it a public or private network, how much structured and non-structured data is involved, etc. In such apps, it doesn’t really matter if one of the comments on a photo was lost of if a status update shows up a few minutes late.
Depending on the app, we can either choose to store all data in a NoSQL database or store transient data like status updates, comments, notifications, etc. in NoSQL and more permanent and structured data like users’ demographic information in a RDBMS.
Now that we have decided to use a NoSQL database in our social networking app, the next question is which one should we choose. Most popular NoSQL databases are: Cassandra, CouchDB, HBase, MongoDB, and Redis.
Cassandra, CouchDB, and MongoDB have quite close to a drop-in replacement for ActiveRecord and hence can be easily used with Rails apps, especially in Rails 3.0 or higher. Each of these databases has some pros and cons over others, so choose one that best fits your needs. If it helps in decision making, Cassandra is being used at big apps like Twitter, Digg and MongoDB is being used at giants like Disney, Forbes, foursquare and MTV.
NoSQL database for scalable Social Networking Development