Design a Fault-Tolerant Wikipedia Archiver
LyftSoftware Engineer · OnsiteLast updated
Design a fault-tolerant system that archives Wikipedia and keeps versioned content current using one reliable coordinator, many unreliable untrusted workers, and durable blob storage. Cover policy-aware discovery, large-frontier deduplication, task assignment, result validation, safe publication, failure recovery, and recrawling.
Question
Design a distributed system that archives all Wikipedia pages and keeps the archive current. You have one reliable primary machine, about one thousand unreliable and untrusted worker bots with different IP addresses, and persistent blob storage. Focus on discovery, deduplication, task assignment, worker failure, safe storage, and periodic recrawling rather than a reader-facing website.
Constraints & Assumptions
- Workers may disappear, retry, lie about completion, or return malformed content.
- The primary coordinates metadata but cannot proxy every page body.
- Pages link to other pages, and the frontier is much larger than memory.
- Fetches must respect site policy, pacing, and robots requirements.
- An archived version is published only after content and provenance checks pass.
Clarifying Questions to Ask
- Are historical versions required, or only the latest snapshot? Preserve versioned snapshots when content changes.
- May official dumps or APIs be used? Prefer them where allowed; crawling fills freshness or coverage gaps.
- What freshness target and total bandwidth budget apply?
- How is worker trust established, and which results require independent verification?
- Are media assets in scope? Treat them as a separate typed crawl with its own policy.
Hints
Hint 1
Make the primary a lease coordinator: Store durable URL state and issue bounded leases. A missing heartbeat returns work to the frontier without trusting a worker-local queue.
Hint 2
Verify before publication: Workers should upload immutable content blobs and signed result metadata; the coordinator validates URL, status, hash, type, and consistency before advancing page state.
Follow-up questions
- How would you stop one malicious bot from poisoning the archive?
- How can the system avoid crawling duplicate URL variants?
- What state must survive loss of the primary machine?
- How would official database dumps change the architecture?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.