fileInput is slow in Shiny

Hello all,

I am trying to understand why it takes 20-30 seconds to upload my csv file using Shiny. The file is 20 MB. I tried using read.csv and fread -- both takes > 20 seconds.

Here are the codes. Any advide is greatly appreciated.

ui.R

shiny::fluidPage(title = "Hello",
                 shiny::navbarPage("Input", id = "allResults",
                                   shiny::tabPanel(value = 'inputData', title = 'Data Import',
                                                   br(),
                                                   
                                                   h4("Import data"),
                                                   
                                                   shiny::fileInput(inputId = "inFile", "Choose a CSV File",
                                                                    accept = c(
                                                                      "text/csv",
                                                                      "text/comma-separated-values,text/plain",
                                                                      ".csv"
                                                                    )
                                                   ),
                                                   
                                                   shiny::checkboxInput("header", "Header", TRUE)
                                   )
                 )
)

server.R

options(shiny.maxRequestSize = 5*1024^3)

function(input, output, session) {  
  rawdata <- shiny::eventReactive (input$inFile, {    
    rdata <- read.csv(input$inFile$datapath, header=input$header, sep=",")
    #rdata <- data.table::fread(input$inFile$datapath, header=input$header, sep=",", data.table = F)
  })
}

I wonder if the shiny.maxRequestSize option is what causing the long upload time. Notice that I increased the default file limit of 5MB by using options(shiny.maxRequestSize = ...). Have anyone experienced a long upload time after increasing this limit?

Being tracked in "Upload Complete" (fileInput) takes a long time in Shiny

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.