How does caching work?

Dashboards

Background

There are two parts to Chartio’s caching system that work together to ensure your charts are updated at your preferred interval.

  1. Cache duration is a dashboard setting that determines how long a chart’s data is considered “fresh”.
  2. Refresh rate is a dashboard setting that 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 opened (if using auto refresh) is being viewed, or when a dashboard report or snapshot is being generated. If none of these criteria are met, new queries are NOT sent from your dashboard to your database.

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-dashboard basis. The default cache duration is one hour, but can be adjusted in your dashboard settings. Note: Only dashboard admins may adjust the cache duration.

If you are experiencing performance issues with your database, consider increasing the cache duration on popular dashboards so new queries are triggered less frequently.

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, Smart, 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(s) and the chart’s cache will be updated.

Auto

Dashboard will automatically check its charts for updates at the Refresh Interval while the dashboard is open.

Smart

Dashboard will automatically check its charts for updates at the Refresh Interval while the dashboard is being viewed. New queries will not be triggered if the dashboard is open but is in an inactive (not currently in view) browser tab.

On Load

Dashboard will check its charts for updates when the dashboard is first loaded by a user, 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 dashboard cache duration:

  • Manually refresh a chart (Chart menu > Refresh Chart Data).
  • Modify your chart’s query and re-run the query.
  • Manually refresh a dashboard (Dashboard menu > Refresh Data).

Examples

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

Cache duration: 1 hour

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).

Cache duration: 30 minutes

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.

Cache duration: 24 hours

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.


Related Dashboards Help Articles

See more