Hello,
I’m having trouble with using large datasets in Dash. My app workflow is like so:
- User inputs a filename for a dataset
- This data gets loaded and stored into dcc.Store. An image of summary statistics of the data then gets calculated and displayed
- When the user clicks on a specific portion of the summary image, “local” summary statistics are re-calculated (which require the original dataset), and new figures are displayed in a neighboring plot
The files that get loaded are generally on the order of gigabytes. The issue is that when (3) occurs, the retrieval of the stored data takes too long and impacts the interactivity of the app (it will take >10 seconds for the app to retrieve the stored data and then subsequently calculate local summary statistics and replot). Pre-calculating the local summary statistics in (3) is out of the question because there are too many options for where a user could possibly click, and moreover, the user-selected field-of-view in the (2) summary image is also taken into account. In short, the calculations from (3) must be done on the fly and cannot be pre-stored.
I’ve narrowed the bottleneck down to being the retrieval of the data in dcc.Store, since when I hard-code the file upload and load the data as global variables, the speed of (3) is not an issue.
I’ve tried to use server side caching and also have implemented the dash_extension.enrich library so that the data in dcc.Store do not have to be switched into json format; I store them directly as dictionaries. However it seems like the dash_extensions.callback library from the server side caching solution and the dash_extension.enrich library (which allows dictionary storage) are not part of the same dash_extensions version, which means they cannot be used simultaneously. Moreover, I am still not completely sure if the solution posed in server side caching will even solve my issue, since I have not yet had a chance to completely implement it due to the aforementioned incompatibility.
Any suggestions or feedback would be greatly appreciated. Thank you so much in advance!