toptopis an administrative command that returns usage statistics for each collection. You can use是一个管理命令,返回每个集合的使用统计信息。您可以使用topmetrics to compare the relative performance of your collections against each other.top指标来比较集合的相对性能。
Definition定义
For every collection, 对于每个集合,top returns the amount of time, in microseconds, that each event takes to execute and a count of how many times each event has executed. top返回每个事件执行所需的time量(以微秒为单位)以及每个事件执行的次数count。The 只有在重新启动time and count metrics reset only after you restart your mongod instance.mongod实例后,time和count指标才会重置。
Redaction编校
When using Queryable Encryption, the 使用可查询加密时,top command only returns the collection name.top命令仅返回集合名称。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
Issue the 对top command against the admin database:admin数据库发出top命令:
db.runCommand(
{
top: 1
}
)Event Fields事件字段
The top command returns usage statistics for the following event fields:top命令返回以下事件字段的使用统计信息:
total | readLock and writeLock operations.readLock和writeLock操作的组合。 |
readLock | |
writeLock | |
queries | find. The queries.time and queries.count fields also update readLock.time and increment readLock.count.find操作的使用统计信息。queries.time和queries.count字段还更新readLock.time并递增readLock.count。 |
getmore | getMore operations.getMore操作的使用统计信息。 |
insert | insert operations. The insert.time and insert.count fields also update writeLock.time and increment writeLock.count.insert操作的使用统计信息。insert.time和insert.count字段还更新writeLock.time并递增writeLock.count。 |
update | update operations. The update.time and update.count fields also update writeLock.time and increment writeLock.count.update操作的使用统计信息。update.time和update.count字段还更新writeLock.time和递增writeLock.count。 |
remove | delete operations. The remove.time and remove.count fields also update writeLock.time and increment writeLock.count.delete操作的使用统计信息。remove.time和remove.count字段还更新writeLock.time并递增writeLock.count。 |
commands |
|
Example示例
The output of the top command resembles the following output:top命令的输出类似于以下输出:
{
"totals" : {
note: "all times in microseconds",
"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
}
}
}