I have a shiny app that opens with almost no UI elements and is waiting for a user to upload a file before it starts doing anything reactive. It is very quick when run locally on my computer but takes ~10s on Connect which users find to be slow. Once a session spins up, it loads almost instantly but most users experience the 10s delay.
Unfortunately, I cannot share the code here, but it is <300 lines of code and all of the reactive logic is waiting under observevent(input$file, ...).
This originally started as a quarto doc and the runtimes were even worse. What might cause it to run so much slower on Connect? What can I look into to speed things up?
Without more information, it’s hard to diagnose exactly what might be causing the slower startup times for your application. That being said, here are some avenues you could explore:
If you don’t want your users to experience the initial load time for your application, you can modify the process configuration settings for your application and set “Min processes” to some number greater than zero. This will keep the content process running, and no user will incur that initial startup cost.
This does mean that the server won’t shut down the content process, which will be inefficient if the app isn’t accessed frequently - so there is a bit of a trade-off.
There may also be architectural reasons why content could be slower to startup. For example, if your connect server is running on Kubernetes, there is an additional cost which launching content processes which can contribute to startup times across the board.