Design the backend for Pinterest’s “Activity Targeting” feature: whenever a user performs an action (save a Pin, create a board, follow a user, click an ad, etc.) the system must, within five minutes, decide whether to push a notification to any other user who has “targeted” that activity. Targeting is defined as a saved search or board-follow that declares interest in future activities matching certain keywords, categories, or users. The service must scale to 400 M MAU, 2 B activities/day (≈ 25 k QPS write, 400 k QPS read at p99), and 5 B targeted subscriptions. Guarantee end-to-end latency ≤ 5 min from activity occurrence to notification delivery, 99.9 % availability, exactly-once notification semantics, and support for batching similar notifications into a single user-facing message. Outline the data model, event pipeline, matching engine, prioritised delivery scheduler, and fallback / retry strategy; provide rough capacity plans and discuss trade-offs among freshness, cost, and accuracy.