[SERVER-55601] Improve performance of Queries.CoveredBlockingSort in SBE Created: 29/Mar/21  Updated: 29/Oct/23  Resolved: 21/May/21

Status: Closed
Project: Core Server
Component/s: Query Execution
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Ian Boros Assignee: Nikita Lapkov (Inactive)
Resolution: Fixed Votes: 0
Labels: post-rc0, sbe-post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-48634 [SBE] Add a version of IndexBoundsChe... Backlog
related to SERVER-48485 [SBE] Use KeyString directly when sta... Backlog
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Query Execution 2021-05-03, Query Execution 2021-05-17, Query Execution 2021-05-31
Participants:

 Description   

There are a few things we can do to improve the performance of this workload:

1) Eliminate the repeated allocations done in the CheckBoundsStage::getNext() here. We can instead hold a buffer in the stage and re-use that each call to toBson().

2) Skip the allocation done in IndexBoundsBuilder::checkKey() (there's already a TODO about this)

3) WTIndexCursorBase::nextKeyString() makes a copy of the key string which requires allocating. We could instead keep a buffer up front in the IXscan stage and then pass a pointer to it. This would be a bit invasive, but it's worth trying to see how much benefit there is.



 Comments   
Comment by Githook User [ 24/May/21 ]

Author:

{'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}

Message: SERVER-55601 Improve performance of Queries.CoveredBlockingSort benchmark in SBE

(cherry picked from commit c35c11a7aa7fd7c585268d05204cdb00efbb1852)
Branch: v5.0
https://github.com/mongodb/mongo/commit/fd52ab20494c1e767c3f2e824bba80f69fb4a566

Comment by Githook User [ 21/May/21 ]

Author:

{'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}

Message: SERVER-55601 Improve performance of Queries.CoveredBlockingSort benchmark in SBE
Branch: master
https://github.com/mongodb/mongo/commit/c35c11a7aa7fd7c585268d05204cdb00efbb1852

Comment by Anton Korshunov [ 30/Mar/21 ]

Some more ideas to consider are in SERVER-48634 and SERVER-48485.

Comment by Ian Boros [ 29/Mar/21 ]

In the future we'll also want to eliminate calls to getField() when generating the sort key. See here.

Currently we generate plans like:

project [s5 = fillEmpty(getField(s1, "y"), null)]
mkbson s1 [x = s2, y = s3]

This call to getField() is just wasted work since "y" is already in s3 and there's no need to walk serialized BSON looking for it. This would probably have to be done as some sort of broader "tracking" mechanism which I believe is already in the works by the folks working on the AST.

Generated at Thu Feb 08 05:36:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.