Change Streams limitations on MongoDB ATLAS

Hi all,

Currently on our deployments we are using change streams mongoDB feature to be notified of modification of some collections.
In few words our application is design as following:

  • A process called “P1” that post into database a list of tasks (into a collection named “C1”),
  • A second process called “P2” which subscribes to change into this collection C1 to deploy additional processes called “PT(x)” which will have to perform the task
  • Each “PT(x)” process opens 2 change streams to be notified of any modification on the task configuration and its status.
    The P1 process also opens a change stream on the “C1” collection to be notified of any modification on any task.
    All of these change streams are concerning the same collection, but as I can have lot of PT(x) processes in parallel, the total number of change streams can be important.

We plan to use MongoDB Atlas to deploy our application in public cloud. So, I wonder about the limitation described in the page

  1. Does this page describe a global limitation about Change Streams on MongoDB Atlas or is it specific to Realm?
  2. Will I encounter limitations on number of change streams using Atlas compared to local native deployment of Mongo?

Thanks in advance for your help
Best Regards

HI @Jacques , there is no limitation on the number of change streams if you open them directly on MongoDB Atlas (without Realm Sync or Triggers). However high number of change streams may lead to high resource consumption. In MongoDB 5.1 there is an optimization that allows for more efficient execution of the distinct change streams.

1 Like

This looks like something that you might want to consider kafka (or any message queue) to dispatch one single C1 change stream to many kafka consumer.