简体   繁体   中英

NoSQL Database for Blog / Content Management System? (MongoDB / Cassandra)

My company has been used Oracle for a long time but we would like to look for a NoSQL database as a replacement for faster querying and flexible schema design.

I have tried to use MongoDB which would be the most popular NoSQL database nowadays. I connected it to Spring Data to do some simple queries, which is quite easy to be set up and code simply. Since we are using Spring MVC for web development, Spring Data seems quite suitable for integration.

However, I heard that Cassandra would have better performance in write and read, especially in large scaling system. I am not sure whether it is worth to move to Cassandra and not sure how to measure the performance between MongoDB and Cassandra.

Here are some requirements for my system:

  • focusing on article fetching
  • tagging for articles for users to easily search for their favors or related articles
  • non-distributed system, but have load-balancing and fail-over
  • Java based, Spring MVC for web development
  • articles would be stored as XML
  • probably provide user-defined tables (collections) and fields (keys)

Therefore I would like to raise some questions:

  • Which Database is the most suitable for my case? You may also raise other databases apart from MongoDB and Cassandra.
  • If I use Cassandra, which framework would be suitable for integrating to Spring MVC?

Thank you so much in advanced.

I have experience using Spring and Cassandra together. But I always have written my own data access layer.

Using the ORMs out there for Cassandra will not allow you to leverage its full power, and you will, most likely, introduce bugs because your SQL background will make you expect certain behaviours that are just not what Cassandra will give you.

My advice write the code that will access Cassandra yourself and do not be afraid to denormalize A LOT. Think more about how you want to query (or find it) your data than the format in which you want to save it.

I also strongly recommend reading this amazing article: Cassandra Data Modeling Best Practices part 1 part 2

Another DB which might suit your application better is CouchDB (I like using BigCouch). It is another Document based NoSQL database and is in my opinion superior to MongoDB. It offers better solution for scaling and gives emphasis to Availability (just like Cassandra).

I'd like to point you to this question about the difference between CouchDB and MongoDB.

As far as framework goes Play framework has a lot of plugin to work with NoSQL systems, so you might give it a try. You could try playorm which is the last I experimented on.

EDIT : I forgot to mention Kundera as well as an ORM for Cassandra

Choosing between Cassandra and MongoDB depends on type of storage. MongoDB is primarily for document based storage where you get an edge by having various sql like features.

If you require columnar database with high availability and multi dc replication? go for Cassandra.

http://db-engines.com/en/system/Cassandra%3BHBase%3BMongoDB

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM