Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
From #1683644-141: Use Annotations for plugin discovery:
With no caching my apache server cpu goes totally nuts on http://localhost/drupal8/admin/structure/views and related pages.
My pretty unoffical benchmark technique (aka look-at-your-watch-and-count-seconds method) messures 15+ seconds on my non optimized xamp setup.
Ow its a views problem:
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery->getDefinitions()
gets called 104 times :)
Comments
Comment #1
dawehneraspilicious added a CacheDecorator which will fix these problems already, but this will lead to N cache()->get calls, one for each plugin type
so something > 10 per executed view.
I'm wondering whether it would be worth to introduce a cache decorator which stores the information of all plugin types defined by views.
Comment #2
aspilicious CreditAttribution: aspilicious commentedA gloabal "cache decorator" is only possible if you define a common object that does the following:
1) When there is no static cache ==> load all the type defintions ==> save defintions in db (keyed by type) ==> get the needed definition
2) When cache is not empty ==> just get the needed information.
If we put this inside the injection container we can use a protected variable to store the definitions. WIN!
But you should be carefull with multilingual stuff...
Thats maybe a reason not to do this...
ps: performance issues are almost fixed.
#1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items
http://drupalcode.org/sandbox/damiankloip/1685040.git/commitdiff/9f9d2b0...
Comment #3
dawehnerWe could wait until the issue in #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items shows us how the translation mechanism will work
and implement the CacheMultipleDecorator based on that, what do you think?
Comment #4
aspilicious CreditAttribution: aspilicious commentedyeah good idea
Comment #5
dawehnerThe cache decorator is in, i believe we can postpone this issue and maybe open it before release?
I think before implementing anything we should really check whether this is actually a performance issue on a real site
as this cache will probably never be cleared on normal runtime.
Comment #6
aspilicious CreditAttribution: aspilicious commentedIn fact I don't think it's a performance issue anymore. Maybe we should rename the issue to reflect we are thinking about a global cache.
Comment #7
tim.plunkettPer #5/#6, closing this.