When a dashboard is loaded, many data queries are sent to the Serenytics data engine (one query by widget). Each query is targeted to a given datasource.
The complete flow for a query when a widget needs its data is:
The step that can be long is the step 4: the actual computing to obtain the result of the query.
In the scenario where the data is updated once per day (e.g. each night), without cache, the same query (step 4) will be executed as many times as a widget is drawn (i.e. at each dashboard load or refresh).
If the computation takes 5 seconds, all the viewers will have to wait these 5 seconds. If someone refreshes the dashboard many times a day, he will have to wait these 5 seconds each time.
With the cache activated, when a query needs to be executed (step 4), before actually executing it in the datasource, we check if we already have the result.
The complete query flow with the cache is:
If you're on the tech side, here is a more technical version of the query flow. Skip this part if you just want to know how to setup the cache.
To activate the cache on a datasource, in its configuration page, open the Cache Data field and select the time duration (i.e. the duration a result must be stored in cache).
We strongly recommend that you you choose "until cache invalidation". With this option, the results in cache will be kept until the datasource data is modified, reloaded or until the cache is manually invalidated (see Refresh dashboard cache task below):
For projects where the data is updated once a day, it's a good practice to activate the cache in mode "Until cache invalidation" for each datasource of the project.
When you activate the cache for a dashboard, there is still one issue. For the first viewer of the dashboard, the cache will be empty and the dashboard might be long to load. If your data is updated every night, this happens for the first user opening the dashboard in the morning. He's the first at the office and he's the one who has to wait for the data to show up, that's not fair.
The solution is to pre-load the cache, i.e. simulate the dashboard loading so the cache is already filled. To do that, in the automation menu, create a new Task and select the template "Refresh cache".
In the configuration of this task, select all the dashboards you want to preload. The task will invalidate the cache for all the datasources used in this list of dashboards and then it will preload the cache for all these dashboards. After the execution of this task, you are sure that the dashboard will be very fast to open for the viewers (even for the first one):
The "data queries" in Serenytics are sent to our API "formatted_data". When you reload a dashboard, in the console, all queries will be logged and the "cache=miss" means that the cache was not used for a query: