[SERVER-71968] Investigate impact of invariants and tasserts on performance Created: 08/Dec/22 Updated: 29/Oct/23 Resolved: 09/Mar/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Mihai Andrei | Assignee: | Ivan Fefer |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | pm2697-m3 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query Execution
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | QE 2022-12-12, QE 2022-12-26, QE 2023-01-09, QE 2023-01-23, QE 2023-02-06, QE 2023-02-20, QE 2023-03-06, QE 2023-03-20 | ||||||||
| Participants: | |||||||||
| Story Points: | 5 | ||||||||
| Description |
|
This ticket tracks the work to investigate whether invariants/tasserts slow down SBE plan execution and if so, figuring out how to mitigate their impact. |
| Comments |
| Comment by Ivan Fefer [ 09/Mar/23 ] |
|
There are some ~5% performance gains to be found in replacing tasserts and invariants with dasserts, but given that this may lead to undefined behavior in production and there are other performance improvements to be done, I think this change is not worth it in my opinion. I am closing this ticket. |
| Comment by Githook User [ 10/Feb/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Ivan Fefer [ 09/Feb/23 ] |
|
There is also an issue with invariants with messages. They pass a lambda that converts an error message into std::string into a function (usually inlined) that does the check. This also triggers stack-protector. We can fix it by replacing the function with a macro, but the problem is that the function template, used in invariant is overloaded for Status and similar objects, which is impossible to do in a macro and will require more work. Given that invariants with messages are pretty rare, I think we can ignore that. |
| Comment by Ivan Fefer [ 09/Feb/23 ] |
|
Fixing triggering stack-protector via tassert gives ~5% performance on different workloads. |
| Comment by Ivan Fefer [ 08/Feb/23 ] |
|
Macro for tassert creates extra local variable, that may lead to introduction of stack protector in functions that otherwise won't have it. |
| Comment by Zixuan Zhuang [ 12/Dec/22 ] |