Will shinyproxy solve the concurrency issue I am facing?

I would appreciate help in understanding something relating to multiple users on the same shiny app at one time, and whether shinyproxy can solve my issue.

Suppose the following shiny app:

library(shiny)

shinyApp(
  ui = pageWithSidebar(
  headerPanel("actionButton test"),
  sidebarPanel(
    numericInput("n", "N:", min = 0, max = 100, value = 50),
    br(),
    actionButton("goButton", "Go!"),
    p("Click the button to update the value displayed in the main panel.")
  ),
  mainPanel(
    verbatimTextOutput("nText")
  )
),
  server = function(input, output) {
    
    ntext <- eventReactive(input$goButton, {

      ## SLEEP for 10 seconds after every submit
      Sys.sleep(10)
      
      input$n
    })
    
    output$nText <- renderText({
      ntext()
    })
  }
)

I am simulating a “long running” process with the Sys.sleep function. What I notice is that when I run this shiny app, if I click submit and then open a new window to that shiny app, the new window will not load until the first one has finished (e.g. after 10 seconds).

Can I deploy this shiny app with shinyproxy and avoid this problem where user 2 waits for user 1’s calculation to finish before anything happens?

Thank you in advance

The answer is yes, you can. Shinyproxy uses a separate docker container for each user, one user’s long-running task will not affect another user.

There is also another solution to your problem. You can use promises library to run async tasks. However, this is currently still under development, you might need to install a shiny version that is compatible with promises.

Thanks for the quick response! Super helpful.