- Issue created by @intradavid
- π«π·France mably
Lots of links on your pages?
DomainSourcePathProcessor service is rather resource hungry for example.
It easily takes 100MB of memory to process some pages on some of our sites.
Profiling using XHProf shows that rendering links can take more than 60% of total processing time, amazing.
We also have DomainEntitySourcePathProcessor service activated for handling taxonomies, so that doesn't help ;) Yes, there are quite a lot of links on the page, what is the solution to make it work?
path_alias = 291,340
- π«π·France mably
291,340 is that the number of links you are trying to display on a single page?
No, these are all the URLs used by the site.
Interestingly, the same problem occurs even if I just want to edit a content.
Basically, there is no problem, only after I turn on the Domian source module, I can't view or edit any single content.
/modules/contrib/domain/domain_source/src/HttpKernel/DomainSourcePathProcessor.php
This line eating my memory, when remove all working fine.
$url = Url::fromUserInput($alias, $options);
- π«π·France mably
@intradavid, that's definitely the hotspot we identified on our side too, so we override this service to filter out the urls we don't want to analyze.
It would definitely be interesting to be able to filter out some url patterns, for our use case at least.
- Status changed to Active
about 1 year ago 3:29pm 27 November 2023 - πΊπΈUnited States agentrickard Georgia (US)
Housekeeping first.
* Support requests are never flagged as "Needs review" -- that is reserved for patches or merge requests.
* When you comment out$url = Url::fromUserInput($alias, $options);
, nothing will happen. Its like uninstalling the module.I think the root question here is *why* are so many links being generated on a page?
If these were mostly admin links (such as from Admin Toolbar), we could pretty easily exclude those.
- If these are all node links, what is it about the site that causes this issue?
- Lots of blocks that load all content? Unlimited pagers?
- Headless Drupal using JSONAPI to deliver all content?
@intradavid -- from a testing perspective against a standard Drupal install, Devel Generate could easily create 300,000 nodes with aliases (though that might take a while).
From a development perspective, it would be ideal if we could cache this data -- the problem being that the cache object in this case would be too large to handle.
- π«π·France mably
Hi @agentrickard,
If these were mostly admin links (such as from Admin Toolbar), we could pretty easily exclude those.
It would definitely bring a nice performance improvement on some of our sites as we make an extensive use of Admin Toolbar and have sometimes more than 400 admin links.
- πΊπΈUnited States agentrickard Georgia (US)
I would think we can make that a setting -- or a default behavior if there are no implementations of hook_domain_source_path().
Probably the best approach is a deny list that is editable, similar to the path settings for blocks.
We have a model for that in domain_config_ui/src/Form/SettingsForm.php -- a new issue to address that would be ideal.
----
Back to the original issue: two more questions:
1) What version of Drupal?
2) What is the memory limit current set to? (You can see this at admin/reports/status) -- and do you have the ability to change it? Hi @agentrickard,
1) What version of Drupal? - Drupal core 10.1.6
2) What is the memory limit current set to? - 256M, 512M, 2GB tested, and last time database crash on the server.
Plus info:
- Devel module can creat new node.
- πΊπΈUnited States agentrickard Georgia (US)
Thanks. So let's go back to the original 3 questions:
- If these are all node links, what is it about the site that causes this issue?
- Lots of blocks that load all content? Unlimited pagers?
- Headless Drupal using JSONAPI to deliver all content?
- π¬π§United Kingdom andy_w
We found the use of fromUserInput and getPathByAlias to be the source of the performance issue, and wondered whether there would be a benefit in making use of some of the other data available in the options, i.e. potentially the entity itself or the href as the first line of defence.
- Merge request !123Issue #3402534 by andy_w: Domain Source - utilise existing objects to generate... β (Open) created by andy_w