🚀 Meteor 3.5 is out: Change Streams & Performance improvements

I opened an issue with production evidence from our 3.5-rc.1 rollout:

Short version: after moving to 3.5-rc.1, we saw a significant method/publication latency regression in production. Pinning Mongo reactivity back to ["oplog", "polling"] and restoring MONGO_OPLOG_URL brought latency back to normal. The issue includes Monti APM before/after data, MongoDB currentOp/profiler evidence, and our follow-up investigation plan.

cc @italojs @nachocodoner

3 Likes

Another one that could be helpful to check if you are testing Change Streams with MONGO_OPLOG_URL still present: Meteor 3.5-rc.1: Change Streams did not appear to activate until MONGO_OPLOG_URL was removed · Issue #14454 · meteor/meteor · GitHub

3 Likes

A public reproduction repo is now available at quavedev/meteor-changestream-fanout-repro. It reproduces the Change Streams fanout shape with many distinct publication selectors observing the same hot collection.

cc @nachocodoner @italojs

1 Like

My 2 cents in the issue Meteor 3.5-rc.1 Change Streams caused production method/pub latency regression; pinning to oplog/polling restored normal performance · Issue #14453 · meteor/meteor · GitHub
(Doens’t see your repro app @filipenevola before posting mine but nvm :+1: )

2 Likes

DX comment: it would be nice to be able to simply use oplog instead of CS in development (and CS in production). I already run multiple local MongoDB servers for multiple projects and doing replica sets would be a nightmare.

1 Like

Has anyone managed to deploy 3.5 with MUP?!

Oplog requires a replicatset too, if you run a standalone mongo intance locally, it should to try use CS → fallback to oplog → fallback to pooling
isnt it hapenning for you?

I haven’t set this and when I started my project I got a lot of errors related to the replica set in the server console and my M5 Macbook Pro started to ventilate like crazy.

But when you set it up, does it work well? Does this happen with every project or just a specific one?

I only tried it in one project so far. However, I can manage it now from the settings.json files (one for dev and one for production).
I have this in development mode and nothing in production.

"packages": {
    "mongo": {
      "reactivity": [
        "oplog",
        "polling"
      ]
    }
  }

hmmmm for that settings.json you shoudnt use changeStream, only oplog or polling
can you share a reproducible repo, please? I would to check it before next release

@paulishca @italojs I dug into the standalone case — it’s not the fanout (#14453), it’s the replica-set detection.

mongo_connection.js gates Change Streams on Boolean(isMaster.setName || isMaster.ismaster || isMaster.secondary). But isMaster.ismaster is true on a standalone too (it just means the node accepts writes), so a standalone is misdetected as a replica set → Change Streams selected → collection.watch() fails with The $changeStream stage is only supported on replica sets (40573) → the driver retries forever, flooding the log and spiking CPU (that’s the fan, @paulishca). No fallback to oplog/polling.

Only hits a standalone mongod — meteor’s built-in dev mongo is a single-node replica set, so it doesn’t show there; you need an external standalone via MONGO_URL.

Repro (floods within seconds): https://github.com/dupontbertrand/meteor-3.5-changestream-bug · One-line fix: https://github.com/meteor/meteor/pull/14468
Workaround: pin {"packages":{"mongo":{"reactivity":["oplog","polling"]}}}, or use a replica set.

Meteor 3.5-rc.2 is out! :rocket:

We’ve just released Meteor 3.5-rc.2, the second release candidate for Meteor 3.5. This RC includes several important fixes and improvements to the change streams implementation introduced in rc.1.

To update your app:


meteor update --release 3.5-rc.2


What’s new in rc.2

Fixes

  • Fixed change-stream observer dropping documents matched by ObjectID selectors — a BSON type mismatch at the selector boundary was silently losing documents. (#14461)

  • Fixed change streams being incorrectly selected on standalone MongoDB instances, which caused a 40573 restart loop. (#14468)

  • Fixed a DDP write fence left waiting indefinitely after a change-stream observer was stopped. (#14457)

  • Fixed a race condition in Accounts HttpOnly cookie login that could leave a session unauthenticated. (#14469)

Improvements

  • One MongoDB change stream per collection — previously, each subscription created its own change stream cursor; now all subscriptions on the same collection share a single stream, significantly reducing server-side resource usage. (#14456)

  • Change-stream documents are now translated once per path instead of once per observer, reducing redundant EJSON work under concurrent subscriptions. (#14471)

  • Removed legacy isMeteorPre144 shim and semver dependency from babel-compiler — dead code for Meteor versions before 1.4.4 (released in 2017). (#14382)


Please help us test

This is a release candidate — your feedback is critical before we ship the official release. If you run into any issues, please open a report at github.com/meteor/meteor/issues.

Special thanks :sparkles:

A huge thank you to everyone who contributed to Meteor 3.5, including this RC:

@italojs, @nachocodoner, @dupontbertrand, @mvogttech, @harryadel, @Grubba27, @StorytellerCZ, @vlasky, @9Morello, @alextaaa, @OleksandrChekhovskyi, @Eshaan-byte, @radekmie

Your work makes Meteor better for everyone. :pray:

11 Likes

Cool. Any ideas on when this will get to release stage?

The release wil come soon as possible, but first we should wait the community test is enougth, after a few weeks withtout any bug report we can do a officla release :wink:

btw, to speed up this process, please, help us testing it in production :smiley:

1 Like

Has anyone got changeStreams uws working with multitenancy ?

I still use oplog sockjs.

This example I did (pr) didnt work for you? can you bring us more detail about what is happening?

Meteor 3.5 is out :partying_face: (1st topic post updated)

8 Likes