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

MongoDB reads are not balance with 2 members selected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.6.0, 4.7.0, 4.8.0, 4.8.1
    • 4.10.0
    • None
    • 2
    • Not Needed

    Description

      What problem are you facing?

      When using Node.js driver versions >4.6.x in a configuration with readPreference: nearest and readPreferenceTags resulting in 2 eligible members to read from, the reads are unbalanced between the two members.

      For example if there are 1000 queries/second in total, in drivers version <4.6.x, the first members gets ~500 queries/second and second members gets ~500 queries/second. In versions >4.6.x, the second member always is preferred, getting ~750 queries/second where the first member only gets the ~250 queries/second.

      The issue seems to fix when there are 3 or more members eligible, the queries and load on all members becomes balanced.

      What driver and relevant dependency versions are you using?

      Node.js driver >4.6.x

      Steps to reproduce?

      Create a Mongo cluster setup with tags. From Node.js driver select only 2 members using readPreferenceTags and readPreference: nearest.

      Attachments

        1. Screenshot 2022-08-18 at 11.00.39.png
          Screenshot 2022-08-18 at 11.00.39.png
          173 kB
        2. Screenshot 2022-08-18 at 11.01.16.png
          Screenshot 2022-08-18 at 11.01.16.png
          188 kB
        3. Screenshot 2022-08-18 at 11.01.58.png
          Screenshot 2022-08-18 at 11.01.58.png
          257 kB
        4. three-secondaries-selected-qps.png
          three-secondaries-selected-qps.png
          256 kB
        5. two-secondaries-selected-qps.png
          two-secondaries-selected-qps.png
          272 kB

        Issue Links

          Activity

            People

              neal.beeken@mongodb.com Neal Beeken
              cezar.manea29@gmail.com Cezar Manea
              Neal Beeken
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: