Skip to content

Commit cdd06e0

Browse files
authored
DOCS-14455 Add references for numHosts targeted in shardingStatistics (#5847)
* DOCS-14455 Add references for numHosts targeted in shardingStatistics * DOCS-14455 Add references for numHosts targeted in shardingStatistics
1 parent b49a22b commit cdd06e0

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
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-2
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,39 @@ shardingStatistics
24352435
.. code-block:: javascript
24362436

24372437
"shardingStatistics" : {
2438+
"numHostsTargeted": {
2439+
"find" : {
2440+
"allShards": NumberLong(<num>),
2441+
"manyShards": NumberLong(<num>),
2442+
"oneShard": NumberLong(<num>),
2443+
"unsharded": NumberLong(<num>)
2444+
},
2445+
"insert": {
2446+
"allShards": NumberLong(<num>),
2447+
"manyShards": NumberLong(<num>),
2448+
"oneShard": NumberLong(<num>),
2449+
"unsharded": NumberLong(<num>)
2450+
},
2451+
"update": {
2452+
"allShards": NumberLong(<num>),
2453+
"manyShards": NumberLong(<num>),
2454+
"oneShard": NumberLong(<num>),
2455+
"unsharded": NumberLong(<num>)
2456+
},
2457+
"delete": {
2458+
"allShards": NumberLong(<num>),
2459+
"manyShards": NumberLong(<num>),
2460+
"oneShard": NumberLong(<num>),
2461+
"unsharded": NumberLong(<num>)
2462+
},
2463+
"aggregate": {
2464+
"allShards": NumberLong(<num>),
2465+
"manyShards": NumberLong(<num>),
2466+
"oneShard": NumberLong(<num>),
2467+
"unsharded": NumberLong(<num>)
2468+
}
2469+
}
2470+
},
24382471
"catalogCache" : {
24392472
"numDatabaseEntries" : NumberLong(<num>),
24402473
"numCollectionEntries" : NumberLong(<num>),
@@ -2709,8 +2742,29 @@ shardingStatistics
27092742
Only present when run on a :binary:`~bin.mongos`.
27102743

27112744
.. versionadded:: 4.2.7
2712-
2713-
.. _server-status-sharded-index-consistency:
2745+
2746+
.. serverstatus:: shardingStatistics.numHostsTargeted
2747+
2748+
Indicates the number of shards targeted for ``CRUD`` operations and
2749+
aggregation commands. When a ``CRUD`` operation or aggregation
2750+
command is run, the following metrics will be incremented.
2751+
2752+
.. include:: /includes/fact-server-status-num-hosts-targeted.rst
2753+
2754+
.. note::
2755+
2756+
Running the :dbcommand:`serverStatus` command on :binary:`mongos`
2757+
will provide insight into the CRUD and aggregation operations that
2758+
run on a sharded cluster.
2759+
2760+
Multi-shard operations can either be
2761+
:ref:`scatter-gather<sharding-query-patterns>`
2762+
or shard specific. Multi-shard scatter-gather operations can
2763+
:ref:`consume more resources<sharding-troubleshooting-scatter-gather>`.
2764+
By using the
2765+
:serverstatus:`shardingStatistics.numHostsTargeted`
2766+
metrics you can tune the aggregation queries that run on a
2767+
sharded cluster.
27142768

27152769
shardedIndexConsistency
27162770
~~~~~~~~~~~~~~~~~~~~~~~

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)