Problem/Motivation

InfoParser should swap it's static cache for FileCache's and profit!

Proposed resolution

Use FileCache in InfoParser

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

I think this is not necessary.

Issue fork drupal-3414825

Command icon 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

alexpott created an issue. See original summary.

wim leers’s picture

Status: Active » Needs work
Issue tags: +YAML

This is not yet passing tests.

Also: one question on the MR 🤓

longwave’s picture

Given that the primary use of FileCache appears to be YAML parsing, wonder if we should add a Yaml::parseCacheableFile() or similar method that wraps the parsing in FileCache and then callers don't need to care about implementing it themselves?

alexpott’s picture

Status: Needs work » Needs review
alexpott’s picture

Issue tags: +Needs change record

I think we should add a CR just in case anyone is doing something like ThemeUiTest where they are re-writing .info.yml in under a second.

alexpott’s picture

Issue summary: View changes
Issue tags: -Needs change record

Added the change record.

alexpott’s picture

Thanks for the review @kim.pepper

wim leers’s picture

I think this is ready. @longwave's #4 has not gotten an answer yet, so letting him re-check/RTBC this, because it sounds like he thinks this should be implemented differently?

alexpott’s picture

I think #4 is follow-up material and I think collections are useful - as shown in the test in this issue where we're able to clear the info parser static cache and make it not use a cache backend.

Also, I think this issue is responsible for a considerable speed up in tests. The webservers are only going to have read every extension info.yml once per job. And as we have APCu enabled in cli same for each CLI process. This is likely to the millions of function calls in each job. See how \Drupal\Core\DrupalKernel::boot() sets the prefix without a site path and we have the apcu_ensure_unique_prefix setting set to FALSE.

wim leers’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community
Issue tags: +Performance

Also, I think this issue is responsible for a considerable speed up in tests. The webservers are only going to have read every extension info.yml once per job. And as we have APCu enabled in cli same for each CLI process. This is likely to the millions of function calls in each job. See how \Drupal\Core\DrupalKernel::boot() sets the prefix without a site path and we have the apcu_ensure_unique_prefix setting set to FALSE.

Holy 💩 🤩🤯

You're right!

11.x
6 minutes 50 seconds, queued for 7 seconds — https://git.drupalcode.org/project/drupal/-/pipelines/79674 (last scheduled 11.x run)
11.x + this MR
5 minutes 20 seconds, queued for 18 seconds

https://git.drupalcode.org/project/drupal/-/pipelines/79608

🤯

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Agree #4 can be explored elsewhere.

Discussed in Slack with @alexpott and we think that instead of forcing a cache invalidation in the trait we can just force the mtime of the file to be one second newer than the previous mtime, which should trigger the cache to invalidate by itself.

alexpott’s picture

Status: Needs work » Needs review
alexpott’s picture

Saving issue credit.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

  • catch committed 2fa31524 on 11.x
    Issue #3414825 by alexpott, Wim Leers, longwave, kim.pepper: InfoParser...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Yes this looks really good. Committed/pushed to 11.x, thanks!

wim leers’s picture

Wow, elegant solution for a test-only scenario! 👏

andypost’s picture

Please close MR

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bkosborne’s picture

I know there was some discussion if this needed a change record or not, and ultimately one was added.

I just want to ask that any changes that affect APCu cache always do receive a change record. I help maintain a very large (> 500 sites) multisite install. Any increase to APCu cache utilization, however small, can have cause a big increase in my overall APCu utilization and cause major issues if all allocated memory is exhausted. I don't say this to indicate Drupal shouldn't utilize APCu cache for new things, just that the core committers please ensure that the changes are advertised as change records, just like this one was. It allows me time to test how much more memory I'll need to allocate. Thank you