Wake Up too Slow

We are running a couple of apps on Once the apps are active, the load time is excellent (essentially instant). However, when an app first needs to be awakened from a sleeping state, the load time exceeds 10 seconds, which is problematic. We have evaluated other services like Heroku, where the load time is consistently nearly instant. However, we would ideally like to continue using Is there a way to speed up the wake-up process?

Hi @juka,

When an app is warmed up (not sleeping), the startup times when visiting it are quite fast. However, the amount of time an app takes to respond if it's sleeping is highly dependent on the code you application has as a part of its startup. Do you by chance have any long running tasks in your app's startup code?

Thanks for your fast reply and help, @kyle_hekhuis.

I am not sure whether the particular app I am currently working on is considered to load a lot on startup. It does not load any data sets or similar things. However, it requires loading many R packages and the JavaScript file I wrote for it is rather big (around 500kb, I believe).

However, we observe this behavior across all our apps, even very small ones such as Nonparametric Independence Tests.

I took a look at Nonparametric Independence Tests and made sure it was sleeping first. When I opened it it loaded in 2 seconds on the first load. If you open the developer console and the navigate to the application it will show you how long it took to load.

Screenshot 2024-05-15 at 10.30.01 AM

I also took a look at and made sure that was sleeping as well. The first time I loaded it, it took 24 seconds. I let it sit for a while and go back to sleep before trying it again. The second time I opened it, it opened in 2 seconds. I'm guessing because the JavaScript file was cached in my browser at that point. I'm curious if you see the same behavior, or not?

Yes, that's pretty much the same behavoir. Any advice on how to get the 24 seconds done? The app I am actually working on right now is:

I don't see 24 seconds with that one but sometime >10 when it's sleeping and after clearing the cache

I personally have only made super basic shiny apps, so I'm probably not the best for advice on how to optimize the code and make it faster. However, I did find this blog post on our main site about how to make a shiny app faster: 4 tips to make your Shiny dashboard faster - Posit. Give those tips a try and see if it helps at all!