-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: 6.3.0-rc0
-
Component/s: Change streams, Query Execution
-
None
-
Query Execution
-
Fully Compatible
-
ALL
-
v6.3
-
-
QE 2023-03-06
-
20
The changes from SERVER-69959 introduced a performance regression starting in 6.3 for change streams opened against a replica set secondary node. Let's assume that the system is completely idle, with no reads or writes being issued by clients. The client opens a $changeStream against the idle system. The client's driver will issue getMore operations against this cursor in a loop in order to watch for changes. The expected behavior is that the thread executing the $changeStream will block on the server side waiting for inserts to the oplog. This thread should use very little CPU, since it waits on a condition variable rather than busy waiting.
The changes from SERVER-69959 appear to have caused the change stream thread to wake up far more often than it should. I added experimental logging to the server which showed that in 6.2, a change stream thread watching a secondary node of an idle system would wake up less than 10 times per second. For the same scenario in 6.3, however, the thread wakes up at least a few orders of magnitude more often. The consequence is that the change stream thread behaves effectively like it is busy waiting rather than blocking and has unreasonably high CPU utilization.
Again, this happens only for change streams opened against secondary nodes, not for change streams opened against primary nodes. I speculate it has something to do with differing behavior between primary and secondary nodes for how we choose which timestamp to read from?
- is related to
-
SERVER-69959 Introduce majority committed point advancement notification mechanism
- Closed
- related to
-
SERVER-74555 Re-introduce majority commit point advancement notification mechanism and use for change streams
- Closed