Preferred use of dcc.Store / other options for larger data sets

In our app we query relatively large time-series datasets. After we’ve received the data we store it in a dcc.Store object because the data are shared for a few read-only callbacks.

We get an error along the lines of “Server took too long to respond” and then our app crashes without updating the callbacks that rely on the data. This only happens with a set of queries that we know are requesting relatively large (>50MB) data responses.

My assumption is that the data are taking too long to be sent over the wire to the client to be stored and processed. Are there common best practices to solve this problem? I’ve read the following posts:

but neither have a satisfying answer (ServerSideOutput seems like a possible candidate but I don’t see an explanation of when specifically I ought to use it.)

Any guidance would be immensely appreciated!

A note: the problem doesn’t arise when we run the Dash server locally, only when we’re interacting with it deployed.

The serverside output is one possible approach. You can use it whenever you don’t need to send all data to the client, i.e. your use case seems like a good match. Interacting with a cache directly is another.

Good afternoon, everyone. I have same problem. I have good speed load on my localhost but slowly on a server. Data volume is small (3mb). I save my data in storages. Then I request them in the course of my work. As a result, the query rate is over 10 seconds. Please pay attention to this or suggest how to solve this problem. If not using dcc.Store, what? Please give me a hint.

Hello @Sank95,

It really depends on how you are interacting… you could use a dcc.Store if you can leverage clientside callbacks instead of sending that info to the server.

This would be if the data is coming from the client.

If from the server, you can use the serverside cache as well. Or, you could have a background callback that populates the dcc.Store one time and then all the clientside callbacks trigger and manipulate the data.

Why does the computation take longer than the network?