Summary
When useSitemaps is enabled, the scrapers currently enumerate the entire sitemap tree before the crawler processes any page. For large sites whose sitemap index references hundreds of child sitemaps, this serial "download-all-sitemaps-first" phase dominates run time and frequently exhausts the run timeout before real crawling even begins.
Proposal: stream sitemap URLs into the request queue as each child sitemap is parsed, and start the crawler concurrently, so sitemap I/O overlaps with page processing.
Evidence
From a large-scale test — 500 domains (250 most-popular + 250 random), run through a Crawlee-based Sitemap Extractor over an Apr–Jun 2026 usage window:
- Top-250 popular sites averaged ~2,355 sitemap URLs/domain vs ~290 for the random sample (~8× more).
- 83 of 500 runs hit the 1-hour timeout, disproportionately the large sites — they spent the bulk of the run downloading/parsing sitemaps and never got through the enqueued links. Their discovered-page counts are truncated as a result.
Root cause
Crawlee's Sitemap.load() (the standard path) collects every URL from the whole sitemap tree — following the sitemap index and all child sitemaps — into a single urls array, and only returns once complete. The actor then calls crawler.addRequests(sitemap.urls). So wall-clock is effectively sitemap_download_time + crawl_time, fully serial.
(Confirmed against the Crawlee Sitemap API, which exposes load() / fromXmlString() / tryCommonNames() but no incremental/streaming consumption — all URLs surface only after the full tree is loaded.)
Proposed fix
Turn sitemap ingestion into a producer/consumer that overlaps with crawling:
- Fetch the sitemap index first to obtain the list of child-sitemap URLs.
- Download child sitemaps with a bounded-concurrency pool (e.g. 10–20), parsing each with
Sitemap.fromXmlString() (or a streaming parser) rather than the monolithic load().
- As each child sitemap resolves, immediately
await requestQueue.addRequests(batch) — don't wait for the rest.
- Start the crawler concurrently (don't
await full enumeration). Crawlee's autoscaled pool pulls URLs as soon as they land in the queue.
Result: wall-clock drops from sitemap_time + crawl_time to roughly max(sitemap_time, crawl_time), and large sites make real crawl progress before hitting the timeout.
Notes
- Cap per-host sitemap concurrency to avoid triggering anti-bot (see the related Unblocker issue).
- Complements a separate sitemap download-optimization issue (streaming XML, gzip, keep-alive, incremental skip).
🤖 Filed from a data-driven analysis with Claude Code, based on a 500-domain Sitemap Extractor test (Apr–Jun 2026).
Summary
When
useSitemapsis enabled, the scrapers currently enumerate the entire sitemap tree before the crawler processes any page. For large sites whose sitemap index references hundreds of child sitemaps, this serial "download-all-sitemaps-first" phase dominates run time and frequently exhausts the run timeout before real crawling even begins.Proposal: stream sitemap URLs into the request queue as each child sitemap is parsed, and start the crawler concurrently, so sitemap I/O overlaps with page processing.
Evidence
From a large-scale test — 500 domains (250 most-popular + 250 random), run through a Crawlee-based Sitemap Extractor over an Apr–Jun 2026 usage window:
Root cause
Crawlee's
Sitemap.load()(the standard path) collects every URL from the whole sitemap tree — following the sitemap index and all child sitemaps — into a singleurlsarray, and only returns once complete. The actor then callscrawler.addRequests(sitemap.urls). So wall-clock is effectivelysitemap_download_time + crawl_time, fully serial.(Confirmed against the Crawlee
SitemapAPI, which exposesload()/fromXmlString()/tryCommonNames()but no incremental/streaming consumption — all URLs surface only after the full tree is loaded.)Proposed fix
Turn sitemap ingestion into a producer/consumer that overlaps with crawling:
Sitemap.fromXmlString()(or a streaming parser) rather than the monolithicload().await requestQueue.addRequests(batch)— don't wait for the rest.awaitfull enumeration). Crawlee's autoscaled pool pulls URLs as soon as they land in the queue.Result: wall-clock drops from
sitemap_time + crawl_timeto roughlymax(sitemap_time, crawl_time), and large sites make real crawl progress before hitting the timeout.Notes
🤖 Filed from a data-driven analysis with Claude Code, based on a 500-domain Sitemap Extractor test (Apr–Jun 2026).