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:

  1. { 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.hosts.<host>.available
    • The number of connections available for this host to connect to themongos.

    • shardConnPoolStats.hosts.<host>.created

    • The number of connections the host has ever created to connect tothe mongos.
  • 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].

      • shardConnPoolStats.replicaSets.<name>.host[n].ok

      • This field is for internal use. Reports false when themongos either cannot connect to instance or received aconnection exception or error.

      • shardConnPoolStats.replicaSets.<name>.host[n].ismaster

      • The host is the replica set’s primary if this is true.

      • shardConnPoolStats.replicaSets.<name>.host[n].hidden

      • The host is a hidden member of the replica set if this istrue.

      • shardConnPoolStats.replicaSets.<name>.host[n].secondary

      • The host is a hidden member of the replica set if this istrue.

The host is a secondary member of the replica set if this istrue.

  1. - <code>shardConnPoolStats.replicaSets.&lt;name&gt;.host[n].</code><code>pingTimeMillis</code>[]($7b561ca2f6d8a542.md#shardConnPoolStats.replicaSets..host[n].pingTimeMillis)
  2. -

The latency, in milliseconds, from the mongos to this member.

  1. - <code>shardConnPoolStats.replicaSets.&lt;name&gt;.host[n].</code><code>tags</code>[]($7b561ca2f6d8a542.md#shardConnPoolStats.replicaSets..host[n].tags)
  2. -

A tags document contains user-defined tag field and value pairs forthe replica set member.

  1. { "<tag1>": "<string1>", "<tag2>": "<string2>",... }
  1. - 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).
  2. - 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

members[n].tags

  • shardConnPoolStats.createdByType
  • The number connections in the cluster’s connection pool.

    • shardConnPoolStats.createdByType.master
    • The number of connections to a shard.

    • shardConnPoolStats.createdByType.set

    • The number of connections to a replica set.

    • shardConnPoolStats.createdByType.sync

    • The number of connections to the config database.
  • shardConnPoolStats.totalAvailable
  • The number of connections available from the mongos tothe config servers, replica sets, and standalone mongodinstances 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 a mongod, the array displays one entry per incomingsharded mapReduce client thread.

      • shardConnPoolStats.threads.hosts.host
      • The host using the connection. The host can be a configserver, replica set, or standalone instance.

      • shardConnPoolStats.threads.hosts.created

      • The number of times the host pulled a connection from the pool.

      • shardConnPoolStats.threads.hosts.avail

      • The thread’s availability.
    • shardConnPoolStats.threads.seenNS

    • The namespaces used on this connection thus far.