1

我在生产环境中尝试了 mongo db 性能

为此,我运行了从网上找到的以下命令

db.system.profile.aggregate({ $group : { _id :"$op", 
count:{$sum:1}, 
"max response time":{$max:"$millis"}, 
"avg response time":{$avg:"$millis"} 
}});

结果是

{
    "result" : [
        {
            "_id" : "getmore",
            "count" : 1,
            "max response time" : 0,
            "avg response time" : 0
        },
        {
            "_id" : "command",
            "count" : 43,
            "max response time" : 30,
            "avg response time" : 0.6976744186046512
        },
        {
            "_id" : "query",
            "count" : 150,
            "max response time" : 52,
            "avg response time" : 0.7
        }
    ],
    "ok" : 1
}

这个 id 的 getmore、command、query 是从哪里出现的?每个 id 的最大响应时间表示什么?

4

1 回答 1

1

This is an aggregation of all the profiled DB accesses based on the "op" field of the profile entries. From the Mongo Profile Field Description doc

op -- The type of operation. The possible values are:

insert
query
update
remove
getmore
command

The max response time is therefore the maximum response time for any Db operation of the given type. For example the maximum response time for any of the 150 query operations was 52 milliseconds.

于 2013-01-08T07:57:17.970 回答