[SERVER-65657] Reduce calls to the cappedInsertNotifier for the oplog Created: 14/Apr/22 Updated: 29/Oct/23 Resolved: 02/Jun/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.0.1, 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matthew Russotto | Assignee: | Matthew Russotto |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Backport Requested: |
v6.0, v5.3, v5.0
|
||||||||||||||||||||
| Sprint: | Repl 2022-04-18, Repl 2022-05-02, Repl 2022-05-16, Repl 2022-05-30, Repl 2022-06-13 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||
| Description |
|
When oplog visibility is in effect, there is no need to signal the oplog notifier on every insert; since the newly-inserted data isn't visible, any read threads will wake up, find no new data, and go back to sleep. Further, we also signal the oplog notifier when we move lastApplied. This is only necessary when we could be reading at lastApplied, which is only on secondaries (on primaries, the lastAppliedSnapshot may contain holes and is invalid). Thus we only need to signal at the end of a secondary applier batch, not at every lastApplied update. Notifying a condition variable is surprisingly expensive on Linux. If the condition variable is not being waited on, there's an uncontended mutex acquire and release (for condition_variable_any) and the signal itself; this is a few atomic operations. But if it is being waited on, there is system call overhead (futex_wake). |
| Comments |
| Comment by Githook User [ 01/Jun/22 ] |
|
Author: {'name': 'Matthew Russotto', 'email': 'matthew.russotto@mongodb.com', 'username': 'mtrussotto'}Message: |