Tasting Key-value Database (ii) The advantages and disadvantages of--MONGODB

Source: Internet
Author: User
Tags install mongodb

Tasting Key-value Database (ii) The advantages and disadvantages of--MONGODB

MongoDB's name is taken from the middle five letters of the English word "humongous" and is a database open source project developed by C + + based on Distributed file storage. His file storage format is Bson (binary JSON), which makes it possible to efficiently store binary data, such as large objects such as images, videos, and so on.

Since I am a centos x86_64 system, it is very easy to install MongoDB:

Vi/etc/yum.repos.d/mongo.repo
[10gen]
Name=10gen Repository
baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/
Gpgcheck=0
Yum Install mongo-stable mongo-stable-server mongo-stable-debuginfo

Then build a Data Catalog/var/db/mongo

Start the service

Mongod--dbpath/var/db/mongo--fork--logpath/var/log/mongodb.log--logappend

It can then be accessed via the default port of 27017.

Mongo
>use d # Select Database D
>db.c.save ({_id:0, Value: "ABCD"}) # {0, "ABCD"} Key value pair in collection C
>db.c.findone ({_id:0}) # finds data with primary key 0 in C
>db.c.find () # Lists all the data in C
>use Admin # Switch to admin mode
>db.shutdownserver () # Close MongoDB

So is MongoDB's performance as good as it's legendary? I tested it on a machine configured for Xeon E5506 2.13GHz x 4,8g memory, 1TB SATA hard drives, and the results were as follows:

Write:

First insert 500W each size about 2K of data, time-consuming 1050.2s, the actual content is about 12G, the dataset occupies a space of 22G

The second re-inserted 4500W each size about 2K of data, time-consuming 8614.4s, the actual content is about 98G, the data set occupies a space of 137G

Random reads:

Read 32,041 times, time consuming 250.3s

As you can see, random reads are very slow, perhaps due to a lack of SATA disk I/O performance. In addition, MongoDB disk space consumption is also larger in the Key-value database.

At the same time, colleagues did a comparison with Tokyo tyrant, the conclusion is that the performance is similar, disk space consumption a little bit less, but TT does not seem to support distributed. Since I didn't get the test data, I'm not going to elaborate here. In the online can find Old Zhao did the MongoDB and TT comparison-"MongoDB and Tokyo Tyrant performance comparison", his test conclusion is MongoDB performance has 10~20% advantage, can also refer to.

Because the MongoDB disk space occupies relatively big, then his distributed function is urgent. MongoDB also provides a sharding interface starting from version 1.6, and next we will test MongoDB's distribution.

Tasting Key-value Database (ii) The advantages and disadvantages of--MONGODB

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.