Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6295

More than 2x perf regression for cursor iteration in 6.8.0

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.8.0
    • Component/s: Cursors, Performance
    • 5
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Use Case

      As a... Node.js driver user
      I expect... the performance to remain roughly the same between releases
      So that... I get a consistent responsive experience

      Reproduction

      https://mongodb.slack.com/archives/C03MPA2FY6S/p1721991547262229

      import { MongoClient } from 'mongodb';
      
      const client = await MongoClient.connect('mongodb://localhost/');
      const cursor = client.db('test').aggregate([ { $documents: [{}] }, { $set: { field: { $reduce: {input: [...Array(20).keys()], initialValue: [0], in: { $concatArrays: ['$$value', '$$value'] } } } } }, { $unwind: '$field' }, { $limit: 1_000_000 } ]);
      await cursor.toArray()
      await client.close();
      

      (run with time node test.js).

      User Impact

      • Cursor iteration is unexpectedly slower

      Dependencies

      • Cursors, On Demand BSON, Driver Benchmarks

      Unknowns

      • What is the main bottleneck introduced?
      • What is the remedy to the regression?

      Acceptance Criteria

      Investigation Requirements

      • Investigate performance before and after the identified regression commit
        • Collect flamegraphs and cpuprofiles for comparing
        • Present a theory and suggested patch to the major bottleneck(s)

      Implementation Requirements

      • TBD, See above.

      Testing Requirements

      • Investigate the performance alerting system. Did our benchmarks identify this and not warn us? Are we missing a certain kind of benchmark to identify this?

      Documentation Requirements

      • None

      Follow Up Requirements

      • None

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: