Problem/Motivation
Config file storage (used for config syncs) uses a null FileCache implementation to get static caching of YAML parsing - this is because to use the full APCu caching would risk filling APCu.
Once #3486503: Add a file parsing cache collector to replace some uses of FileCache lands we'll have a persistent cache alternative which could be used instead, and which will persist across regular cache rebuilds.
Because usually only a fraction of config files are changed during a config sync, this should hopefully be a significant performance improvement when running drush cim et al
Steps to reproduce
Proposed resolution
Use the YamlCacheCollector for the sync storage.
For most of the other file storages, to preserve existing behaviour, default to a YamlCacheCollector with a MemoryCache backend, this will be more or less equivalent to the null FileCache which does static caching only.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot from 2026-07-12 19-59-13.png | 327 KB | catch |
| #3 | Screenshot from 2026-07-12 19-59-08.png | 368.67 KB | catch |
Issue fork drupal-3591680
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
catchOK it works.
We manually create FileStorage objects in a lot of places and many of them won't benefit from a persistent cache or are very unlikely to (module and recipe install for example which usually only happens once per module or recipe).
So for those cases I made it so we automatically create a memory cache-backed cache collector if nothing is passed in, this also means there's no deprecation here except for one factory method.
Installed drush 14 against an Umami site, exported config, then ran drush cim -y with main vs. the MR. Time spent in config sync parsing files goes down from 4s to 100ms. Will be more on sites with more files in the sync storage.
Comment #4
catchComment #5
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #6
catchRebased.
Comment #7
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #8
godotislateSome comments on the MR.
Comment #9
godotislateWhoops, somehow some of MR review comments were left in draft, so resubmitted.
Comment #10
catchI think I covered all the feedback from @godotislate.
Comment #11
godotislateMR and CR lgtm now.
Comment #12
catchFound #3610503: Optimize StorageCopyTrait::replaceStorageContents() when profiling this one.
Comment #13
godotislateFYI, this is going to conflict hard with #2951046: Allow parsing and writing PHP class constants and enums in YAML files.
Comment #14
catchTook a quick look at what's likely to conflict, it seems to be mainly the factory changes and it looks to me like it will be straightforward to add this on top of those changes assuming that one lands first.
Comment #15
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #16
catchRebased.
ConfigImportUitTest failed after the rebase with https://git.drupalcode.org/project/drupal/-/jobs/11210191
This happens because the autoloader config wrapper has to read core.extension before it wraps the storage with the autoloader, and if the read of core.extension triggers the cache collector cache read, that gets loaded without the wrapping having happened.
To avoid that, we can exclude core.extension from the cache altogether.
However I think we also need to handle module uninstall here. The MR already has garbage collection, but that's time-based. For now I've added an explicit clear to ModuleInstaller::uninstall() so that the whole cache gets emptied. Module uninstall is relatively uncommon so we'd still get the performance improvement most of the time. It might be possible to go through the cache entry and remove items belonging to a module but that'd be extra logic to worry about.
Comment #17
godotislate1 question on the MR, but probably good to go to RTBC.
Comment #18
godotislateI think this looks good after the rebase.