I have a Shiny app which uses two mysql queries to retrieve data and the app works well when run from RStudio. (one of the queries is taking around 8 minutes)
But when I move it on a Shiny Server and access http://ip/myapp/, the page it's loading for a while and the I get "Problem loading page"
.
I assume it's because the long query. Is there some good way to deal with this situation, when long queries have to be made from Shiny app?
-- (running locally app.R
from RStudio, works fine)
Info about the app:
Location: /srv/shiny-server/myapp
Filename: app.r
File structure:
-- load libraries
library(shiny)
...
-- Connection and queries
con <- dbConnect(MySQL(), user = '#', password = '#', host = '#', dbname='#') tickets<-dbGetQuery(con, "Select * from table") dbDisconnect (con) con <- dbConnect(MySQL(), user = '#', password = '#', host = '#', dbname='#') -- long query issues_speed_unique<-unique(na.omit(dbGetQuery(con,"Select * from table2"))) dbDisconnect (con) some aggregations....
-- Server code
shinyServer( function(input,output){ ...
-- ui code
shinyUI(fluidPage( ... shinyApp(ui = ui, server = server)