Long page load time due to large data of pattern blocks.

Created on 7 March 2023, almost 2 years ago
Updated 13 March 2023, almost 2 years ago

Problem/Motivation

Having a large amount of patterns, in our case 300k of patterns causes page load to hinder or even crash due to the SQL query timing out. This only happens after a cache rebuild.

Steps to reproduce

- Clear cache via drush
- Load any page
- Note that the page takes a very long time to load or will timeout.

Proposed resolution

This logic needs to be rework where it does not load every single patterns
https://git.drupalcode.org/project/patternkit/-/blob/9.1.x/src/Plugin/De...
The query it runs is :

SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id"
FROM
"patternkit" "base_table"
INNER JOIN "patternkit_field_data" "patternkit_field_data" ON "patternkit_field_data"."id" = "base_table"."id"
WHERE ("patternkit_field_data"."reusable" IN ('1')) AND ("patternkit_field_data"."default_langcode" IN ('1')) 

We have only 5 reusable patterns out of 300k+ and this took a very long time to load.

Remaining tasks

Patch derivative logic

User interface changes

None

API changes

None

Data model changes

None

📌 Task
Status

Fixed

Version

9.1

Component

Module Core

Created by

🇺🇸United States johnle

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

Comments & Activities

Production build 0.71.5 2024