Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86606

Refactor Scan stage to improve performance

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution

      Refactor ScanStage stage to improve performance.

      Suggested changes:

      • Split ScanStage into SeekStage, ScanStage and RandomScanStage. Those operations are mutually exclusive. Splitting the stages will reduce the method sizes and reduce the amount branching on the hotpath.
      • Remove unnecessary virtual calls from IndexScan stage. If code sharing between Scan stage variants is desired a templates can be used for methods that would need to otherwise call virtual methods.
      • Refactor code and branching so that open and getNext have minimal size. All expensive/optional operatations can be extracted to separate methods to discourage inlining of code that is often skipped.
      • Encourage inlining of small methods on the hot path.
      • Reduce frequency of calling into YieldPolicy, at minimum we should be able to gate the yield checks behind the counter even if yield policy is present.

       A POC here https://github.com/10gen/mongo/compare/anna.wawrzyniak/SERVER-85623?expand=1 demonstrates the above changes and possible performance improvement (see SERVER-85623)

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            anna.wawrzyniak@mongodb.com Anna Wawrzyniak
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: