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

Investigate NODE-3748 - find().stream() 4x performance regression between 3.7.3 and 4.1.4

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 3
    • Not Needed

      NODE-3748 Description
      Testing mongodb 4.1.4 I seem to have found a performance regression for a simple collection.find().stream() operation and node pipeline.

       

      Testing was preformed using docker contains based on mongo:latest and node:latest on  a linux host.

      Running Mongo 5.0.3 with Mongodb client 3.7.3 pulling 918843 documents and writing them to disk took 15 seconds. The Exact same code with the 4.1.4 driver took 49 seconds to perform the same task.

      C:\Development\YADAMU\scratch\mongodb\streamsTest>docker build -t mongo/stream .
      Sending build context to Docker daemon 5.632kB
      Step 1/5 : FROM node:latest
       ---> 7220633f01cd
      Step 2/5 : WORKDIR /tmp
       ---> Using cache
       ---> 134cee2526fb
      Step 3/5 : COPY package*.json .
       ---> Using cache
       ---> f1b720b32b3b
      Step 4/5 : COPY streamTest.js .
       ---> 1c170cf59b33
      Step 5/5 : RUN npm install
       ---> Running in 726c82fcce25
      
      added 19 packages, and audited 20 packages in 1s
      
      1 package is looking for funding
       run `npm fund` for details
      
      found 0 vulnerabilities
      npm notice
      npm notice New patch version of npm available! 8.1.0 -> 8.1.3
      npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.3>
      npm notice Run `npm install -g npm@8.1.3` to update!
      npm notice
      Removing intermediate container 726c82fcce25
       ---> 29293e5fe90d
      Successfully built 29293e5fe90d
      Successfully tagged mongo/stream:latest
      SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
      
      Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
      
      C:\Development\YADAMU\scratch\mongodb\streamsTest>docker run -it --entrypoint node --network YADAMU-NET -e "MONGO_HOSTNAME=MONGO50-01" -e "MONGO_DATABASE=SH" -e "MONGO_COLLECTION_NAME=SALES" -e "MONGO_TARGET_FILE=/tmp/output.txt" mongo/stream streamTest.js
      Mongo Server 5.0.3 Client 3.7.3
      Start Pipeline: 2021-11-05T04:53:53.275Z
      Start Pipeline: 2021-11-05T04:54:08.221Z 14945.559738993645 918843
      Done
      
      C:\Development\YADAMU\scratch\mongodb\streamsTest>docker build -t mongo/stream .
      Sending build context to Docker daemon 5.632kB
      Step 1/5 : FROM node:latest
       ---> 7220633f01cd
      Step 2/5 : WORKDIR /tmp
       ---> Using cache
       ---> 134cee2526fb
      Step 3/5 : COPY package*.json .
       ---> a2a4efc0069e
      Step 4/5 : COPY streamTest.js .
       ---> 12d1f12cc600
      Step 5/5 : RUN npm install
       ---> Running in f908d5543762
      
      added 17 packages, and audited 18 packages in 1s
      
      3 packages are looking for funding
       run `npm fund` for details
      
      found 0 vulnerabilities
      npm notice
      npm notice New patch version of npm available! 8.1.0 -> 8.1.3
      npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.3>
      npm notice Run `npm install -g npm@8.1.3` to update!
      npm notice
      Removing intermediate container f908d5543762
       ---> dfb724fe97eb
      Successfully built dfb724fe97eb
      Successfully tagged mongo/stream:latest
      SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
      
      Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
      
      C:\Development\YADAMU\scratch\mongodb\streamsTest>docker run -it --entrypoint node --network YADAMU-NET -e "MONGO_HOSTNAME=MONGO50-01" -e "MONGO_DATABASE=SH" -e "MONGO_COLLECTION_NAME=SALES" -e "MONGO_TARGET_FILE=/tmp/output.txt" mongo/stream streamTest.js
      Mongo Server 5.0.3 Client 4.1.4
      Start Pipeline: 2021-11-05T04:54:44.666Z
      Start Pipeline: 2021-11-05T04:55:34.092Z 49424.850908994675 918843
      Done
      
      C:\Development\YADAMU\scratch\mongodb\streamsTest>
      

       

       

       

       

        1. dockerfile
          0.1 kB
          PM Bot
        2. package.json
          0.1 kB
          PM Bot
        3. streamTest.js
          2 kB
          PM Bot

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: