Design a Photo Match Notification Service
Use a supplied photo feed and face comparator to find enrolled users in new photos and send reliable match notifications.
Problem statement
Design a system that notifies an enrolled person when a new photo containing their appearance arrives from a supplied photo feed. The photo feed, a face-comparison algorithm and a notification service are already available; do not train the model or build the external social platform or notification provider.
A comparison result is the supplied model's match decision, not a claim of certain real-world identity.
For this exercise, assume each authenticated user may maintain one active, authorized self-reference photo. Enrollment creates a versioned watch; a committed activation sequence determines which newly accepted feed photos it covers. Existing photos before that boundary are outside scope.
The supplied feed assigns each photo ID exactly one immutable photo version and original event time, never reuses that ID, and reports removal. A genuinely changed photo has a new photo ID.
Redelivery keeps the original identity and may occur only within seven days of the original feed event; it cannot create a later version or a fresh lifetime under the old ID. The service records an immutable first durable admission time for each accepted photo; every repeat retains that time and its deadlines.
A supplied comparator evaluates a pinned reference version, photo version and model version and returns match, no-match or failure; bounded batching is available, but no unverified prefilter may silently skip required comparisons.
Preserve per-photo/watch processing coverage so an incomplete job never becomes a no-match result.
For this exercise, one logical notification is allowed per user and feed photo ID, including replays or model retries.
The notification provider durably deduplicates a supplied delivery key for its full retained delivery and reconciliation lifetime and supports status lookup; a timeout is uncertain and must be reconciled under that same key. Before authorizing a new send, check current watch authorization and photo availability.
Replacement revokes the previous watch generation; new authorization requires the still-active reference/watch version used by the comparison. Revocation or removal prevents new authorizations after its commit, while an already authorized external send may still complete.
Explain the weaker delivery guarantee if the provider cannot deduplicate. Use one region with multiple zones and durable work queues. Explain intake, enrollment boundaries, comparison work, match persistence, notification authorization, overload and recovery.
General face search, historical web crawling, model training and notification-channel implementation are excluded.
What to build
- An authorized user can enroll, replace or revoke their self-reference watch and inspect its activation boundary and processing state.
- The service accepts new photo events durably, compares every eligible watch under pinned versions and distinguishes complete no-match coverage from pending or failed work.
- A valid match creates one logical user/photo notification with durable pending, uncertain, delivered or suppressed state and current authorization checks.
At scale
- For this exercise, assume 1000 active watches and 100 newly accepted photos per second normally, with short bursts of 500 photos per second. Comparing every active watch requires about 100000 comparisons per second at normal load.
- For this exercise, the supplied matcher supports batches of at most 1000 pairs and a shared quota of 120000 pair evaluations per second. Do not claim the fivefold burst can drain immediately within that quota.
- For this exercise, when supplied dependencies are healthy, make 99 percent of normal-load matches ready for notification within five minutes. Expose backlog age, incomplete coverage and dependency failures separately.
- For this exercise, a photo reference remains readable until 48 hours after its first durable service admission. Comparison-work admission and new send authorization expire 24 hours after that same immutable admission time; redelivery never resets either deadline. The supplied feed only redelivers an immutable photo ID within seven days of its original event. Retain intake IDs, removal tombstones and settled user/photo delivery identities for at least 30 days after first admission, and retain every uncertain delivery key until it has a definitive outcome even if that takes longer. A new photo version requires a new photo ID.