This is the source code of my Shiny app plotting polygons of more than 350 towns in Taiwan whenever there's any changed input from UI. Values of towns would change every time according to the inputs so there's little opportunity to do leafletProxy
. Yet I am now having performance issues, especially on Shiny Server.
You may try running the app locally. The map would show up in like 10 seconds after the options are changed in UI. However, the deployed app on Google Compute Engine or on shinyapps.io takes so much longer (around 30 seconds) to depict the map, not only when initializing the app, but also every time the inputs are changed. Besides, the Shiny Server is frequently disconnected during computation like this:
When that disconnection happens, /var/log/shiny-server.log
tells me:
[INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
, which has never happened locally.
It doesn't make any sense to me. How is it possible that my laptop is beating servers? My laptop is MacBook Air (Early 2015) with just 1.6 GHz Intel Core i5 and 8 GB 1600 MHz DDR3, whereas the VM on Google Compute Engine performs so badly even when it has 4 vCPU and 15 GB RAM.
How can I possibly find out the reasons of worse performances on Shiny Server, or refactor my codes?
Can be related: Leaflet R performance issues with large map