Problem/Motivation
Unfortunately \Drupal\plugin\PluginType\PluginTypeManager::getPluginTypes() does not use FileCache correctly and this results in a massive amount of extra memory usage for no reason during a site install.
Steps to reproduce
Install a site with many modules and plugin among them. Run site install from config using drush -vvv.
Before this change:
[success] Installation complete. User name: dru_admin User password: ********* [68.05 sec, 1.05 GB]
After this:
[success] Installation complete. User name: dru_admin User password: ******** [71 sec, 224.18 MB]
Proposed resolution
Do not vary the file cache by provider it is misunderstanding how file cache works.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Issue fork plugin-3416294
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 #2
alexpottComment #3
alexpottComment #4
andypostSounds like needs backport to 10.2
Comment #6
andypostComment #7
berdirChange makes sense, no idea what's going on with those numbers, I managed to get it to report 1.6GB, although I really wonder if those numbers are accurate or if it's confused somehow. top seems to match that.
Before:
After:
Comment #8
alexpottI guess another question here is why does the plugin module cause 10mb of memory usage...
Before I applied this change:
After
Oh I see.... this module results in the container being stored in static cache many many times... that's why the memory ballooned. But it should not even go in once!
More work incoming.
Comment #9
alexpottThe current patch now results in less memory usage all the time:
Before patch
Before the commit to fix #8
After
Comment #10
alexpottI think we should add tests of installing multiple modules with plugin types so we can test that the caches work as expected.
Comment #11
berdirRebased and reviewed.
Comment #12
wim leersWOW, those numbers! 🤯
Comment #13
alexpott