- Reference >
- Database Commands >
- Diagnostic Commands >
- connPoolStats
connPoolStats¶
On this page
Definition¶
-
connPoolStats¶ The command
connPoolStatsreturns information regarding the open outgoing connections from the current database instance to other members of the sharded cluster or replica set.To run
connPoolStats, use thedb.runCommand( { <command> } )method.Note
connPoolStatsonly returns meaningful results formongosinstances and formongodinstances in sharded clusters.The command takes the following form:
The value of the argument (i.e.
1) does not affect the output of the command.
Behavior¶
connPoolStats includes aggregated statistics in its
output:
- The
hostsfield displays the information aggregated by host. - The
poolsfield displays the information aggregated by pool.
Note
To avoid interference with any running operations,
connPoolStats does not take any locks. As such, the
counts may change slightly as connPoolStats gathers
information, resulting in slight differences between the
hosts and pools
connection counts.
Example¶
The following operation uses the db.runCommand() method to
run the connPoolStats command on a mongos of a
sharded cluster. The sharded cluster has 2 shards, each a single-member
replica set, and a config server replica set. The mongos
runs on a 4-core machine.
The command returns the output of the following form:
Note
The connPoolStats output varies depending on the
deployment and the member against which you run
connPoolStats among other factors.
Output¶
-
connPoolStats.totalAvailable¶ Reports the total number of available outgoing connections from the current
mongod/mongosinstance to other members of the sharded cluster or replica set.
-
connPoolStats.totalCreated¶ Reports the total number of outgoing connections ever created by the current
mongod/mongosinstance to other members of the sharded cluster or replica set.
-
connPoolStats.totalInUse¶ Reports the total number of outgoing connections from the current
mongod/mongosinstance to other members of the sharded cluster or replica set that are currently in use.
-
connPoolStats.totalRefreshing¶ Reports the total number of outgoing connections from the current
mongod/mongosinstance to other members of the sharded cluster or replica set that are currently being refreshed.
-
connPoolStats.numClientConnection¶ Reports the number of active and stored outgoing synchronous connections from the current
mongod/mongosinstance to other members of the sharded cluster or replica set.These connections are a part of a pool that is a subset of the data reported by
totalAvailable,totalCreated, andtotalInUse.
-
connPoolStats.numAScopedConnection¶ Reports the number of active and stored outgoing scoped synchronous connections from the current
mongod/mongosinstance to other members of the sharded cluster or replica set.These connections are a part of a pool that is a subset of the data reported by
totalAvailable,totalCreated, andtotalInUse.
-
connPoolStats.pools¶ Reports on connection statistics (in use/available/created/refreshing) grouped by the connection pools. A
mongodormongoshas two distinct families of outgoing connection pools:- DBClient-based pools (the “write path”) and
- NetworkInterfaceASIO-based pools (the “read path”).
For each pool, the command returns a document that resembles the following:
Note
If there are no connections (in use/available/created/refreshing) for a particular pool, the
connPoolStatsdoes not return statistics for that pool.-
connPoolStats.pools.NetworkInterfaceASIO-TaskExecutorPool-[n]¶ Displays connection statics related to TaskExecutor pools. Typically, there will be one TaskExecutorPool per core, e.g.
NetworkInterfaceASIO-TaskExecutorPool-0…NetworkInterfaceASIO-TaskExecutorPool-7for an 8-core processor.See also
-
connPoolStats.pools.NetworkInterfaceASIO-ShardRegistry¶ Available if the command is run on a member of a sharded cluster.
Displays the pool statistics for the connections between the current
mongod/mongosinstance and other members of the sharded cluster.
-
connPoolStats.pools.NetworkInterfaceASIO-Replication¶ Available if the command is run on a member of a replica set.
Displays the pool statistics for the connections between the current
mongodinstance and the other members of the replica set.
-
connPoolStats.pools.global¶ Displays the DBClient-based pool statistics.
-
connPoolStats.hosts¶ Reports on connection statistics (in use/available/created/refreshing) grouped by the hosts.
Contains documents that represent a report of connections between the current
mongod/mongosinstance and each member of the sharded cluster or replica set.-
connPoolStats.hosts.[host].available¶ Reports the total number of connections available for connecting to the
[host].
-
connPoolStats.hosts.[host].created¶ Reports the number of connections to the
[host]ever created.
-
connPoolStats.hosts.[host].inUse¶ Reports the number of connections to the
[host]that are currently in use.
-
-
connPoolStats.replicaSets¶ Contains documents that represent a report of information related to each replica set connected to the current
mongod/mongos.-
connPoolStats.replicaSets.replicaSet¶ Reports on each replica set connected to the current
mongod/mongos.
-
connPoolStats.replicaSets.[replicaSets].hosts¶ Holds an array of documents that reports on each member in the replica set.
These values derive from the replica set status values.
-
connPoolStats.replicaSets.[replicaSet].hosts[n].addr¶ Reports the address for the member in the replica set in
[hostname]:[port]format.
-
connPoolStats.replicaSets.[replicaSet].hosts[n].ok¶ Reports
falsewhen:- the current
mongosormongodcannot connect to instance. - the current
mongosormongodreceived a connection exception or error.
This field is for internal use.
- the current
-
connPoolStats.replicaSets.[replicaSet].hosts[n].ismaster¶ Reports
trueif thishostis the primary member of the replica set.
Reports
trueif thishostis a hidden member of the replica set.
-
connPoolStats.replicaSets.[replicaSet].hosts[n].secondary¶ Reports
trueif thishostis a secondary member of the replica set.
-
connPoolStats.replicaSets.[replicaSet].hosts[n].pingTimeMillis¶ Reports the ping time in milliseconds from the
mongosormongodto thishost.
Reports the
members[n].tags, if this member of the set has tags configured.
-
-