Hi, I'm writing to seek help on the issues in R shiny in relation to long running process. My codes involve running several simulations which takes about 1 min to run. It runs well in R console, however, when i run it in the Shiny app, the app just keeps dropping offline at about 20 seconds of running and asks to reload the page. Here is the app that we developed:https://glasgowhehta.shinyapps.io/MetaInsight_continuous_Bayesian/
(Apologies, due to the nature of the issue we could not think how to give a simple example.)
If you click the ‘Data analysis’ tab - ‘3. Bayesian network meta-analysis’ tab - ‘3d. Nodesplit model’ tab, then click the button ‘Click here to run the main analysis for all studies’, it will drop the app offline before generating results (but this will take nowhere near as long as it would take for the server to disconnect due to user inactivity). The programme behind this button is a series of simulation evaluations using JAGS (which uses Gibbs Sampling and is computationally intensive and can produce a lot of data https://en.wikipedia.org/wiki/Just_another_Gibbs_sampler).
When only a small number of simulations are required, results could be rendered, however, when a larger number of simulations are required, the app will drop offline. You could test this by ticking some studies out from the sidebar, say ticking all the studies from ‘Kuo 2006’ down until ‘Derosa 2005’, which will result in only a small proportion of the data entering the ‘nodesplitting analysis with studies excluded’. After ticking these studies out, click the button on the right hand side, ‘Click here to run the nodesplitting analysis with studies excluded’, then the results should be rendered.
So our questions are:
Why does the app drop offline when the background computations are more extensive (i.e. is it a memory or a time issue or another altogether)?
What can be done to get round this problem (we have tinkered with the server settings but without success)?
We were able to resolve this on a support ticket - the solution was, as @andresrcs suggested, to increase the memory available on the application instances.
We don't have anything built into shinyapps.io to check how much memory a process needs, but it's possible through a number of different methods, such as using profiling.