My mean stack connected to mongodb atlas stops working after 30 mins of inactivity

I created a mean stack app connected to atlas cluster and deployed it on render.com.
But 30 mins after I stop working on my mean stack app, the home page takes at least a minute to load.
Once it does load after a minute’s delay, it doesn’t cause a delay anymore, but only as long as I keep working on my app. 30 minutes of inactivity later, the homepage load gets delayed again.

My question is, why is my cluster going into “sleep” mode just because I haven’t used the app in the last 20-30 mins? Is there a setting that always keeps the atlas cluster up and running, without causing home page load delays? Am I missing some configuration?

Hey :wave: @Deepak_KM,

Thank you for reaching out to the MongoDB Community forums!

I suspect that the behavior you’re experiencing might be due to a feature or setting of the hosting platform you are using.

Can you please elaborate on what you meant by “sleep mode” and how are you determining that your cluster is going into “sleep” mode? Are there any error messages or specific indicators you’ve observed?

Best regards,
Kushagra

https://meanstack-foodmine-app.onrender.com/

This is the link to my mean stack app, deployed on render.com.
Let’s say today, If you access this link for the first time, it will take at least a minute just for the home page to load.
After that, for all subsequent accesses, it loads instantly. (FYI, my home page contains data & images that are retrieved from mongodb atlas.).
Then when I’m done using the app and I stop triggering the app (and therefore the mongodb atlas) for like 30 mins or so, I again face the 1 minute delay when I access my app link.

Based on this, I am assuming that this initial delay is happening because my app is unable to acquire that db connection initially, probably because the db went inactive since the last time it was triggered?

I do not see any error messages in console.

I would like to know if there is a setting that keeps the mongodb atlas cluster running all the time. Or is there any resume/pause button somewhere?

I am new to mongodb atlas.

Thanks.