Design Identity Resolution from Third-Party Logs
Design the part of an ads platform that reads activity logs sent by outside partners, works out which hashed (scrambled one way) emails, phone numbers and device IDs belong to the same person, gives each person a stable ID that other systems can look up, and keeps that answer right as new logs join people together and opt-outs or bad files pull them apart.
Problem statement
Design identity resolution for an ads platform: working out which records from different sources belong to the same person, using logs that come from third parties.
For this exercise, assume about 100 outside partners, such as data providers, measurement partners (companies that count what people do after seeing ads) and advertisers, send log files of user activity every hour or every day.
Each row carries one or more identifiers for the person behind it: a hashed email, a hashed phone number, a mobile advertising ID (a resettable ID that a phone gives apps for ads), or the partner's own user ID.
Emails and phone numbers arrive already hashed (scrambled one way, so the original cannot be read back), and different partners send different identifiers.
Also assume matching is deterministic: two identifiers on the same row of an accepted file belong to the same person, and so does everything linked to them through other rows. The platform must: - Group linked identifiers into people and give each person one stable person ID.
- Let other ads systems, such as measurement and audience building (making lists of people to show ads to), look up the person ID for any identifier. - Keep the groups current as new files arrive, which can join two people into one.
- Remove links when someone opts out or asks for deletion, or when a partner withdraws a bad file, which can split one person into several.
Start with the requirements, the data, the APIs and the overall architecture. Then go deeper on when to merge and which ID survives, and on how removals and splits work.
For this exercise, assume ad serving, attribution (deciding which ad gets credit for a sale), building audiences, probabilistic matching (guessing from signals such as IP address or device model) and collecting consent stay outside this design; opt-outs reach the platform as requests.
What to build
- Partners deliver log files. The platform checks every row, keeps the identifiers it can use, and reports rejected rows back to the partner. Delivering the same file twice has no extra effect.
- Identifiers linked by accepted rows are grouped into people, each with a stable person ID. A new link that connects two people merges them into one.
- Other ads systems look up the person ID for any identifier, one at a time or in batches.
- Opt-outs, deletion requests and withdrawn partner files remove identifiers and links, splitting people where needed, and other systems are told about every merge and split.
At scale
- For this exercise, assume partners send about 3 billion rows a day in total, peaking at about 100,000 rows a second when large daily files land, and that the platform knows about 2 billion distinct identifiers belonging to about 600 million people.
- For this exercise, assume other ads systems make about 300,000 lookups a second at their busiest and need an answer within 20 ms for 99 out of 100 lookups (p99), and that links from a new file show in lookups within about 4 hours of the file arriving.
- For this exercise, assume an opt-out or deletion request must take effect in lookups within 24 hours and must never be undone by a later or replayed file, and raw partner files are kept for 30 days.