Cache the processed results to improve the performance for big results sets

Created on 15 September 2025, 6 days ago

Problem/Motivation

When building a facet form element, all processors are executed. This happens on every page of a view, because the views facet source uses the `url` cache context (see: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/views...), and each view page has a unique URL.

As a result, in a view with multiple pages, navigating through each page causes all processors to run for every facet present, even though the facet items themselves do not change.

If a facet contains a large number of items, this repeated processing can significantly degrade view performance.

Additionally, this behavior introduces a potential DDoS (Denial of Service) vulnerability: an attacker could trigger many unique URLs (e.g., by rapidly paging through results or crafting URLs), causing the server to repeatedly execute expensive facet processors and potentially overwhelm system resources.

Steps to reproduce

- Install the Standard profile.
- Create 100 articles.
- Create 1,000 tags, ensuring each tag is referenced by at least one article.
- Create a Search API index for nodes.
- Add the `field_tags` field to the index.
- Create a view based on the Search API index.
- Display article titles and add an exposed filter using the tags facet.
- Enable the "Transform entity ID to label" and "Build hierarchy tree" processors, and add some ordering processors.
- Set the view pager to display 10 items per page.
- Save the view and browse through several pages.

Proposed resolution

Cache the processed result set so it can be retrieved from cache instead of being rebuilt on every request. The cache should take processor contexts into account, ensuring each result set is uniquely identified.

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇪🇸Spain unstatu

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024