[SERVER-13139] Performance regression with smaller $in queries Created: 11/Mar/14  Updated: 11/Jul/16  Resolved: 13/Mar/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.6.0-rc1
Fix Version/s: 2.6.0-rc2

Type: Bug Priority: Major - P3
Reporter: Ben Becker Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File in_query.cpp     File in_query_100.svg    
Issue Links:
Duplicate
duplicates SERVER-12952 Regex query performance regression in... Closed
Related
is related to SERVER-13100 Large $in queries are several orders ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

100-element $in queries appear to be an order of magnitude slower in v2.6.0-rc1 (even with lower_bound patch) than in v2.4.9:

Using the attached code:

v2.4.9:

ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 17
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 7
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 6
Doc count: 10000

RC1:

ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 101
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 82
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 104
Doc count: 10000

RC1 with binary search

ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 103
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 63
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 88
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 102
Doc count: 10000

RC1 with lower_bound:

ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 89
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 37
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 40
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 72
Doc count: 10000



 Comments   
Comment by Githook User [ 13/Mar/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-13139 lazily fill in index scan specific stats
Branch: v2.6
https://github.com/mongodb/mongo/commit/4233257f59e59b09579eac705e312fb0096a0b1e

Comment by Githook User [ 13/Mar/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-13139 replaced index descriptor field with key pattern to eliminate dependency on index catalog
Branch: v2.6
https://github.com/mongodb/mongo/commit/fa53389976b4b4871c53b3212765406f8eb0d0c0

Comment by Githook User [ 13/Mar/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-13139 lazily fill in index scan specific stats
Branch: master
https://github.com/mongodb/mongo/commit/d64b7ee82217d2ac2d22a40d36961453ab8648f3

Comment by Githook User [ 13/Mar/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-13139 replaced index descriptor field with key pattern to eliminate dependency on index catalog
Branch: master
https://github.com/mongodb/mongo/commit/6ffc04f3f264542114bb1f7c645b899a761deced

Comment by Ben Becker [ 11/Mar/14 ]

in_query_100.svg contains 10 consecutive executions of the attached script against current master (097f38faf2856f7776c75a48d985b6b3f1641860) with the lower_bound patch included.

ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 110
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 91
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 93
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 105
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 106
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 106
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 104
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 107
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 104
Doc count: 10000
ben@zzyzx:~/projects/mongo-utils/build$ ./in_query localhost:27017 100
Total query time in miliseconds: 106
Doc count: 10000

Generated at Thu Feb 08 03:30:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.