Shiny JS dependency load performance and best practices


There are quite a few articles on improving performance of Shiny backend, but I could not find any that address bottlenecks in network.

My app loads quite a few js files and the inital load time is quite long (~20 seconds on average), although the total size is just a couple of megabytes. Profiling app with profvis confirmed that backend takes about 2 seconds to execute (it also runs fast on a local machine), so the bottleneck is indeed in network.

I have noticed that dependencies are loaded sequentially, there's no caching and everything is reloaded every time. On backend most of the dependencies are using htmltools::htmlDependency to load.
Is there any way to optimize that? Could anyone share their best practices to address this issue?

This thread might be of interest, specifically Joe's tip about using a CDN to speed up js files


Ah, I actually saw this topic in search results, but did not go inside, thinking this is irrelevant. Well, the problem has its own topic now. Much appreciated!

1 Like