您的位置:首页 > 数据库 > Mongodb

Is MongoDB the next big thing?

2011-06-27 19:25 381 查看
原文地址: http://www.tutkiun.com/2010/09/is-mongodb-the-next-big-thing.html

MongoDB is Opensource, scalable, schema free and document oriented database designed for very high performance and developed in C++. The goal is to bridge the gap between key value stores and traditional RDBMS. MongoDB stores data in collection of JSON like documents. This allows many applications to model data in a more natural way, as data can be nested in complex hierarchies and still be query-able and index-able.

Features

Simple Queries
MongoDB is a document store with no transactions and no joins. Queries are easier to write and more easy to tune.

Document-based data model
The basic unit of storage is analogous to Ruby hashes, JSON, Python dictionaries etc. A rich data structure capable of holding arrays and other documents. Advantage of document based data model is, you can represent as single entity a construct what would require several tables to properly represent in a relational db.

Sharding
If you have a lots of data and you are running out of space on single DB server then sharding can help you there. It scales your database horizontally, i.e. bring new machines and divide your load of several machine that will not only give you more space to store but also enhance performance and increase disk throughput. The main advantage sharding provides is you don’t have to care about your database needs for after 5 years from now, no pre-optimization and no downtime.

GridFS
A simple but most useful concept in MongoDB! Traditional databases such as MySQL don’t allow to store files in database. For Ex. If I want to store profile picture of an user then I need to store URL/Path of that image in database and not the whole image. With GridFS, MongoDB lets you to store file in database. As MongoDB has built in replication and sharding facilities, the files will not only stored there but also help you in backing ‘em up.

MultiKeys
An interesting feature that will automatically index arrays of an index values. For eg. If you have stored an article with multiple tags in MongoDB database then MongoDB will automatically index all the tags and you can use them for searching any articles in database. Also, if that article is blog post then you might want to store the comments in the same place where article is stored. Yes, you can do this by embedding objects in an array.

MapReduce
A tools useful for batch manipulation of data and aggregation operations. It is particularly useful in scenarios where you have data coming from different sources and the requirement is to process that data simultaneously. map/reduce is invoked via a database command. The database creates a temporary collection to hold output of the operation . The collection is cleaned up when the client connection closes, or when explicitly dropped.

Better Performance
As I mentioned above, MongoDB doesn’t require any joins and translations. The results is better performance.

Advantages

MongoDB is extremely fast

No schema no Data mapping → Faster development

No another query language for learning → Faster learning curve

Your code is future-proof. Easily lets you to add more fields, even complex fields to your objects. So as requirements change, you can adapt code quickly.

Horizontally scalable

No need to worry about migrations.

Things to keep in mind

So far, after reading through features and advantages you might be feeling that lets use Mongo for my next project. But here are few things you should keep in mind before switching over to MongoDB (fromNoSQL blog)

MongoDB assumes you have large (very large) amount of hard drive space

MongoDB assumes RAM can be used instead of disk

MongoDB assumes that you have a 64-bit machine

MongoDB assumes that you’re using a little-endian system

MongoDB assumes that you have more than one server

MongoDB assumes you want fast/unsafe, but lets you do slow/safe

MongoDB developers assume you’ll complain if something goes wrong

Disadvantages

Stability
One of the major blow to MongoDB is the environment is not yet stable. There are memory leaks on process so, you will need reboot your server every few days. The lack of stability also makes it unsuitable for production environment where data is very important.

No Queries
Because MongoDB doesn’t support queries in SQL, you can’t make use of the enormous range of SQL-based reporting and business intelligence tools. This means any tool that uses ODBC or JDBC to generate graphs, reports or dashboards is unavailable to you.

Durability
MongoDB isn’t designed for durability that means your data is more likely to be lost if you are in “single instance configuration”

Not enough documentation
As MongoDB is relatively new there is lack of documentation. If you want to try something new then you might find it difficult to get some help.

Lack of availability of Talent
You might find it difficult to get some talented developers who knows everything about it.

Who should go for it?

MongoDB at current stage is most suitable for those who want database response extremely fast and at the same time can bear loss of few records. Forums, blogs and news sites can use Mongo to enhance performance. It is most efficient to them as initial investment is comparatively much less and the infrastructure can be scaled anytime if needed in future.

Have something to say about MongoDB? Post it down in comments.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: