Updated Jan 2024:
Cache is one of the most confusing things on Tableau server. The blog is trying to answer the following questions:
- How Tableau server cache works?
- What are the server settings to control cache expiration?
- Would cache be refreshed after extract refresh?
- Does cache work for both live connections and extracts the same way?
- Is it possible that I can set server to have different cache policy for live connections and extracts?
- Is it possible to have customized cache policy for specific workbooks or data sources?
- How Tableau server cache works?
Cache stores earlier computation data so that future requests for that data can be served faster. From server scalability and view performance perspective, the more cache server holds, the better. The longer cache server holds, the better. However on the other side, when the query hits cache, it also means that users are not getting the latest data from data source (extract or live connection).
You may say that an interactor can always click refresh button to by-pass the cache. However we can’t expect interactors to click twice for everyone view….. So it is important to set the cache correctly to balance the performance and freshness of the data.
2. What are the server settings to control cache?
There are 2 settings to control the behavior of server cache
1) The most important setting is overall server data cache setting that applies to whole server.
tsm data-access caching set -r <value>
Where <value> is one of these options:
- low. This is the default and configures Tableau Server to cache and reuse data for as long as possible.
- <n>. “<n>” specifies the maximum number of minutes data should be cached.
- always or 0 (zero). These values indicates that the cache should be refreshed each time a page is reloaded. This is the default value if no value is specified
Apply changes with the tsm pending-changes apply command. This will restart Tableau Server.
2) The 2ndsetting is site specific“Workbook Performance after a Scheduled Refresh” – Pre-compute workbooks viewed recently.
When you turn on this feature, you can also increase or decrease the number of workbooks that are cached after a scheduled refresh with the following tsm configuration set option:
backgrounder.externalquerycachewarmup.view_threshold
By default, the threshold is set to 2.0. The threshold is equal to the number of views that a workbook has received in the past seven days divided by the number of refreshes scheduled in the next seven days. (If a workbook has not been viewed in the past seven days, it is unlikely that it will be viewed soon, so Tableau Server does not spend resources recomputing queries for the workbook.)
3. How to configure server cache?
- Step 1: Turn on ‘Pre-compute workbooks viewed recently’ , then monitor overall server view render time and also monitor server memory over a period of time (like a week or a few weeks)
- Step 2: If render time has no improvement and memory is not too high, you can increase more workbook for cache warning by changing Backgrounder.Externalquerycachewarmup.View_Threshold to 1 and monitor again
- Step 3: Increase number of minutes data should be cached and then continue to monitor server view render time and server memory. On my server, I did not see render time impact till change number of minutes data should be cached to 360+ minutes. If your server does not have live connections and most extracts run daily, cache holds 24 hrs or longer could be a good setting. However some live connection workbooks may have stale data problem with 24 hrs caches.
4. How to set server to have different cache policy for live connections and extracts?
I had to hack it in the past but Tableau has out of the box feature to allow content owner to set Live Connection workbook cache policy at each workbook level.
To edit a workbook data freshness policy, you must be the workbook owner, and the workbook must have a live connection to the data source.
- Sign in to a site on Tableau Cloud or Tableau Server.
- From the Home or Explore page, navigate to the workbook you want to set a policy for.
- Click the details icon .
- From the Workbook Details dialog, click Edit Data Freshness Policy.
- Choose one of the following options:
Site default (12 hours)
Always live (Tableau will always get the latest data)
Ensure data is fresh every
Ensure data is fresh at - Click OK.
Leveraging server cache is critical to scale Tableau in large server platform. It is tricky to get cache rights but you will be greatly rewarded when you see overall view render time improved 30+% when get your server cache setting right.
Read additional notes @ Automation – How to make some workbook cache shorter than others
Do you know if putting something non-deterministic (e.g. current date-time) on the view/dashboard prevent server from using the cache?
David, I do not think so…
“The threshold is equal to the number of views that a workbook has received in the past seven days divided by the number of refreshes scheduled in the next seven days.” Is that views by that user or views by any user?
The views of every user on the server
All users. Sorry for late reply
How do we increase external cache retention time to 24 hours? I can’t seem to find the property to do so. Using Server v2020.1.2
https://help.tableau.com/current/server/en-us/config_cache.htm