An agent that launches a run without estimating it can leave a user waiting two days. The server's instructions make the estimate a required step; this page is that step written out.
1. Do the arithmetic
wall-clock ≈ urls × seconds_per_url ÷ concurrency
Measured per-url costs on this fleet:
http mode 1–5 s (a JSON endpoint is at the fast end)
browser mode 8–60 s (20 s is typical for a heavy retail product page)
Concurrency defaults to 1 on every routine.You know the URL count from get_template_urls. Multiply before you launch, and if the result does not land in a time the user would accept, raise concurrency first.
2. Read and set concurrency
get_routine_concurrency(routineId) → { concurrency: 1, max: 20 }
set_routine_concurrency(routineId, 3) → { requested: 3, concurrency: 3 }Start at 3 on a site you have not run before. http-mode routines over a plain JSON endpoint can start higher. Read the applied concurrency in the response rather than assuming.
3. Run a first wave
run_routine(routineId, max_items: 30) → dispatch_id
get_job_status(dispatch_id) → timing.avg_seconds_per_url
check_job(dispatch_id) → diagnostics: empty rate, alignmentOne wave gives you the real seconds-per-URL for this site at this concurrency. Do not carry an estimate you were told; measure your own, recompute the ETA once, and adjust once.
4. Decide and launch
- Wave came back clean → go to 10 and run the full list.
- Site fights back (captcha, challenge pages, login walls) → stay at 3 even when capacity is free. Concurrency is a politeness setting as much as a speed setting.
- Say the estimate out loud when you report.
5. Watch the empty rate
Overload looks like success: empty results, every status completed. Measured on one job, 28% of URLs came back empty while a second run competed for the same routine; alone, 1.5%. If the empty rate in diagnostics climbs after a concurrency increase, halve it and re-check.
Worked example
8,198 product URLs, browser mode, measured 21 s per url
concurrency 1 → 8,198 × 21 ÷ 1 ≈ 172,000 s ≈ 48 h
concurrency 3 → 8,198 × 21 ÷ 3 ≈ 57,000 s ≈ 16 h
concurrency 10 → 8,198 × 21 ÷ 10 ≈ 17,000 s ≈ 5 h
discover_api_endpoints found a JSON endpoint, http mode, 2 s per url
concurrency 10 → 8,198 × 2 ÷ 10 ≈ 1,600 s ≈ 27 minThe biggest saving is rarely concurrency. It is finding the JSON endpoint and leaving browser mode behind. Do that first; then tune concurrency.