InfoParser should use FileCache

Created on 15 January 2024, 10 months ago

Problem/Motivation

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

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

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

Merge Requests

Comments & Activities

  • Issue created by @alexpott
  • Merge request !6181Use file cache in info parser β†’ (Closed) created by alexpott
  • Status changed to Needs work 10 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    This is not yet passing tests.

    Also: one question on the MR πŸ€“

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    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?

  • Status changed to Needs review 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    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.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Added the change record.

  • πŸ‡¦πŸ‡ΊAustralia kim.pepper πŸ„β€β™‚οΈπŸ‡¦πŸ‡ΊSydney, Australia
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Thanks for the review @kim.pepper

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    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?

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    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.

  • Status changed to RTBC 10 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    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!

    🀯

  • Status changed to Needs work 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    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.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ
  • Status changed to Needs review 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Saving issue credit.

  • Status changed to RTBC 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Looks great.

    • catch β†’ committed 2fa31524 on 11.x
      Issue #3414825 by alexpott, Wim Leers, longwave, kim.pepper: InfoParser...
  • Status changed to Fixed 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

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

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Wow, elegant solution for a test-only scenario! πŸ‘

  • πŸ‡«πŸ‡·France andypost

    Please close MR

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

  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    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

Production build 0.71.5 2024