How it works
Partition host queues across scheduler shards so one host’s rate policy has a clear owner. A shard is one scheduler’s slice of the hosts. Multiple downloader workers can lease eligible URLs; rebalance shard ownership as capacity changes without allowing two owners to violate a host delay. A consistent-hash ring reduces movement: going from 20 to 21 shards moves about 5% of hosts, where simple modulo hashing moves about 95%. It does not solve hot hosts or stalled workers by itself. Apache Nutch partitions fetch lists by host, domain, or IP for the same reason. Replicate durable frontier state, checkpoint ownership transitions, and make storage writes idempotent.
Hand over a host in order: the old owner stops scheduling it and saves its next-eligible time, and only then does the new owner start. Skipping that save can fetch a host twice in one delay window. Shards also add failure modes, so stay on one scheduler until its memory or CPU actually runs out.
Separate document storage from the index handoff: store fetched versions and metadata under stable keys, then publish a durable indexing event or batch. Watch queue age by priority, eligible-host count, fetch success and error rates, robots denials, bytes, duplicate ratio, change-detection lag, and per-host request rates. These signals expose starvation, floods, traps, and stale output before aggregate QPS looks wrong.
Adding workers raises total QPS but one important host still falls behind. Why?
That host may be limited by its politeness budget or have an oversized queue. More workers cannot safely exceed its rate; adjust priorities, freshness goals, or host policy with evidence.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Partition by host to preserve rate ownership, then rebalance carefully.
- Measure both crawl health and the freshness of downstream indexed content.