-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
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