diff --git a/source/includes/fact-server-status-num-hosts-targeted.rst b/source/includes/fact-server-status-num-hosts-targeted.rst new file mode 100644 index 00000000000..8f675b436ea --- /dev/null +++ b/source/includes/fact-server-status-num-hosts-targeted.rst @@ -0,0 +1,18 @@ +.. list-table:: + :header-rows: 1 + :widths: 20 40 + + * - Name + - Description + + * - ``allShards`` + - A command targeted all shards + + * - ``manyShards`` + - A command targeted more than one shard + + * - ``oneShard`` + - A command targeted one shard + + * - ``unsharded`` + - A command was run on an unsharded collection \ No newline at end of file diff --git a/source/reference/command/serverStatus.txt b/source/reference/command/serverStatus.txt index d06bc7e4671..5222147e02a 100644 --- a/source/reference/command/serverStatus.txt +++ b/source/reference/command/serverStatus.txt @@ -2774,6 +2774,39 @@ shardingStatistics .. code-block:: javascript "shardingStatistics" : { + "numHostsTargeted": { + "find" : { + "allShards": NumberLong(), + "manyShards": NumberLong(), + "oneShard": NumberLong(), + "unsharded": NumberLong() + }, + "insert": { + "allShards": NumberLong(), + "manyShards": NumberLong(), + "oneShard": NumberLong(), + "unsharded": NumberLong() + }, + "update": { + "allShards": NumberLong(), + "manyShards": NumberLong(), + "oneShard": NumberLong(), + "unsharded": NumberLong() + }, + "delete": { + "allShards": NumberLong(), + "manyShards": NumberLong(), + "oneShard": NumberLong(), + "unsharded": NumberLong() + }, + "aggregate": { + "allShards": NumberLong(), + "manyShards": NumberLong(), + "oneShard": NumberLong(), + "unsharded": NumberLong() + } + } + }, "catalogCache" : { "numDatabaseEntries" : NumberLong(), "numCollectionEntries" : NumberLong(), @@ -3364,6 +3397,29 @@ shardingStatistics .. versionadded:: 5.0 +.. serverstatus:: shardingStatistics.numHostsTargeted + + Indicates the number of shards targeted for ``CRUD`` operations and + aggregation commands. When a ``CRUD`` operation or aggregation + command is run, the following metrics will be incremented. + + .. include:: /includes/fact-server-status-num-hosts-targeted.rst + + .. note:: + + Running the :dbcommand:`serverStatus` command on :binary:`mongos` + will provide insight into the CRUD and aggregation operations that + run on a sharded cluster. + + Multi-shard operations can either be + :ref:`scatter-gather` + or shard specific. Multi-shard scatter-gather operations can + :ref:`consume more resources`. + By using the + :serverstatus:`shardingStatistics.numHostsTargeted` + metrics you can tune the aggregation queries that run on a + sharded cluster. + .. serverstatus:: shardingStatistics.resharding.coordinatorState State of the resharding coordinator for the current :ref:`resharding diff --git a/source/release-notes/4.4.txt b/source/release-notes/4.4.txt index 0081e3b3a54..12b6fda9298 100644 --- a/source/release-notes/4.4.txt +++ b/source/release-notes/4.4.txt @@ -1915,6 +1915,16 @@ output: - :serverstatus:`shardedIndexConsistency` - :serverstatus:`shardingStatistics.rangeDeleterTasks` - :serverstatus:`shardingStatistics.unfinishedMigrationFromPreviousPrimary` + - :serverstatus:`shardingStatistics.numHostsTargeted` + +``serverStatus`` Sharding Statistics Output Change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:serverstatus:`shardingStatistics.numHostsTargeted` +which reports the number of shards targeted by CRUD operations and +aggregation commands. The relevant find, insert, update, delete or +aggregate metric will be incremented with each operation on a +cluster. ``replSetGetStatus`` Output Change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~