top

On this page本页内容

top

top is an administrative command that returns usage statistics for each collection. 是一个管理命令,用于返回每个集合的使用统计信息。top provides amount of time, in microseconds, used and a count of operations for the following event types:提供以下事件类型的使用时间(以微秒为单位)和操作计数:

  • total
  • readLock
  • writeLock
  • queries
  • getmore
  • insert
  • update
  • remove
  • commands
Important重要

The top command must be run against a mongod instance. top命令必须针对mongod实例运行。Running top against a mongos instance will return an error.mongos实例运行top将返回错误。

Issue the top command against the admin database in the form:admin数据库发出top命令,格式如下:

{ top: 1 }

Example示例

At mongosh prompt, use top with the following invocation:mongosh提示符下,使用top进行以下调用:

db.adminCommand("top")

Alternately you can use top as follows:或者,您可以使用top,如下所示:

db.adminCommand( { top: 1 } )

The output of the top command would resemble the following output:top命令的输出类似于以下输出:

{
  "totals" : {
     "records.users" : {
                  "total" : {
                          "time" : 305277,
                          "count" : 2825
                  },
                  "readLock" : {
                          "time" : 305264,
                          "count" : 2824
                  },
                  "writeLock" : {
                          "time" : 13,
                          "count" : 1
                  },
                  "queries" : {
                          "time" : 305264,
                          "count" : 2824
                  },
                  "getmore" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "insert" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "update" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "remove" : {
                          "time" : 0,
                          "count" : 0
                  },
                  "commands" : {
                          "time" : 0,
                          "count" : 0
                  }
          }
}
←  shardConnPoolStatsvalidate →