Skip to content

Conn pool stats #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jul 26, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions source/includes/note-conn-pool-stats.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. note::

:dbcommand:`connPoolStats` only returns meaningful results for
:program:`mongos` instances and for :program:`mongod` instances
in shard clusters.
1 change: 1 addition & 0 deletions source/reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Statuses and Errors
reference/database-statistics
reference/collection-statistics
reference/collection-validation
reference/connection-pool-stats
reference/replica-status
reference/replica-configuration
reference/replication-info
Expand Down
33 changes: 21 additions & 12 deletions source/reference/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,8 @@ Diagnostics

.. dbcommand:: connPoolStats

.. include:: /includes/note-conn-pool-stats

The command :dbcommand:`connPoolStats` returns information
regarding the number of open connections to the current database
instance, including client connections and server-to-server
Expand All @@ -1735,8 +1737,9 @@ Diagnostics

{ connPoolStats: 1 }

The value of the argument (e.g. ``1`` above) does not affect the
output of the command.
The value of the argument (i.e. ``1`` ) does not affect the
output of the command. See :doc:`/reference/connection-pool-stats`
for full documentation of the :dbcommand:`connPoolStats` output.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for full documentation of all conn pool status? Did you mean of all arguements for connPoolStats?

.. dbcommand:: getCmdLineOpts

Expand Down Expand Up @@ -1771,13 +1774,13 @@ Diagnostics
- ``full: true`` provides a more thorough scan of the data.

- ``scandata: false`` skips the scan of the base collection
without skipping the scan of the index.
without skipping the scan of the index.

The :program:`mongo` shell also provides a wrapper:

.. code-block:: javascript

db.collection.validate();
db.collection.validate();

Use one of the following forms to perform the full collection
validation:
Expand All @@ -1790,6 +1793,8 @@ Diagnostics
.. warning:: This command is resource intensive and may have an
impact on the performance of your MongoDB instance.

.. TODO link to the document with these statistics

.. dbcommand:: top

The :dbcommand:`top` command returns raw usage of each database,
Expand Down Expand Up @@ -1824,13 +1829,17 @@ Diagnostics
The information provided includes the following:

- The version of MongoDB currently running.

- The information about the system that built the
":program:`mongod`" binary, including a timestamp for the build.
- The architecture of the binary (i.e. 64 or 32 bits)

- The architecture of the binary (i.e. 64 or 32 bits.)

- The maximum allowable :term:`BSON` object size in bytes (in the field
``maxBsonObjectSize``.)
``maxBsonObjectSize``.)

You must issue the :dbcommand:`buildInfo` command against the ``admin`` database.
You must issue the :dbcommand:`buildInfo` command against the
``admin`` database.

.. dbcommand:: getLastError

Expand Down Expand Up @@ -1903,10 +1912,10 @@ Diagnostics
set`, :dbcommand:`getLog` will return recent notices related to
replica set activity.

- ``startupWarnings`` - will return logs that *may* contain
errors or warnings from MongoDB's log from when the current
process started. If :program:`mongod` started without warnings,
this filter may return an empty array.
- ``startupWarnings`` - will return logs that *may* contain errors
or warnings from MongoDB's log from when the current process
started. If :program:`mongod` started without warnings, this
filter may return an empty array.

You may also specify an asterisk (e.g. ``*``) as the ``<log>``
value to return a list of available log filters. The following
Expand Down Expand Up @@ -1960,7 +1969,7 @@ Diagnostics
The :dbcommand:`isMaster` command provides a basic overview of the current
replication configuration. MongoDB :term:`drivers <driver>` and
:term:`clients <client>` use this command to determine what kind of
node they're connected to and to discover additional members of a
member they're connected to and to discover additional members of a
:term:`replica set`. The :func:`db.isMaster()` method provides a
wrapper around this database command.

Expand Down
176 changes: 176 additions & 0 deletions source/reference/connection-pool-stats.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
====================================
Connection Pool Statistics Reference
====================================

.. default-domain:: mongodb

Synopsis
--------

:program:`mongos` instances maintain a pool of connections for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mongod instances do this also. They also have connections to all the other shards, for use in migrations.

interacting with constituent members of the :term:`shard clusters
<shard cluster>`. Additionally, :program:`mongod` instances maintain
connection with other shards in the cluster for migrations. The
:dbcommand:`connPoolStats` command returns statistics regarding these
connections between the :program:`mongos` and :program:`mongod`
instances or between the :program:`mongod` instances in a shard
cluster.

.. include:: /includes/note-conn-pool-stats
..
Output
------

.. stats:: hosts

The sub-documents of the :stats:`hosts` :term:`document` report connections
between the :program:`mongos` or :program:`mongod` instance and each component
:program:`mongod` of the :term:`shard cluster`.

.. stats:: hosts.[host].available

:stats:`hosts.[host].available` reports the total number of
connections that the :program:`mongos` or :program:`mongod`
could use to connect to this :program:`mongod`.

.. stats:: hosts.[host].created

:stats:`hosts.[host].created` reports the number of connections
that this :program:`mongos` or :program:`mongod` has ever created for this host.

.. stats:: replicaSets

:stats:`replicaSets` is a :term:`document` that contains
:term:`replica set` information for the :term:`shard cluster`.

.. stats:: replicaSets.shard

The :stats:`replicaSets.shard` :term:`document` reports
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the field name is actually hosts, not host

on each :term:`shard` within the :term:`shard cluster`

.. stats:: replicaSets.[shard].host

The :stats:`replicaSets.[shard].host` field holds an array of
:term:`document` that reports on each host within the
:term:`shard` in the :term:`replica set`.

These values derive from the :doc:`replica set status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be replicaSets.[shard].hosts[i].addr

