A few tests with concurrent requests via GuzzleHttp\Pool show notable performances improvments.
MR is following.
Issue fork sitemap_url_checker-3594593
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:
- 3594593-improve-performances-
changes, plain diff MR !5
Comments
Comment #3
nicolasgraphSpeeds up the URL checker by issuing HTTP requests concurrently instead of one at a time, and exposes the concurrency level as configuration.
Performance changes
SitemapUrlCheckerForm::processLinks()previously checked each sitemap URL with a sequential blocking HEAD request (checkUrl()), so total runtime was the sum of every request's latency. Replaced with aGuzzleHttp\Pool(checkUrls()) that runs up to N requests in parallel. Per-request options (timeout, connect_timeout, http_errors => FALSE, allow_redirects) and the existing behaviour — failed requests reported as 500 and logged — are preserved.extractLinks()previously fetched each nested sitemap sequentially. Nested sitemaps are now downloaded in parallel via anew loadXmlMultiple()pool;extractUrlsFromSitemap()was refactored to operate on an already-parsed \SimpleXMLElement (load vs. parse responsibilities separated).New configuration
sitemap_url_checker.settings:concurrencywith config/install default and config/schema definition.configure:key to *.info.yml and a menu link, so the module exposes a Configure link.MR saved as draft for now as it needs more tests on my side.
Observed sitemap checking time is 4min30s for 370 URLs with a concurrency set to 10, against 8min45s for the current module version.
Comment #4
nicolasgraphWork as expected on one of our websites.
Comment #5
cmarrufo commentedHi @nicolasgraph,
I find this very interesting.
I will test it in one of our site that has a very amount of content (around 13.5k of urls hehe).
Thank you very much!!
Comment #9
cmarrufo commentedComment #10
cmarrufo commented