How does caching work?

Background

There are two parts to Chartio's caching system that work together to ensure your charts are updated as often as you'd like.

1. Cache duration is a Data source setting that determines how long a chart's data is considered "fresh".
2. Dashboard refresh rate determines how often a dashboard will check whether its charts have stale data and update stale charts accordingly.

New queries are only sent to your database when the Dashboard is being viewed, or a Dashboard report is being generated. If no one is viewing the Dashboard and a Dashboard report is not being generated, the charts will not refresh.

Cache duration

Each chart is cached in our system from the first time the chart is created and saved. The cache duration tells our system how long to keep a cached version of a chart before it is considered to be expired.

The cache duration is set on a per-data source basis. The default cache duration is 1 hour, but can be adjusted in the General tab of your data source settings.

If you are experiencing performance issues with your database, it's best to increase the cache duration so new queries are triggered less often.

Dashboard refresh rate

The Dashboard refresh rate refers to how often a dashboard will check whether its charts are displaying an expired cache version. Depending on the Refresh rate selected (Auto, On Load, or Manual), the dashboard will update the charts with whatever exists at that point in the cache. If there are no existing results in the cache, or the cache is expired, then the chart's queries will be executed against the data source and the chart's cache will be updated.

Auto

Dashboard will automatically check its charts for updates at the Refresh Interval.

On Load

Dashboard will check its charts for updates when the dashboard is first loaded, and will not check again.

Manual

Dashboard will not check its charts for updates until chart refresh is manually triggered.

 

Overriding the cache

There are a few ways to manually override the Data source's cache duration.

  • Manually refresh a chart (Chart menu > Refresh Chart Data)
  • Modify your chart's query slightly
  • Manually refresh a dashboard (Dashboard menu > Refresh Data)
  • Clear the data source's cache (Data source settings > Clear Data Source Cache)

Examples

Here are a few examples to illustrate how our caching works.

Data source cache duration: 1 hour
Dashboard refresh rate: 10 mins

Dashboard will check whether any of its charts have an updated cache version every 10 minutes, but the cached charts will only be updated (i.e., new queries sent to the database) once every hour (unless the cache is manually overridden).

Data source cache duration: 30 minutes
Dashboard refresh rate: 1 hour

While the dashboard is open, it will check whether any of its charts have an updated cache version every hour. If any other users load the dashboard between the 1 hour interval, or any viewers manually refresh the browser and the cache is expired, new queries will be triggered and the cache will be updated.

Data source cache duration: 24 hours
Dashboard refresh rate: On load

When a dashboard is opened, it will display the most recent cache result for each chart, and will send new queries for any charts with an expired cache. The dashboard will not refresh at intervals or check for updated cache entries until the browser is manually refreshed or another user opens the dashboard. Unless the cache is manually overridden, new queries will not be sent more than once every 24 hours.