'Shiny app file upload is substantially slower on different machines

I have a shiny application that takes a file upload, calls a script that processes the uploaded file, and writes 4 csvs as output. The app works but as the title suggests, the file upload takes ~5 seconds on my end, but the intended end user is waiting 40 minutes for the same 32 MB file to upload. How do I reduce this upload time for them?

I am attaching my code, but here are some additional points that may be relevant:

  1. The shiny code, the script it calls, and the file to be uploaded are all on a shared drive.
  2. I am accessing their system through a virtual desktop, while the end user has a company computer.

Thanks in advance.

library(shiny)

source([removed for confidentiality])
# Define UI for dataset viewer app ----
ui <- fluidPage(
  # App title ----
  titlePanel("DFM File Conversion"),
  # Sidebar layout with a input and output definitions ----
  sidebarLayout(
    # Sidebar panel for inputs ----
    sidebarPanel(
      # Input: Selector for choosing dataset ----
      textInput(inputId = "exportname1",
                label = "Credit Detail [003 Record] Output Name",
                value = ""),
      textInput(inputId = "exportname2",
                label = "Location Bank Deposit [013 Record] Output Name",
                value = ""),
      textInput(inputId = "exportname3",
                label = "Batch Summary [025 Record] Output Name",
                value = ""),
      textInput(inputId = "exportname4",
                label = "Rejected Transactions [029 Record] Output Name",
                value = ""),
      fileInput("file1", "Please upload a file")
    ),
    # Main panel for displaying outputs ----
    mainPanel(
      verbatimTextOutput("summary") #shows what files were converted
      ,h3(textOutput("caption"))
      ,tableOutput("view") # shows which records are not present in uploaded file
      ,h3(textOutput("caption2"))
      ,tableOutput("headdf") #shows first 5 rows of uploaded file
    )
  )
)
server <- function(input, output) {
  options(shiny.maxRequestSize=60*1024^2)
  # This reads in the uploaded file from the UI and outputs the first 5 rows
  # Then it uses the export name entered by the user to convert the file
  # using the conversion script.
  output$view <- renderTable({
    req(input$file1)
    df <- read.delim(input$file1$datapath,header = FALSE, stringsAsFactors = FALSE)
    converted <- convertdfm(df, input$exportname1, input$exportname2, input$exportname3, input$exportname4)
    # this populates which records are not present in uploaded data
    return(converted$output)
  })
  # this prints the first 4 rows of the file
  output$headdf <- renderTable({
    req(input$file1)
    df1 <- read.delim(input$file1$datapath,header = FALSE, stringsAsFactors = FALSE)
    head(df1)})
  # this creates the first caption
  output$caption <- renderText({
    req(input$file1)
    print("Checking Input Files for Unavailable Records")
  })
  # this creates the second caption
  output$caption2 <- renderText({
    req(input$file1)
    print("First 5 Rows of Raw Data")
  })
  # this shows what files were converted
  output$summary <- renderPrint({
    req(input$file1)
    if (file.exists(input$exportname1))
    {print("003 Converted")} else 
    {print("003 Not Converted")}
    if (file.exists(input$exportname2))
    {print("013 Converted")} else 
    {print("013 Not Converted")}
    if (file.exists(input$exportname3))
    {print("025 Converted")} else 
    {print("025 Not Converted")}
    if (file.exists(input$exportname4))
    {print("029 Converted")} else 
    {print("029 Not Converted")}
  }
  )
}
# Create Shiny app ----
shinyApp(ui = ui, server = server)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source