← All posts

May 2026 · 8 min read · System Design, Backend, Pinterest

Beyond URL Hashing: Deduplication That Actually Works at Scale

The URL shortener interview question teaches you to hash strings. At scale, the real problem is harder: two URLs can look completely different and still be the exact same page.

Inspired by the Pinterest Engineering blog post "Smarter URL Normalization at Scale: How MIQPS Powers Content Deduplication at Pinterest"; all implementation details are from their original writeup. The React/SPA analysis is an extension of the core concepts.


The URL shortener gap

You've probably designed a URL shortener before. The canonical deduplication step is simple: hash the URL string, check if you've seen that hash, reuse the short link if you have. Clean, fast, works great in interviews.

Here's what breaks it in the real world. Two users submit links to the same product on a shopping site. One copied it from an email campaign, one from a Pinterest pin. The URLs look like this:

https://shop.com/shoes?id=42&color=red&utm_source=email
https://shop.com/shoes?id=42&color=red&ref=pinterest&session=abc123

Your hash function sees two different strings. You create two short links. But your users, and your content pipeline, just fetched, rendered, and stored the same page twice.

URL equality ≠ content equality. The same page lives at thousands of different URLs simultaneously. Deduplication that only compares strings is solving the wrong problem.


Neutral vs. non-neutral parameters

The conceptual breakthrough is simple to state, surprisingly hard to automate. Every query parameter in a URL is either neutral (noise that doesn't affect what you see on the page) or non-neutral (essential to the content identity of that page).

Non-neutral parameters change the page

ParameterWhy it matters
?id=42Identifies which product. Remove it and the page breaks or shows something different.
?color=redSelects the variant. Remove it and you see a different product variant.

Neutral parameters are pure noise

ParameterWhy it's safe to strip
?utm_source=fbAnalytics tracking. Page renders identically without it.
?session=abcSession token. Ignored by the content pipeline entirely.

Strip the neutral parameters, keep the non-neutral ones, and you have a canonical URL that you can actually hash. Two different-looking URLs normalize to the same canonical, and deduplication works.

The hard part: you cannot know which is which without domain-specific knowledge. The parameter ref is neutral noise on a product page (?ref=homepage tracking a click) and non-neutral on a comparison page (?ref=99 identifying what to compare). Same name, completely different meaning depending on the domain and URL context.


The MIQPS insight: learn it empirically

Pinterest built a system called MIQPS (Minimal Important Query Param Set) to solve this at scale. The core idea is beautifully empirical: rather than curating rules about what parameters matter, just test it.

How MIQPS classifies a parameter:

Step 1: Collect a URL corpus Accumulate all observed URLs for a domain. Group them by their set of parameter names, so product pages and category pages are analyzed separately.

Step 2: Sample URLs with varied parameter values For each parameter under test, pick up to S URLs that have different values for that parameter.

Step 3: Render the page twice, with and without Fetch a content fingerprint (a hash of the rendered visual output) for the original URL and for the same URL with that parameter removed.

Step 4: Classify by mismatch rate If removing the parameter changes the content ID in ≥T% of samples, it's non-neutral. Otherwise it's safe to strip. This map is published once per domain and reused at runtime.


Empirical identity over claimed identity

The deeper principle here is worth naming. Rather than trusting what the URL says, you observe what the page does. This is a pattern that appears everywhere in systems design: don't trust the metadata, measure the behavior.

A natural shortcut would be to use the <link rel="canonical"> tag that many sites declare in their HTML. If two product URLs share the same canonical, they're the same content, and deduplication is trivial. In practice this fails badly: many sites omit canonical tags entirely, others set them incorrectly (pointing every page to the homepage), and others include tracking parameters in the canonical itself. At scale, you cannot depend on sites cooperating correctly.

The content fingerprint is ground truth. Two URLs that render the same visible content produce the same hash, regardless of what their HTML claims.


The React problem: why this is harder than it sounds

In a traditional server-rendered site, content fingerprinting is straightforward: make an HTTP request, read the response body, hash it. React and single-page applications break this completely.

What a crawler sees when it fetches a React page:

<div id="root"></div>
<script src="/static/js/main.abc123.js"></script>
<!-- The actual content (product name, price, images) doesn't exist yet.   -->
<!-- It will be assembled after JS executes and fetches data from an API.    -->

Hash the HTTP response of two different React product pages and you get the same hash, because the HTML shell is identical. Your deduplication system concludes they're the same page. They're not.

The only reliable solution is a headless browser (Puppeteer, Playwright, or a custom Chromium renderer) that loads the URL, executes JavaScript, waits for async data fetches to complete and for React's reconciliation to finish, then captures a fingerprint of what the user actually sees.

For React apps, parameters can live in three different places with different behaviors:

LocationBehavior
Query paramsSome drive API calls (non-neutral), some are analytics noise (neutral). Same MIQPS problem as server-rendered sites.
Hash fragments#section-id is never sent to the server. Invisible to a plain HTTP fetch. Only a headless browser sees them.
Path routing/shoes/red vs /shoes/blue: React Router maps these to components. Structurally different, handled at the routing layer.

The offline vs. realtime tradeoff

Since each parameter test requires a full headless browser render (5–15 seconds of wall time and significant compute), you can't run MIQPS in a live content processing path. Pinterest's answer is to separate concerns cleanly:

PhaseCadenceWhat happens
Content ingestionContinuousURLs written to a per-domain corpus in S3 as they're encountered. No analysis yet.
MIQPS computationOffline, periodicHeavy rendering work happens asynchronously. Results published to a config store.
URL normalizationRuntime, instantMIQPS map loaded into memory at startup. Each URL lookup is a fast in-memory read.
Why offline worksSlow-changingURL parameter conventions change on the order of weeks or months, so staleness is an acceptable tradeoff.

This is a classic pattern: pay the expensive cost once, amortize it across all future requests. The expensive part (rendering) scales with the number of domains. The cheap part (normalization) scales with the number of URLs, which is orders of magnitude larger.


The safety net: asymmetric risk tolerance

Any system that automatically computes configuration driving downstream behavior needs a guard against regressions. Pinterest's anomaly detection is designed around an important asymmetry:

Keeping a neutral parameter is harmless: you process slightly more URL variations than necessary. Dropping a non-neutral parameter silently corrupts your catalog: you start treating different products as duplicates. The two failure modes are not equivalent.

So the system is conservative by design. If a newly computed MIQPS would demote any previously non-neutral parameter to neutral, meaning it would start stripping something it used to keep, that change is flagged as anomalous. If enough patterns are flagged, the entire update is rejected and the previous version is retained. The system always errs toward over-keeping.


The mental model to take away

The URL shortener question tests whether you can hash a string. The deeper systems design problem tests whether you understand that identity is behavioral, not structural.

Two things are the same if they behave the same: if they render the same content, serve the same data, produce the same experience. What they look like on the surface, what metadata they claim, what structure they share, all of that is unreliable at scale. The only ground truth is observation.

This principle appears everywhere: in distributed systems (don't trust the clock, observe the event), in testing (don't trust the mock, test against real behavior), and here in URL deduplication. MIQPS is one of the cleaner real-world implementations of it.