Where to store your Shiny application data

Follow

If your Shiny app requires data to run, you can bundle the data with your app or you can reference the data inside your app. Shiny Server does not require a database. Instead it will work with your existing setup.

Most likely, your data are stored in a local file or in a database. (This article does not cover external data sources found on the Internet through API calls.) Here are some common approaches on where to store your Shiny application data:

File bundled with your Shiny application

This approach works for small, static data files. (Note: you can store data in a flat file format like CSV or in a single file database like SQLite.)

Benefits: It's easy and high performant since everything is in one place and located on the server.

Drawbacks: It's hard to update the data when changes occur.

File on a shared fileserver

This approach works for slightly larger files. (Note: you can store data in a flat file format like CSV or in a single file database like SQLite.)

Benefits: You don't have to deploy your data with your app, you can merely link to it. You can refresh your data snapshots off cycle (e.g. at night) so that your apps update automatically.

Drawbacks: Reading from NAS can be slow, decreasing app performance and you add complexity to the app.

Existing data warehouse

This approach keeps your data in place and preserves the integrity of your data at the source.

Benefits: You can don't have to snapshot or duplicate your data, and your apps can update immediately to the current state.

Drawbacks: Your app is significantly more complicated, you have to get permission to connect an app server to your data warehouse, your app queries might run slowly or with a low priority, and your data could change in undesirable ways.

Data mart dedicated to apps

The approach gives you a high performance database that sits between the data warehouse and the Shiny application. You get the benefits of the a data warehouse without the drawbacks.

Benefits: Store only what you need in rollups and look up tables. Apps can be tuned for performance and run at a high priority. App data can be dynamically updated.

Drawbacks: Additional cost and complexity to your application stack. Someone has to maintain the data mart.

 

Comments