Classic design · Mid
News aggregator (Google News)
Classic interview design. Key points: probabilistic data structures.
Short answer
Classic interview design. Key points: probabilistic data structures. A news aggregator gathers articles from thousands of publishers into a scrollable interface, for people who want to keep up with events. The example in this case is Google News, and the interview task it is based on describes the product this way.
01 · CONTEXT AND REQUIREMENTS
What a news aggregator does
A news aggregator gathers articles from thousands of publishers into a scrollable interface, for people who want to keep up with events. The example in this case is Google News, and the interview task it is based on describes the product this way.
The page lists three core requirements: see an aggregated feed of articles from thousands of publishers worldwide, scroll the feed “infinitely” and click an article to be redirected to the publisher's site, where the full content lives. It is a good starting point for the requirements gathering.
Personalizing the feed by interests is one of the items the page leaves out of the initial scope. Among the non-functional requirements, it prioritizes disponibilidade over consistency: users prefer to see slightly stale content to seeing no content at all.
02 · INGESTION
How articles arrive in the system
Before assembling any feed, the system needs to discover the articles. One documented discovery source is the news sitemap: Google's documentation for publishers says it is for the publisher to tell Google about its news articles and additional data about them.
The publisher should update the sitemap with new articles as it publishes them, and Google News crawls these sitemaps as often as it crawls the rest of the site.
The documentation asks that the sitemap include only URLs of articles created in the last two days. Each sitemap accepts up to 1,000 news:news tags; beyond that, the guidance is to split into smaller sitemaps.
The publication date provided should be the original one, from when the article came out on the publisher's site, not the time it was added to the sitemap.
The publisher maintains a news sitemap and updates it as it publishes.
The crawler checks the sitemap for new URLs. According to the documentation, Google News crawls these sitemaps as often as it crawls the rest of the site.
Each sitemap lists only recent articles and has an entry limit; beyond it, the guidance is to split into smaller sitemaps.
Each new URL becomes a message in the queue, and the crawler moves on to the next one.
The processor reads from the queue and extracts the title, text and publication date. The date must be the article's original one, not the time it entered the sitemap.
The result is written to the article store.
03 · DUPLICATES
Fingerprint deduplication
The paper “Detecting Near-Duplicates for Web Crawling,” presented at the WWW conference in 2007, deals with web documents, not specifically news. It separates two problems: exact duplicates are easy to identify with standard checksum techniques; the harder part is near-duplicates, identical in content but different in a small part of the document, such as ads, counters and timestamps.
The core technique is simhash, a fingerprint with the property that the fingerprints of near-duplicates differ in only a few bit positions. To compute it, the document becomes a set of features, each with a weight, and that set is reduced to a fixed-size fingerprint.
| Technique | Comportamento |
|---|---|
| Standard checksum | Easily identifies exact duplicates. |
| SHA-1 or MD5 | For two documents that differ by one byte, produces completely different hashes. |
| simhash | For those same documents, produces similar hashes; the Hamming distance is small. |
In the paper's experiment, for a repository of 8B pages, 64-bit fingerprints and k equal to 3 were considered reasonable. The criterion is to declare two documents near-duplicates when their fingerprints differ in at most 3 bits, and k equal to 3 is reasonable because precision and recall are close to 0.75.
| Choosing k | Efeito |
|---|---|
| k too low | Lets near-duplicates slip through (false negatives). |
| k too high | Marks incorrect pairs as near-duplicates (false positives). |
The paper also reminds us that, in practice, the presence of a near-duplicate may not become a yes-or-no decision to eliminate pages; it can be one of a few scoring components.
The detector receives each newly processed article from the queue.
It converts the text into a set of weighted features and reduces that set to a fixed-size fingerprint. The paper describes the step for web pages.
Then it queries the index: is there any known fingerprint that differs from this one in at most k bits?
The paper's method builds several tables kept in the main memory of a set of machines; the alternative of probing a sorted table with all possible variations requires a prohibitive number of lookups.
If it finds a similar fingerprint, the detector can group the article with the earlier one; if not, it writes a new article and adds the fingerprint to the index. The paper notes that, in practice, the presence of a near-duplicate can be just one scoring component.
There is yet another kind of similarity. The paper mentions the case of, given a news story, finding stories from other sources that report the same event, and says this notion of similarity is semantic, quite different from the notion of duplicates and near-duplicates.
04 · FEED READ
Serving the feed quickly and with high availability
Serving the feed is the read path. Among the deep-dive questions the page raises are pagination, latency, article freshness, media handling and traffic spikes during breaking news. The table summarizes each one.
| Tema | Question raised by the page |
|---|---|
| Pagination | How can pagination consistency and efficiency be improved? |
| Latency | How do you achieve low latency, under 200 ms, on feed requests? |
| Frescor | How do you ensure articles appear in feeds within 30 minutes of publication? |
| Media | How do you handle images and videos efficiently? |
| Picos | How do you handle traffic spikes during breaking news? |
The reader opens the app; the feed request goes through the edge and reaches the feed API.
The API first queries the feed cache, which stores already-assembled pages.
If the cache does not have the page, the API assembles the feed from the article store and fills the cache.
When the cache offers a slightly old version of the feed, the design accepts serving it: the page prefers slightly stale content to no content.
As the user scrolls the list, the app asks the API for the next page, which repeats the path.
When clicking an article, the reader is redirected to the publisher's site to read the full content.
05 · LIMITS AND EXTENSIONS
What the public source does not cover
The page lists two bonus deep dives: supporting feeds by category, such as sports, politics and technology, and generating personalized feeds based on each person's reading behavior and preferences.
The public part of the page shows the requirements and the deep-dive questions, but stops before the final design: the text asks for a subscription to continue reading. For that reason, this case provides no capacity numbers or an architecture attributed to the real product.
Frequently asked questions
What is News aggregator (Google News)?
Classic interview design. Key points: probabilistic data structures.
What does the News aggregator (Google News) design cover?
It is organized in these sections: What a news aggregator does, How articles arrive in the system, Fingerprint deduplication, Serving the feed quickly and with high availability, and What the public source does not cover.
How long is News aggregator (Google News) and what level is it?
It takes about 14 minutes to read and is rated Mid level.
Now design it yourself
Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.