There are many reasons why a shiny app runs slower than expected. The most common reason is the Shiny app code has not been optimized. You can use the profvis package to help you understand how R spends its time. You also might want to make sure your server is large enough to host your apps. Both RStudio Connect and Shiny Server Pro have tools that will allow you to support a large number of apps and users.
Here is a list of items to consider when checking your Shiny app performance.
Application performance
- Check your Shiny application code. Have you optimized your code for performance? Consider using profvis and the Shiny admin dashboard [pro].
- Reduce start up times. How long does it take to initialize an application? Consider increasing the application timeout (app_idle_timeout) so apps stay loaded in memory.
Server performance
- [Pro] Adjust scaling and performance in Shiny Server Pro. How many connections are sharing the same R process? Use the admin dashboard to evaluate; then make adjustments in the utilization scheduler.
- Increase your server size. Do you have enough memory and compute? Use the admin dashboard [pro] to evaluate latency; then increase your server size if necessary.
- Reduce server contention. Are you sharing the server with other services (e.g., RStudio Workbench, RStudio Server Open Source, proxy servers, or web servers)? If possible dedicate a single server instance to Shiny Server.
Network performance
- Check your network speeds. Are you getting different performance results from home, office, or VPN? Check your network dashboards.
- Check your data center performance. Have there been any issues with your NOC or cloud provider? Check your system dashboards.
- Check your databases. Are your databases performing and are they transferring data reliably? Check your database dashboards and network connections.
For more information on performance tuning of Shiny applications, see scaling and performance in Shiny Server Pro. For an example of profiling a shiny app, see profvis Shiny examples.
Comments