Performance issue when listing micro-sites with thousands of users

Created on 16 July 2025, 18 days ago

Problem/Motivation

Listing 70 micro-sites (/admin/content/site) on our project takes close to 30 seconds.

Steps to reproduce

  • Have micro-sites with at least one having around 5000 users referenced
  • Access the list of micro-sites on page /admin/content/site

Proposed resolution

After some profiling, it appears the bottleneck seems to be how cache tags associated with micro-sites get listed.

Thus, I think we should improve the performance of functions \Drupal\micro_site\Entity\Site::getUsersId and \Drupal\micro_site\Entity\Site::getCacheTagsToInvalidate.

Remaining tasks

If we want to improve performance further, we should consider completely avoiding loading user entities for getting their cache tags (in \Drupal\micro_site\Entity\Site::getUsersId), and generate them "manually" directly from their user IDs (in \Drupal\micro_site\Entity\Site::getCacheTagsToInvalidate).

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France pacproduct

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024