Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14455

Investigate changes in SERVER-43617: Add metrics on the mongos to indicate the number of shards targeted for the commands (find, aggregate, etc)

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.3, 4.0.25, 4.2.15
    • Component/s: manual, Server
    • Labels:
      None
    • Last comment by Customer:
      true
    • Story Points:
      4
    • Sprint:
      ServerDocs2021: Sep14 - Sep21

      Description

      Description

      Downstream Change Summary

      A new field 'shardingStatistics.numHostsTargeted' was added to the output of the serverStatus command in order to indicate the number of shards targeted for CRUD ops and the aggregation command. Each time either a CRUD op or agg command is run, these metrics are incremented. The new field looks like:

      "numHostsTargeted" : {
          "find" : {
                  "allShards" : NumberLong(<num>),
                  "manyShards" : NumberLong(<num>),
                  "oneShard" : NumberLong(<num>),
                  "unsharded" : NumberLong(<num>)
          },
          "insert" : {
                  "allShards" : NumberLong(<num>),
                  "manyShards" : NumberLong(<num>),
                  "oneShard" : NumberLong(<num>),
                  "unsharded" : NumberLong(<num>)
          },
          "update" : {
                  "allShards" : NumberLong(<num>),
                  "manyShards" : NumberLong(<num>),
                  "oneShard" : NumberLong(<num>),
                  "unsharded" : NumberLong(<num>)
          },
          "delete" : {
                  "allShards" : NumberLong(<num>),
                  "manyShards" : NumberLong(<num>),
                  "oneShard" : NumberLong(<num>),
                  "unsharded" : NumberLong(<num>)
          },
          "aggregate" : {
                  "allShards" : NumberLong(<num>),
                  "manyShards" : NumberLong(<num>),
                  "oneShard" : NumberLong(<num>),
                  "unsharded" : NumberLong(<num>)
          },
      }
      

      allShards - all shards were targeted for a command
      manyShards - more than one shard was targeted for a command
      oneShard - only one shard was targeted for a command
      unsharded - the collection the command was run on is unsharded

      Description of Linked Ticket

      Currently the mongos collects the opcounter metrics etc, with which we can get an idea on the incoming operations to the mongos. The mongos dispatch the operations to the shards:

      • If the operation only targets one shard, then the mongos only needs to dispatch it to one shard.
      • However, if the operation is a scatter-gather operation or targets a sub set of shards, then the mongos would need to dispatch the operation to multiple shards. In this case, the mongos is doing more work for such operation than the targeted operation, and there would be more load on the mongos.

      Currently we have added a metric to indicate the amount of sharded updates done with only _id in query (SERVER-41184). It would be nice to expose the number of shards targeted for the operations (find, aggregate, etc), so that we can have some insight on the number of outgoing operations from the mongos, to understand the (outgoing) workload on the mongos.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ian.fogelman Ian Fogelman
              Reporter:
              backlog-server-pm Backlog - Core Eng Program Management Team
              Participants:
              Last commenter:
              Ian Fogelman Ian Fogelman
              Docs Reviewer:
              Dave Cuthbert Dave Cuthbert
              External Reviewer:
              Janna Golden
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                1 week ago
                Date of 1st Reply: