Skip to content

Commit d28c397

Browse files
ianf-mongodbjeff-allen-mongo
authored andcommitted
DOCS-14455 Add references for numHosts targeted in shardingStatistics
1 parent a171f29 commit d28c397

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:widths: 20 40
4+
5+
* - Name
6+
- Description
7+
8+
* - ``allShards``
9+
- A command targeted all shards
10+
11+
* - ``manyShards``
12+
- A command targeted more than one shard
13+
14+
* - ``oneShard``
15+
- A command targeted one shard
16+
17+
* - ``unsharded``
18+
- A command was run on an unsharded collection

source/reference/command/serverStatus.txt

+56
Original file line numberDiff line numberDiff line change
@@ -2774,6 +2774,39 @@ shardingStatistics
27742774
.. code-block:: javascript
27752775

27762776
"shardingStatistics" : {
2777+
"numHostsTargeted": {
2778+
"find" : {
2779+
"allShards": NumberLong(<num>),
2780+
"manyShards": NumberLong(<num>),
2781+
"oneShard": NumberLong(<num>),
2782+
"unsharded": NumberLong(<num>)
2783+
},
2784+
"insert": {
2785+
"allShards": NumberLong(<num>),
2786+
"manyShards": NumberLong(<num>),
2787+
"oneShard": NumberLong(<num>),
2788+
"unsharded": NumberLong(<num>)
2789+
},
2790+
"update": {
2791+
"allShards": NumberLong(<num>),
2792+
"manyShards": NumberLong(<num>),
2793+
"oneShard": NumberLong(<num>),
2794+
"unsharded": NumberLong(<num>)
2795+
},
2796+
"delete": {
2797+
"allShards": NumberLong(<num>),
2798+
"manyShards": NumberLong(<num>),
2799+
"oneShard": NumberLong(<num>),
2800+
"unsharded": NumberLong(<num>)
2801+
},
2802+
"aggregate": {
2803+
"allShards": NumberLong(<num>),
2804+
"manyShards": NumberLong(<num>),
2805+
"oneShard": NumberLong(<num>),
2806+
"unsharded": NumberLong(<num>)
2807+
}
2808+
}
2809+
},
27772810
"catalogCache" : {
27782811
"numDatabaseEntries" : NumberLong(<num>),
27792812
"numCollectionEntries" : NumberLong(<num>),
@@ -3364,6 +3397,29 @@ shardingStatistics
33643397

33653398
.. versionadded:: 5.0
33663399

3400+
.. serverstatus:: shardingStatistics.numHostsTargeted
3401+
3402+
Indicates the number of shards targeted for ``CRUD`` operations and
3403+
aggregation commands. When a ``CRUD`` operation or aggregation
3404+
command is run, the following metrics will be incremented.
3405+
3406+
.. include:: /includes/fact-server-status-num-hosts-targeted.rst
3407+
3408+
.. note::
3409+
3410+
Running the :dbcommand:`serverStatus` command on :binary:`mongos`
3411+
will provide insight into the CRUD and aggregation operations that
3412+
run on a sharded cluster.
3413+
3414+
Multi-shard operations can either be
3415+
:ref:`scatter-gather<sharding-query-patterns>`
3416+
or shard specific. Multi-shard scatter-gather operations can
3417+
:ref:`consume more resources<sharding-troubleshooting-scatter-gather>`.
3418+
By using the
3419+
:serverstatus:`shardingStatistics.numHostsTargeted`
3420+
metrics you can tune the aggregation queries that run on a
3421+
sharded cluster.
3422+
33673423
.. serverstatus:: shardingStatistics.resharding.coordinatorState
33683424

33693425
State of the resharding coordinator for the current :ref:`resharding

source/release-notes/4.4.txt

+10
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,16 @@ output:
19151915
- :serverstatus:`shardedIndexConsistency`
19161916
- :serverstatus:`shardingStatistics.rangeDeleterTasks`
19171917
- :serverstatus:`shardingStatistics.unfinishedMigrationFromPreviousPrimary`
1918+
- :serverstatus:`shardingStatistics.numHostsTargeted`
1919+
1920+
``serverStatus`` Sharding Statistics Output Change
1921+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1922+
1923+
:serverstatus:`shardingStatistics.numHostsTargeted`
1924+
which reports the number of shards targeted by CRUD operations and
1925+
aggregation commands. The relevant find, insert, update, delete or
1926+
aggregate metric will be incremented with each operation on a
1927+
cluster.
19181928

19191929
``replSetGetStatus`` Output Change
19201930
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)