I have a meteor app running on heroku and until last week the database was running on mlab. Then I switched to MongoDB Atlas and after a few days the application was running very slow. I upgraded from M2 to M5, so it was ok, but now it is very slow again. It seems there is a network out limitation, but with mlab there wasn't.
Could it be a problem with the queries or what am I doing wrong, what do I have to consider?
Does anybody know about this issue or have experience with meteor/heroku/mongodb-atlas combination?
Thanks in advance
In Heroku, when you picked up the MLab service, the DB was provided most probably in the same VPC with your Meteor instance. I'd first make sure I run an Atlas MongoDB in the same region and service provider as Heroku. (e.g. both Meteor and Mongo run on AWS eu-central). Did you do this? https://www.mongodb.com/blog/post/integrating-mongodb-atlas-with-heroku-private-spaces
Do you exceed the limitations for your Mongo cluster? https://docs.atlas.mongodb.com/reference/atlas-limits/ This is important to avoid paying for a service scale that you don't need.
Monti APM (https://montiapm.com/) has a free monitoring service for Meteor for 8 hours retention. That can help you with understanding your Oplog transactions and volume.
I don't know how you set up your Oplog but you may also try this (older) Mongo URI. I still use this with the latest Meteor version and I am fine with it:
"env": {
"MONGO_URL": "mongodb://yourapp:XXXXXXXXXXXXXXXX@yourapp-shard-00-00-zc1lg.mongodb.net:27017,yourapp-shard-00-01-zc1lg.mongodb.net:27017,yourapp-shard-00-02-zc1lg.mongodb.net:27017/meteor?ssl=true&replicaSet=yourapp-shard-0&authSource=admin",
"MONGO_OPLOG_URL": "mongodb://yourapp-oplog:XXXXXXXXXXXXXXXX@yourapp-shard-00-00-zc1lg.mongodb.net:27017,yourapp-shard-00-01-zc1lg.mongodb.net:27017,yourapp-shard-00-02-zc1lg.mongodb.net:27017/local?authSource=admin&ssl=true&replicaSet=Yourapp-shard-0"
}