[SERVER-60718] Access of sub-fields is slow in SBE queries Created: 14/Oct/21 Updated: 27/Oct/23 Resolved: 26/Sep/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Mihai Andrei |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | pm2697-m3, sbe | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Sprint: | QE 2022-10-03 | ||||||||
| Participants: | |||||||||
| Story Points: | 0 | ||||||||
| Description |
|
Summary: accessing a sub-field is ~20-30% slower in SBE compared to the classical engine.
Create a collection with 10^6 documents like this: { a: Random.randInt(10), e: { x: Random.randInt(10)}} Let the collection's namespace be "sbe-perf.LS", run against it the following benchmark:
results: "queryLatencyAverageMicros" : 678104.625, The results of the benchmark in classical engine are: "queryLatencyAverageMicros" : 481276, The top CPU consumers in SBE mode: + 23.49% mongod [.] mongo::sbe::vm::ByteCode::runInternal The generated plan:
Flamegraph is attached. |
| Comments |
| Comment by David Storch [ 26/Sep/22 ] | ||||||
|
Cool, thanks for confirming! | ||||||
| Comment by Mihai Andrei [ 26/Sep/22 ] | ||||||
|
That's right Dave; we more or less have coverage for the case covered in this ticket: https://github.com/mongodb/mongo-perf/blob/bfb260f9680b7e61ab21aecdfc5152220c20f8ea/testcases/simple_query.js#L897-L907 | ||||||
| Comment by David Storch [ 26/Sep/22 ] | ||||||
|
mihai.andrei@mongodb.com that's great news, thanks for looking into it! My only question is whether we should add a benchmark like this to our perf testing environment. We have the following tests with the "match_dotted_path" tag:
If I understand correctly, we don't need to add a benchmark because this is quite similar to the Queries.PointQuerySubField* tests. Is that right? | ||||||
| Comment by Kyle Suarez [ 21/Sep/22 ] | ||||||
|
Assigning to david.storch@mongodb.com to verify that traverseF()-ification has improved this performance. CC mihai.andrei@mongodb.com, andrew.paroski@mongodb.com | ||||||
| Comment by Kyle Suarez [ 22/Oct/21 ] | ||||||
|
ethan.zhang, eric.cox and irina.yatsenko, we are sending these SBE performance issues to the $group epic. Let us know if you think it belongs in a separate project. |