[SERVER-77364] Speed up OpObservers with a filter framework in OpObserverRegistry Created: 22/May/23  Updated: 12/Dec/23  Resolved: 06/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc4

Type: Improvement Priority: Major - P3
Reporter: Matt Kneiser Assignee: Matt Kneiser
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-77057 Investigate slow down caused by OpObs... Closed
Related
related to SERVER-77927 Profile OpObserver Perf Improvements Closed
related to SERVER-77373 Use OpStateAccumulator's to cache com... Backlog
related to SERVER-84110 Narrow the filtering of PrimaryOnlySe... Closed
is related to SERVER-77057 Investigate slow down caused by OpObs... Closed
Backwards Compatibility: Minor Change
Backport Requested:
v7.0
Sprint: Execution Team 2023-06-12
Participants:

 Description   

Today, CRUD Ops are implemented by nearly all of the ~19 OpObservers.
 
For onUpdate:

  • 4 are too complicated to filter at all and should be called every time
  • 10 could filter on one namespace
  • 1 could filter on two namespaces
  • 1 could filter on three namespaces
  • 1 could filter on four namespaces
  • 1 could filter solely on update.isEmpty

 

onInserts, aboutToDelete, and onDelete are a similar story with similar amounts of namespace filtering.

 

By filtering on namespace in the registry, we can eliminate many unnecessary virtual function calls for each CRUD op in the server.

 

Furthermore, I noticed that all namespace filtering in OpObservers can be fit into three categories:

  • always run (e.g. OpObserverImpl, for logging to oplog and other system-critical functional behavior)
  • observe changes to the internal config database (config.*)
  • observe changes to internal system collections (.system.)

 



 Comments   
Comment by Githook User [ 09/Jun/23 ]

Author:

{'name': 'Matt Kneiser', 'email': 'matt.kneiser@mongodb.com', 'username': 'themattman'}

Message: SERVER-77364 Filter OpObservers for CRUD Operations
Branch: v7.0
https://github.com/mongodb/mongo/commit/ca27b25360314a23648731597158d4b6881b29d2

Comment by Githook User [ 06/Jun/23 ]

Author:

{'name': 'Matt Kneiser', 'email': 'matt.kneiser@mongodb.com', 'username': 'themattman'}

Message: SERVER-77364 Filter OpObservers for CRUD Operations
Branch: master
https://github.com/mongodb/mongo/commit/7f6eac6452a6e6e5739009117cd3b31417a95cac

Generated at Thu Feb 08 06:35:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.