AlgoViz

Design a URL crawler

hard 60 min

Start from a few addresses, download pages, find links, and repeat a billion times a month.

What each level should show

The same question is judged differently for mid, senior and staff.

  • Mid

    Must show

    • The loop: frontier, fetch, parse, add links
    • robots.txt and a delay for each host
    • A seen set with a reason
    • Pages and records in different stores

    Will be probed on

    • What happens when two workers take one host
    • Size of the seen set
    • Retries and dead links

    Stands out

    Notices that links from a page mostly point at the same host.

  • Senior

    Must show

    • Front and back queues, or an equal idea
    • Split by host, with leases
    • Bloom filter arithmetic and its error
    • A schedule for returns

    Will be probed on

    • Shard failure and double owners
    • Near duplicates
    • Traps, beyond a depth limit

    Stands out

    Says that hosts, not servers, are the limit, and shows the number.

  • Staff

    Must show

    • Budgets as a first class idea
    • Cost: requests against bytes
    • What to forget
    • Duties to site owners and how they are watched

    Will be probed on

    • Changing owners without breaking the pace
    • Measuring freshness honestly
    • A hundred times the size

    Stands out

    Turns the crawl into a spending decision: where does the next fetch bring most?

Same question, three answers

"How do you stay polite?"

LevelA good answer sounds like
Mid"I read robots.txt and wait a second between requests to a host, with a queue for each host."
Senior"Each host has one owner that leases it to one fetcher, so the rule needs no shared counter. The delay grows with the host's response time."
Staff"One owner by lease number, a pause on every handover, and an independent count at the exit that can stop us. The promise is checked by something that does not share the code that makes it."