[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) Created: 13/May/21  Updated: 13/Nov/23  Resolved: 20/Sep/21

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.3.3, 4.0.25, 4.2.15, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Ian Fogelman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: HTML File mongos_serverStatus    
Issue Links:
Backports
backported by DOCS-14456 [BACKPORT] [v4.0] Add metrics on the ... Closed
backported by DOCS-14558 [BACKPORT] [v4.2] Add metrics on the ... Closed
Documented
documents SERVER-43617 Add metrics on the mongos to indicate... Closed
Participants:
Days since reply: 2 years, 20 weeks, 2 days ago
Epic Link: DOCSP-15042
Story Points: 4

 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.)



 Comments   
Comment by Githook User [ 20/Sep/21 ]

Author:

{'name': 'ianf-mongodb', 'email': '85948430+ianf-mongodb@users.noreply.github.com', 'username': 'ianf-mongodb'}

Message: DOCS-14455 Add references for numHosts targeted in shardingStatistics (#5847)

  • DOCS-14455 Add references for numHosts targeted in shardingStatistics
Comment by Githook User [ 20/Sep/21 ]

Author:

{'name': 'ian fogelman', 'email': 'ian.fogelman@mongodb.com', 'username': 'ianf-mongodb'}

Message: DOCS-14455 Add references for numHosts targeted in shardingStatistics
Branch: v5.0
https://github.com/mongodb/docs/commit/b790429dc799d58ca6c5abeb3f8f1dd6362dcad7

Comment by Githook User [ 20/Sep/21 ]

Author:

{'name': 'ian fogelman', 'email': 'ian.fogelman@mongodb.com', 'username': 'ianf-mongodb'}

Message: DOCS-14455 Add references for numHosts targeted in shardingStatistics
Branch: v5.0
https://github.com/mongodb/docs/commit/9d77215772f217483f61d4c7ee459e0c74bb4151

Comment by Githook User [ 20/Sep/21 ]

Author:

{'name': 'ian fogelman', 'email': 'ian.fogelman@mongodb.com', 'username': 'ianf-mongodb'}

Message: DOCS-14455 Add references for numHosts targeted in shardingStatistics
Branch: master
https://github.com/mongodb/docs/commit/d28c39726ce035cac87d10a7fd18508019e9116e

Comment by Ian Fogelman [ 25/Aug/21 ]

Currently waiting on https://jira.mongodb.org/browse/DOP-2421 for some background on the serverStatus page. Links are not working correctly so linking from the release notes to numHosts is a bit confusing currently.

Generated at Thu Feb 08 08:10:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.