Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-193

perf slowdown when slaveOk() is set on the DB or Query object and then performing cursor.itcount()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.3
    • Affects Version/s: 2.2
    • Component/s: Performance
    • None

      Problem:
      Seeing a large perf difference when the SlaveOk() is set (DB or cursor), e.g.

      cur = coll.find(query).limit(20).addOption(Bytes.QUERYOPTION_SLAVEOK);

      and then performing

      count = cur.itcount()

      Without SlaveOk()
      Inserting data :
      Querying data :
      Queries : 121002
      Rows found : 2420040
      Finished :

      With SlaveOk()
      Inserting data :
      Querying data :
      Queries : 181
      Rows found : 3620
      Finished :

      Reproduce:

      • create a two node replset
      • compile attached java code
        javac -classpath mongo-2.2.jar SlaveTest.java
      • run without SalveOk()
        java -cp mongo-2.2.jar SlaveTest "localhost:27000,localhost:27001" test blogs 0 1
      • run with slaveOk()
        "localhost:27000,localhost:27001,localhost:27002" test blogs 2 1

      Business Case:

      • performance

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: