C + + simple test MongoDB performance __c++

Source: Internet
Author: User
Tags mongodb

Because do not enter the database, this article does not represent MongoDB performance, only in this and IO to do a simple comparison of the performance is not scientific, but also from the side to explain a certain problem, to the development of a certain hint.

Attached: This test and in early 2012, due to the late entry of the blog, may be different, welcome to provide the latest data.


Test data size: 531M

Read Data size: 10^7 bytes

Because the fastest memory file read and write in MongoDB is roughly as follows (does not enter the database):

Read (unsigned int noffset, void *lpstore, unsigned int nstorelen), whose each read has been offset by default for a similar seek, so the test uses seek and no seek while testing, resulting as follows (unit: MS):

Read 1 bytes at a time, read 10^7 times, (Seek corresponds 10^7 times)

Without seek

Seek

Mongodb

265

5678

3885

281

5601

3916

265

5612

3791

272

5726

3842

264

5709

3850

280

5702

3872

265

5600

3940

266

5631

3912

Read 10 bytes at a time, read 10^6 times:

390

td>

Without seek

 seek

MongoDB

-

608

390

" p>31

562

406

To

5

390

$

577

390

577

375

577

390

to

562

422

577

562

390

Reading 10^7 BYTE is nearly as close to reading a large memory block.

Summary: In the test MongoDB for continuous read performance about only about 1/10 of Io, but relative to the value of each offset after a significant advantage (such as moving the mouse to obtain image values, as shown below), for reading large memory, MongoDB performance and IO difference is negligible. Therefore, the greater the granularity, the MongoDB performance is closer to Io, if the MongoDB as the bottom, you need to avoid frequent small granularity of access (Zecundi).


This paper simply tests the MongoDB not to enter the database under Read, and does not represent the performance of MongoDB itself, can only explain how to better apply it.

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.