[JAVA-193] perf slowdown when slaveOk() is set on the DB or Query object and then performing cursor.itcount() Created: 18/Oct/10 Updated: 29/Oct/10 Resolved: 20/Oct/10 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Performance |
| Affects Version/s: | 2.2 |
| Fix Version/s: | 2.3 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Alvin Richards (Inactive) | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Problem: cur = coll.find(query).limit(20).addOption(Bytes.QUERYOPTION_SLAVEOK); and then performing count = cur.itcount() Without SlaveOk() With SlaveOk() Reproduce:
Business Case:
|
| Comments |
| Comment by Joseph Wang [ 22/Oct/10 ] |
|
we see this problem running java 2.2 driver against mongodb-linux-x86_64-1.6.3. |
| Comment by Eliot Horowitz (Inactive) [ 20/Oct/10 ] |
|
Not sure which other case fixed this - but the difference was 2.2 and head |
| Comment by Alvin Richards (Inactive) [ 19/Oct/10 ] |
|
./software/mongodb-osx-x86_64-1.7.1/bin/mongod --fork --dbpath /data/db/db1 --port 27000 --replSet fred/ using 1.7.1 |
| Comment by Eliot Horowitz (Inactive) [ 19/Oct/10 ] |
|
Also what version of mongod |
| Comment by Eliot Horowitz (Inactive) [ 19/Oct/10 ] |
|
That's irrelavent - will find all nods when it starts. How are you starting the mongod? |
| Comment by Alvin Richards (Inactive) [ 19/Oct/10 ] |
|
Looks like you just have a single host as a parameter. Just re-ran "localhost:27000,localhost:27002" scaleout blogs 0 1 Inserting data : "localhost:27000,localhost:27002" scaleout blogs 2 1 Inserting data : |
| Comment by Eliot Horowitz (Inactive) [ 19/Oct/10 ] |
|
Can't seem to reproduce $ javac SlaveTest2.java && java SlaveTest2 localhost:27017 test foo 0 1 |
| Comment by Alvin Richards (Inactive) [ 18/Oct/10 ] |
|
Workaround: cursor.itcount() is really meant for testing purposes only, it iterates through the cursor. If you need a count which takes into account the limit/skip use size(). For the same data, size() gives the following perf numbers Inserting data : |