I measured the performance of 1 million documents with mongoDB

I had the opportunity to use mongoDB in my app I measured the performance

From the conclusion A DB without an index is too slow to be useful </ b>

The execution environment is as follows

name spec
OS Ubuntu18.04
CPU Virtual 6 core
memory 24GB
HDD 7200rpm(Equivalent to 100 IOPS)

See below for IOPS https://qiita.com/you21979@github/items/21c125a6359d55e9dec4

INSERT speed Insertion speed, one document adjusted to about 1kB

insert_speed_qiita.png

Insert_one is one by one, insert_many is 1 million items at once The rest is the difference between indexed and unindexed

There was a big difference in speed in the insertion method, There was no big difference with or without the index

Change the number of indexes

Since there was only one index earlier Try changing with 0, 1, 10, 25, 50

insert_many

index_speed_qiita.png

insert_one

index_insert_one_speed_qiita.png

As the dogma, the larger the index, the slower it becomes. By the way, in this case, the maximum number of indexes was 61. (No more errors)

FIND speed Time to finish looking up 1 million documents in 1 million lists In conclusion, no index is unmeasurable

find_speed_qiita.png

After all, it was a comparison with only indexes The difference between the two is that find_one has one document find just returns the cursor (iterator)

Summary This time it was HDD, so SSD should be considerably faster In any case, if you use DB as DB when it is about 1 million, index is essential Turned out to be

Recommended Posts