[Meta]: Views caching optimization

Created on 4 March 2024, 3 months ago

Problem/Motivation

Views has a very defensive approach to caching. While this is very safe in terms of preventing overcaching, it also can reduce performance dramtically for complex or personalized views and basically negates any caching on ajax requests.

This issue should help organize distinct topics that should each help improving the performance of views.
So far, I'm aware of the following three issues:

  • Views by default uses the generic list tag (e.g. node_list), make any cached results invalid whenever an entity of the view’s type is changed or created, see https://www.drupal.org/project/drupal/issues/3055371 πŸ› Use new cache tag ENTITY_TYPE_list:BUNDLE in Views to improve cache hit rate Needs work
  • Views by default uses the full url or all the query arguments to create the result key whenever there are exposed filters or sort options. This will also include unrelated values (e.g. dom id on ajax requests or tracking parameters). This in effect will negate any cacheability on ajax views.
  • Some filters do expensive operations every time they are loaded, e.g. taxonomy term filters (taxonomy_index_tid). The computation is independent of the input and could be cached.

Proposed resolution

- Create separate issues per distinct topic
- Adress each issue and resolve it

Remaining tasks

- πŸ› Use new cache tag ENTITY_TYPE_list:BUNDLE in Views to improve cache hit rate Needs work
- πŸ“Œ Views caching: Use precise arguments for result key Active
- πŸ“Œ Views caching: Provide caching for expensive filter options Active

User interface changes

None

API changes

None, all changes should be transparent outside of views.

Data model changes

None

Release notes snippet

🌱 Plan
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 14 hours ago

Created by

πŸ‡¨πŸ‡­Switzerland pvbergen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024