Not sure what you should write for i, it's just an index in the array...

</reference/replica-status>` values.

.. stats:: replicaSets.[shard].host[n].addr

:stats:`replicaSets.[shard].host[n].addr` reports the address
for the host in the :term:`shard cluster` in the format of
"``[hostname]:[port]``".

.. stats:: replicaSets.[shard].host[n].ok

:stats:`replicaSets.[shard].host[n].ok` reports ``false``
when:

- the :program:`mongos` or :program:`mongod` cannot connect
to instance.

- the :program:`mongos` or :program:`mongod` received a
connection exception or error.

This field is for internal use.

.. stats:: replicaSets.[shard].host[n].ismaster

:stats:`replicaSets.[shard].host[n].ismaster` reports ``true``
if this :stats:`replicaSets.[shard].host` is the
:term:`primary` member of the :term:`replica set`.

.. stats:: replicaSets.[shard].host[n].hidden

:stats:`replicaSets.[shard].host[n].hidden` reports ``true``
if this :stats:`replicaSets.[shard].host` is a :term:`hidden
member` of the :term:`replica set`.

.. stats:: replicaSets.[shard].host[n].secondary

:stats:`replicaSets.[shard].host[n].secondary` reports
``true`` if this :stats:`replicaSets.[shard].host` is a
:term:`secondary` member of the :term:`replica set`.

.. stats:: replicaSets.[shard].host[n].pingTimeMillis

:stats:`replicaSets.[shard].host[n].pingTimeMillis` reports
the ping time in milliseconds from the :program:`mongos` or
:program:`mongod` to this :stats:`replicaSets.[shard].host`.

.. stats:: replicaSets.[shard].host[n].tags

.. versionadded:: 2.2

:stats:`replicaSets.[shard].host[n].tags` reports the
:data:`members[n].tags`, if this member of the set has tags
configured.

.. stats:: replicaSets.[shard].master

:stats:`replicaSets.[shard].master` reports the ordinal identifier
of the host in the :stats:`replicaSets.[shard].host` array that is
the :term:`primary` of the :term:`replica set`.

.. stats:: replicaSets.[shard].nextSlave

.. deprecated:: 2.2

:stats:`replicaSets.[shard].nextSlave` reports the
:term:`secondary` member that the :program:`mongos` will use to
service the next request for this :term:`replica set`.

.. stats:: createdByType

:stats:`createdByType` :term:`document` reports the number of each
type of connection that :program:`mongos` or :program:`mongod` has created in all
connection pools.

:program:`mongos` connect to :program:`mongod` instances using one
of three types of connections. The following sub-document reports
the total number of connections by type.

.. stats:: createdByType.master

:stats:`createdByType.master` reports the total number of
connections to the :term:`primary` member in each :term:`shard
cluster`.

.. stats:: createdByType.set

:stats:`createdByType.set` reports the total number of
connections to a :term:`replica set` member.

.. stats:: createdByType.sync

:stats:`createdByType.sync` reports the total number of
:term:`config database` connections.

.. stats:: totalAvailable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That are in the pools, available for use. Does not include connections that are currently being used as those are not in the pool.

:stats:`totalAvailable` reports the running total of connections
from the :program:`mongos` or :program:`mongod` to all :program:`mongod` instances in
the :term:`shard cluster` available for use. This value does not
reflect those connections that

.. stats:: totalCreated

:stats:`totalCreated` reports the total number of connections ever
created from the :program:`mongos` or :program:`mongod` to all :program:`mongod`
instances in the :term:`shard cluster`.

.. stats:: numDBClientConnection

:stats:`numDBClientConnection` reports the total number of
connections from the :program:`mongos` or :program:`mongod` to all of the :program:`mongod`
instances in the :term:`shard cluster`.

.. stats:: numAScopedConnection

:stats:`numAScopedConnection` reports the number of exception safe
connections created from :program:`mongos` or :program:`mongod` to all :program:`mongod`
in the :term:`shard cluster`. The :program:`mongos` or :program:`mongod` releases these
connections after receiving a socket exception from the
:program:`mongod`.