Try to set Oplog

Hello,

We have a meteor app in production (wekan if someone knows), and since few days, we have performances problems. We updated our app in the last release (from meteor 1.6 and mongo 3.6 to meteor 1.8 and mogo 4.0.11).
The app works with Docker (4 replicas for the app and 1 for the db). When we inspect their stats, we can see cpu overload and a large amount of data extracted from the db !
We first thought that the problem came from indexes, but there are created and used. After searching, we found that Meteor can perform two actions for subscriptions. The poll and diff and seeing the oplog. First, we would like to know if enable the oplog will improve the situation? Then, how we can do it because all our tries failed.

Regards

Enabling the oplog alone will help in some scenarios (e.g., to avoid poll and diff) - and doing that alone will be sufficient if you have read heavy workloads. However, if you have write heavy workloads, or write things in batches, then all of your servers will observe all the changes, and this can cause its own performance problems.

For this reason, redis-oplog is the preferred option, however it requires that you run another container with redis in it. Servers subscribe to redis streams to observe specific queries. Also, if you modify data in mongo from outside of Meteor, you’d need to manually notify redis.

For setting up the Oplog with Meteor, you should just need to provide a valid MONGO_OPLOG_URL, however - if you’re only running a single Mongo instance (which you really shouldn’t be) then Mongo internally may not have an oplog enabled - since it’s an internal protocol designed for mongo to sync data between servers in a mongo replica set.

To enable mongo’s oplog within mongo, you need to start your standalone with the replicaset option, then initiate the replica set.

https://groups.google.com/forum/embed/#!topic/mongodb-user/1KHftCfnx2c

Thanks, it helped lot!