We are running Change Stream for some time but have started seeing behaviour where the CPU Spikes for long duration of time.
Setup: We are using MongoDB 4.4 version Replica Set, primary and two replicas
12 cpu , 252GB RAM and 2TB data disk each.
and using Python to open a changestream.
pipeline = [{"$addFields": {
"tmpfields": {
"$objectToArray": "$updateDescription.updatedFields"}
}},
{"$match": {"tmpfields.k": {
"$nin": ["updated_at"] if cfg.CONF.is_resource == "True" else [
""]}}}
]
cursor = client[collection].watch(full_document='updateLookup',
pipeline=audit_filter if cfg.CONF.is_audit == "True" else pipeline, start_after=resume_token_new)
App Dynamics
Kindly Assist.