Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2015 at 06:05 UTC
Updated:
3 Feb 2023 at 10:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerAdding the plach tag.
Comment #2
berdirThe loadByProperties() is the block repository, right?
We have #2479459: BlockRepository::getVisibleBlocksPerRegion() does an uncached entity query on every request for that.
And the comment count is because node links are a placeholder and need to be rebuilt on every page.
I started testing to remove that on #2530846: Fix and improve comment cache tag usage, will possibly open a separate issue for that part instead.
So I think we can avoid those specific queries on cached pages but yes, we can definitely look into improving the queries themself too. I also noticed that the query we actually build seems to join the same table for some conditions, which also makes the actual query slower.
Comment #3
dawehnerNo its not, these are the entity query run by shortcut.module and comment manager. The slowness I want to show here is
Drupal\Core\Entity\Query\Sql\Tables::getTableMapping, an inclusive walltime of 4.7% just for that.Comment #4
claudiu.cristeaLet's see. The biggest part here is cache invalidation.
@dawehner, can you benchmark this?
Comment #6
claudiu.cristeaChecking now if the
cache.defaultservice exists in the container because\Drupal\Core\Database\Driver\mysql\Schema& friends are called also during the install process when there's no full container. But, in that moment there's also no cache to clear so we can avoid the cache clear for that cases.@dawehner, I tried first to test this with
\Drupal::hasService('cache.default')but\Drupal::hasService('cache.default')always returns TRUE, even when installing. Is this a bug?Comment #20
larowlanComment #22
Arti Anil Pattewar commentedRerolled patch #6 against D9.3.x as suggested in #20.
Comment #23
akram khanFixed some syntax and statement that are unused and Fixed CCF #22
Comment #24
akram khanComment #25
medha kumariRerolled the patch #23 in Drupal 9.5.x.
Comment #26
spokjeNeeds some PHPCS fixes.
Comment #27
akram khanAddress #26 and Fixed CCF #25
Comment #28
akram khanComment #29
joachim commentedNeeds an IS update. The problem needs to be explained a bit better, and the proposed resolution explained.
Comment #30
phenaproximaPHP 7.1 allows us to catch multiple exception types at once, and PHP 8 allows for non-capturing catches. So, assuming this won't be backported to Drupal 9, this could be:
If this will be backported, then:
This seems a bit dangerous, because it writes a license for subclasses to NOT implement this method, under the mistaken assumption that it will be handled by the parent class.
I would suggest something like this instead:
Although that would be a backwards compatibility break, so...I guess dunno what to do here, exactly.
Comment #31
catchThe reroll in #27 is missing hunks of the patch that actually add the caching. #6 seems to be the last version of the patch with those changes.
Comment #32
Gunjan Rao Naik commentedAdded patch against #27 in 10.1.x version
Comment #33
Gunjan Rao Naik commentedComment #34
catch#27 is an incomplete patch, any further work here needs to start with a re-roll of #6 and ignore all the patches in-between.