Problem/Motivation

On a site with a large number of extensions and languages the loading time of /admin/reports/status can be very high due to how extensions translations are checked, even when local files only are used.

This is mainly due to having the locale_translation_get_file_history static cache being wiped out completely on every project/language check done.

Steps to reproduce

* Create a Drupal site with a considerable amount of extensions (124 in my case)
* Enable a considerable amount of languages (59 in my case)
* Load the status page at /admin/reports/status
* Load time should be considerably high (over 1 min or fail with a 504 status in case of some proxies)

Proposed resolution

Implement the current todo note on making the static cache management more fine grained - i.e., clear only the entries needed.

Remaining tasks

Write tests
Review patch attached.

User interface changes

None.

API changes

None.

There are different issues that strive to modernize the usage of related functions and static caches - those are linked. Despite of changing those for a more modern approach they _might_ still suffer from the same inefficient cache invalidation issue.

Comments

erickbj created an issue. See original summary.

erickbj’s picture

Status: Active » Needs review
StatusFileSize
new2.25 KB
pooja saraah’s picture

StatusFileSize
new2.24 KB

Fixed failed commands on #2
Attached patch against Drupal 9.3.x

pooja saraah’s picture

StatusFileSize
new2.24 KB
new477 bytes

Fixed failed commands on #3

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

To move forward this issue will need a test case to show the problem
Updated issue summary for it.

Version: 9.3.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

willempje2’s picture

What worked for me was removing the additional `->timestamp` check when determining whether a translation history entry exists.
Even when the timestamp is `0`, the history entry should be treated as existing when creating this abstract.

My locale_file table is filled with 0 timestamp and 0 last_checked.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

berdir’s picture

Status: Needs work » Closed (duplicate)

Thanks for reporting this. We're redesigning the history functions to handle caching better in #3037156: Modernize locale history functions. The current implementation does per-record invalidation on updates.

I also identified the repeated write backs with timestamp 0, but I think #7 is not the correct fix for that. timestamp 0 means there was not actually an import of that translation yet, so the type should not be set to that, it's misleading and might prevent an import of a local file. The timestamp should be set once an actual translation import happens. Instead, the else should only create a placeholder record if there is none yet. I have pending MR comment on the issue above to handle that.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.