Cascading effect creates loss of performance

Created on 24 June 2024, 5 months ago
Updated 22 July 2024, 4 months ago

Problem/Motivation

Pages, in the first cache, are taking 2 minutes to load

Steps to reproduce

Install:

  • Drupal 10
  • Metatag module
  • Tokens module
  • Webform
  • Search api

Have lots of data indexed by the search api.

Access a page without cache and that does not have the webform with the anonymous user.

When loading the page the Metatags module will invoke tokens, which will invoke the token info hook, which will call webform_token_info

This in turn calls _webform_token_render_more

which calls \Drupal::service('renderer')->renderPlain($build);
Then the Drupal renderer invokes the hook for render that triggers the search api, and since the search api is also uncached, processing takes a while.

Proposed resolution

My proposal is to put more checks here to see if the user has webform permissions, if not, enter the return ''

$theme_manager = \Drupal::service('webform.theme_manager');
  if (!$module_handler->isLoaded() || !$theme_manager->hasActiveTheme()) {
    return '';
  }

I would like the community's opinion on this solution.

πŸ› Bug report
Status

Needs review

Version

6.2

Component

Code

Created by

πŸ‡§πŸ‡·Brazil edmargomes

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

Comments & Activities

Production build 0.71.5 2024