Scrivio Interview library
ScenarioAdvanced6 min read · updated 13 November 2026

A crawler fleet of 200 nodes fetches 5,000 pages per second. In one week its frontier grew from 2 billion to 9 billion URLs, half of the new URLs came from a few hundred hosts, and the share of fetches that found useful new pages fell from 40 percent to 6 percent.

What is probably happening to the frontier, how do you confirm it, and how do you change the crawler so it stops wasting its fetch budget?

The frontier is almost certainly filling with crawler traps: calendars with endless next links, session ids and tracking parameters, faceted search combinations, soft-404 pages and link farms, all generating unlimited URLs for the same few hundred hosts. We confirm it with per-host statistics such as URLs discovered against distinct content hashes, URL depth and length, and query parameter patterns. Then we improve normalisation, cap URLs per host with budgets tied to the host's value, track yield per 1,000 fetches, alert on frontier growth and prune low-value URLs.

Why this question is asked

A crawler's budget is finite, and the web contains places that can generate an infinite number of URLs. When the crawler wanders into them, it does not crash; it just becomes quietly useless, as the drop from 40 percent to 6 percent useful fetches shows. Interviewers ask this to see whether we can reason from metrics to a cause and build defences that work without a person reading URLs all day. In this answer, we will name the likely traps, confirm the diagnosis with data, fix normalisation, introduce per-host budgets, and add the yield metric and pruning that keep the crawler honest.

1What Is Probably Happening

The frontier grew by 7 billion URLs in a week, half of them from a few hundred hosts, while the share of useful fetches collapsed. Real sites do not publish billions of new pages in a week, so these hosts are generating URLs, and the crawler is following them. These are called crawler traps: sets of pages whose links lead to an unlimited number of distinct URLs with little or no new content.

Common crawler traps
TrapExample URL patternWhy it is endless
Calendars/events?month=2093-07every page links to next month, forever
Session or tracking ids/item/5?sid=a81f...&utm_source=xsame page, new id on every visit
Faceted search/shoes?color=red&size=9&sort=priceevery filter combination is a URL
Soft-404 pages/any/random/path returns 200missing pages look like real ones
Link farms and loops/a/b/a/b/a/b/...generated paths link to more paths
Each one looks like ordinary links to a naive crawler.

2Confirming It With Per-Host Statistics

Before changing the crawler, we confirm the cause with numbers per host. The most telling ratio is URLs discovered against distinct content hashes: a healthy news site may have 1.1 URLs per distinct page, while a trap host may have 5,000 URLs for 300 distinct pages. Distributions of URL depth (number of path segments) and URL length show runaway paths. And the query parameter patterns of the top hosts, which parameter names appear and how many distinct values each has, reveal session ids and facets.

SQL
-- top hosts by new URLs this week, with how much of it was really new content
SELECT host,
count(*) AS urls_discovered, -- 41,000,000
count(DISTINCT content_hash) AS distinct_pages, -- 12,300
avg(path_depth) AS avg_depth, -- 14.2
approx_percentile(url_length, 0.99) AS p99_length -- 1,840
FROM crawl_log
WHERE discovered_at > now() - interval '7 days'
GROUP BY host
ORDER BY urls_discovered DESC
LIMIT 200;

Notice that for the trap host, 41 million URLs produced 12,300 distinct pages, about 3,300 URLs per page. Sampling a few hundred URLs from each top host and grouping them by path template and parameter names usually makes the trap obvious within minutes.

3Better Normalisation

Normalisation, turning every spelling of a URL into one canonical form, is the first defence. We strip known session and tracking parameters, such as sid, sessionid, jsessionid and the utm_ family; sort the remaining query parameters so that a=1&b=2 and b=2&a=1 are one URL; and cap URL length and path depth, for example 2,000 characters and 12 segments, beyond which a URL is almost never a real page.

Java
in : https://shop.example/item/5?utm_source=mail&sid=a81f&color=red
out: https://shop.example/item/5?color=red // tracking and session removed
in : https://shop.example/s?size=9&color=red&sort=price
out: https://shop.example/s?color=red&size=9 // sorted; 'sort' learned as no-change
in : https://site.example/a/b/a/b/a/b/a/b/a/b/a/b/a/b
out: (dropped: path depth 14 > 12)

