[SERVER-23259] Report planSummary in per-operation diagnostic log message and profiler for all relevant ops/commands Created: 21/Mar/16  Updated: 13/Oct/18  Resolved: 02/May/16

Status: Closed
Project: Core Server
Component/s: Diagnostics, Querying
Affects Version/s: 3.3.3
Fix Version/s: 3.3.6

Type: Improvement Priority: Major - P3
Reporter: James Wahlin Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File flame_graph.svg    
Issue Links:
Backports
Depends
is depended on by SERVER-23272 Remove misleading/not useful diagnost... Closed
Duplicate
is duplicated by SERVER-15102 dbCurrentOp should show used index Closed
is duplicated by SERVER-16847 Diagnostic log output for all query c... Closed
is duplicated by SERVER-21470 Add index usage information to getmor... Closed
Related
Backwards Compatibility: Minor Change
Backport Requested:
v3.2
Sprint: Query 14 (05/13/16)
Participants:
Linked BF Score: 0

 Description   

Ops/commands that are missing this information:

  1. distinct command
  2. getMore command
  3. findAndModify command
  4. geoNear command
  5. group command
  6. getMore operation
  7. delete command
  8. update command
  9. aggregate command
  10. delete operation
  11. update operation

Additional notes:

  • planSummary will be visible in db.currentOp() as soon as plan selection completes (this is currently only available for legacy OP_QUERY reads).
  • planSummary will be added as a new field to profiler entries.


 Comments   
Comment by James Wahlin [ 02/May/16 ]

No documentation changes needed as planSummary is already documented for currentOp: https://docs.mongodb.org/manual/reference/method/db.currentOp/#currentOp.planSummary

Comment by James Wahlin [ 02/May/16 ]

Attaching flame graph that shows perf output at commit 66c992d under the following process:

  1. Insert 100K documents, with default _id and field 'a', where the value for 'a' is a unique integer value
  2. Create index for 'a'
  3. Start 4 shells, each performing a findOne() on 'a' for an existing value, in a tight loop
  4. Run perf record -q --call-graph fp -p `pidof mongod` for 1 minute and kill

As per this chart, cost for a fast operation (in-memory find with exact index match) is roughly 1.5%. It will be less for more expensive operations.

We are not going to make performance improvements under this ticket but will review overall performance at the end of the 3.3 development cycle. If we were to optimize planSummary generation it could be done via:

  1. Making string construction cheaper.
  2. Avoid generating flattening the execution tree (or share flattened tree with getSummaryStats() call).
Comment by James Wahlin [ 26/Apr/16 ]

Changes committed for this ticket. Work remaining is to profile and address any significant regressions if found.

Comment by Githook User [ 26/Apr/16 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-23259 Report planSummary in diagnostic log and profiler
Branch: master
https://github.com/mongodb/mongo/commit/66c992d4b93f0c9e0fbe400ccf95344ec9437823

Generated at Thu Feb 08 04:02:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.