About the time-consuming problem of mongodb
过去多啦不再A梦
过去多啦不再A梦 2017-05-02 09:24:33
0
3
640

Query code:

console.time('计时器1')
collection.count({}, function(err, count) {
        collection.find({}, {
            limit: num,
            skip: (data.page - 1) * num
        }).sort({
            time: -1
        }).toArray(function(err, list) {
            mongoDb.close();
            var page = {}
            page["count"] = count
            page["limitNum"] = num
            callback(null, list, page)
            console.timeEnd('计时器1')
        })
    });

The picture above is the mongo time I monitored under window

The picture below shows the time it took me under Linux

Why are the same query codes almost 3 times different? The amount of data I have is only 67 items

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
阿神

I found the reason, it’s because the account password is set. I see that every time I request mongo, it will verify the account password, which causes the time to take a long time. If I remove it, it drops to about 30ms

给我你的怀抱

Is it possible to consider printing out the execution plans when querying MongoDB on two different OSs, and compare the execution plans on both sides?

过去多啦不再A梦

Is your Linux system 32-bit or 64-bit?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template