shardConnPoolStats
Definition
shardConnPoolStats
- Returns information on the pooled and cached connections in the shardedconnection pool. The command also returns information on the per-threadconnection cache in the connection pool.
The shardConnPoolStats
command uses the following syntax:
- { shardConnPoolStats: 1 }
The sharded connection pool is specific to connections between membersin a sharded cluster. The mongos
instances in a cluster usethe connection pool to execute client reads and writes. Themongod
instances in a cluster use the pool when issuingmapReduce
to query temporary collections on other shards.
When the cluster requires a connection, MongoDB pulls a connection fromthe sharded connection pool into the per-thread connection cache.MongoDB returns the connection to the connection pool after everyoperation.
Output
shardConnPoolStats.
hosts
Displays connection status for each config server,replica set, and standalone instance inthe cluster.
shardConnPoolStats.
replicaSets
Displays information specific to replica sets.
shardConnPoolStats.replicaSets.<name>.
host
Holds an array of documents that report on each replica set member.These values derive from the replica set status values.
shardConnPoolStats.replicaSets.<name>.host[n].
addr
The host address in the format
[hostname]:[port]
.This field is for internal use. Reports
false
when themongos
either cannot connect to instance or received aconnection exception or error.The host is the replica set’s primary if this is
true
.The host is a hidden member of the replica set if this is
true
.- The host is a hidden member of the replica set if this is
true
.
The host is a secondary member of the replica set if this istrue
.
- <code>shardConnPoolStats.replicaSets.<name>.host[n].</code><code>pingTimeMillis</code>[]($7b561ca2f6d8a542.md#shardConnPoolStats.replicaSets..host[n].pingTimeMillis)
-
The latency, in milliseconds, from the mongos
to this member.
- <code>shardConnPoolStats.replicaSets.<name>.host[n].</code><code>tags</code>[]($7b561ca2f6d8a542.md#shardConnPoolStats.replicaSets..host[n].tags)
-
A tags
document contains user-defined tag field and value pairs forthe replica set member.
- { "<tag1>": "<string1>", "<tag2>": "<string2>",... }
- For read operations, you can specify a tag set in the [readpreference]($fa2fb125500af441.md#replica-set-read-preference-tag-sets) to direct theoperations to replica set member(s) with the specified tag(s).
- For write operations, you can create a customize [write concern]($d526a6502b9a8116.md) using[<code>settings.getLastErrorModes</code>]($364b66b683f71e1a.md#rsconf.settings.getLastErrorModes) and[<code>settings.getLastErrorDefaults</code>]($364b66b683f71e1a.md#rsconf.settings.getLastErrorDefaults).
For more information, seeConfigure Replica Set Tag Sets.
See also
shardConnPoolStats.
totalAvailable
- The number of connections available from the
mongos
tothe config servers, replica sets, and standalonemongod
instances in the cluster.
shardConnPoolStats.
totalCreated
- The number of connections the
mongos
has ever created toother members of the cluster.
shardConnPoolStats.
threads
Displays information on the per-thread connection cache.
shardConnPoolStats.threads.
hosts
Displays each incoming client connection. For a
mongos
,this array field displays one document per incoming client thread.For amongod
, the array displays one entry per incomingshardedmapReduce
client thread.shardConnPoolStats.threads.hosts.
host
The host using the connection. The host can be a configserver, replica set, or standalone instance.
The number of times the host pulled a connection from the pool.
- The thread’s availability.
- The namespaces used on this connection thus far.