R Shiny Plotly - slow loading on VPN

Viewed 289

I am developing a shiny app on a private server, mostly by following this helpful guide: https://www.charlesbordet.com/en/guide-shiny-aws/#4-deploy-the-app-on-the-server

Very briefly, my app reads in a datafile and creates scatter plots that the user can interact with plotly.

On my private server, the app works normally on some internet connections (in my area, mediacom) and with other internet connections (in my area CenturyLink) - the app is ~50 times slower. The connection is also incredibly slow if I am connected to the Cisco AnyConnect VPN (which is provided through my University) (my private non-CISCO VPN works without problems). Locally and on my public shiny apps io page, the app works great on any internet connection.

I have traced the problem to my interactive plots with plotly. If I make all my plots non-interactive (eg ggplots), the app loads maybe a fraction slower but functionally works great regardless of internet connection.

I came across this post (Disconnected from the (shiny) server: cause of large Plotly R heatmaps) that had a similar error. Like this frustrated user, I also had a disconnect error (only when on the cisco VPN or century link internet, but not the mediacom internet). I followed this thread https://github.com/rstudio/shiny-server/pull/264 and added the following lines to my config file

http_keepalive_timeout 220;
sockjs_disconnect_delay 200;
disable_websockets;

Which solved the disconnect, but made datasets load INCREDIBLY slowly (again, loading was fast while off the VPN on my mediacom internet).

I have tried tinkering with the shiny-server config file (https://docs.rstudio.com/shiny-server/#sockjs_heartbeat_delay) to disable polling, streaming, and websockets without success.

Although creating a reproducible example is hard for this instance, I created a very simple example using simulated data and hosted it on shinyapps.io (https://piroh.shinyapps.io/shiny_plotly_several_datasets) (ignore the red error message on start up and simply select a randomly generated dataset of various sizes from the dropdown on the left). On shiny apps IO, this app loads equally fast regardless of my internet connection or VPN. On my private server, this app loads very fast on mediacom internet and is incredibly slow on centurylink internet/the cisco VPN. Again, this speed issue resolves if I replace the plotly plots with ggplots.

Thank you in advance for the help.

0 Answers
Related