Generic rules only go so far, so the crawler also learns per-host rules. For each parameter on a host, it compares the content hashes of pages that differ only in that parameter. If changing sort or ref never changes the content, the parameter is marked as irrelevant for that host and removed during normalisation from then on. This is how the crawler adapts to sites nobody has reviewed by hand.

4Budgets per Host

Normalisation reduces traps, but no rule catches every generator. So each host gets a budget: a maximum number of URLs queued and fetched per day, sized by the host's value. Value comes from signals such as the number of distinct sites linking to it and its past usefulness, the share of its fetched pages that were new and kept. A major news site might get 500,000 fetches a day, an unknown new site 1,000.

When a host exceeds its budget, its extra URLs are not added to the frontier, or are added at the lowest priority. Hosts whose pages are mostly duplicates, by content hash or SimHash, are demoted further. A trap can then waste at most its small budget, rather than half the frontier.

5Measuring Yield and Pruning the Frontier

The metric that would have caught this early is yield: new useful pages per 1,000 fetches, where useful means a page that is not a duplicate and passes basic quality checks. We track it per host and overall, next to the frontier growth rate. A drop in overall yield from 400 to 60 per 1,000 fetches, or a frontier that grows 50 percent in a day, should page someone within hours, not be found a week later.

Finally, we clean up. The billions of trap URLs already in the frontier should be pruned: re-run the improved normaliser over them, drop the duplicates, apply the new host budgets, and remove low-priority URLs that have waited longer than their usefulness. The fetch budget then flows back to real pages.

Step throughDaily trap defence loop
  1. Compute per-host statsURLs vs distinct hashes, depth, parameters
  2. Learn parameter rulesparameters that never change content
  3. Set host budgetsfrom inbound links and past yield
  4. Yield or frontier growth abnormal?for example yield below 200 per 1,000
    YesAlert and inspect top hostsNoContinue
  5. Prune the frontierrenormalise, drop duplicates, apply budgets

5 steps in order. Play them, or step through them one at a time.

6Follow-up questions

Couldn't we just block the few hundred bad hosts?

That fixes this week but not the next trap, and many of those hosts also have valuable pages, such as a shop's product pages behind its faceted search. Budgets and learned normalisation rules keep the good pages while capping the waste, and they work automatically on hosts we have never seen.

How do you detect soft-404 pages?

Fetch a deliberately random URL on the host, such as a long random path. If it returns 200, compare its content fingerprint with other fetched pages; pages that match the random one are soft 404s, and the host gets a rule treating that fingerprint as not found.

Should the crawler respect rel=nofollow and canonical tags here?

Yes. Canonical link tags often point all facet and session variants to one URL, and following them is both polite and efficient. They help but cannot be relied on, since trap sites often lack them.

7Conclusion

In this answer, we read the frontier explosion and the yield collapse as crawler traps: calendars, session and tracking parameters, faceted search, soft 404s and link farms. We confirmed it with per-host statistics, URLs discovered against distinct content hashes, URL depth and length, and parameter patterns. We then improved normalisation with stripped and sorted parameters, length and depth caps and learned per-host rules, set per-host budgets from each host's value and demoted duplicate-heavy hosts, and added yield per 1,000 fetches, frontier growth alerts and pruning so the budget goes back to useful pages.

What to say in the interviewAbout 90 seconds aloud

Open with

The frontier going from 2 to 9 billion URLs in a week, with half the new URLs from a few hundred hosts and useful fetches dropping from 40 to 6 percent, says the crawler is stuck in crawler traps.

Then, if they want more

Typical ones are calendars with endless next links, session ids or tracking parameters in URLs, faceted search combinations, soft-404 pages that return 200 for anything, and link farms that generate unlimited URLs.

I would confirm it with per-host statistics: URLs discovered against distinct content hashes, where a trap host shows thousands of URLs per real page, plus URL depth and length distributions and the query parameter patterns of the top hosts.

To fix it, I would improve normalisation: strip known session and tracking parameters, sort query parameters, cap URL length and path depth, and learn per-host rules for parameters that do not change content by comparing content hashes.

Then I would budget per host: cap URLs queued and fetched per day according to the host's value, like inbound links and past usefulness, and demote hosts whose pages are mostly duplicates.

Finally, I would track yield, new useful pages per 1,000 fetches, per host and overall, alert on frontier growth rate, and prune low-value URLs from the frontier so the fetch budget goes back to real pages.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What is probably happening to the frontier, how do you confirm it, and how do you change...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/90a85615aa/