Design Viral Comment Notification Aggregation
Send per-comment push notifications for ordinary content while aggregating viral comment bursts and enforcing per-owner limits.
Problem statement
Design comment notifications for a content platform: ordinary content creates one eligible push per comment, while content that crosses a viral threshold aggregates comment activity and shares a per-owner notification limit.
For this exercise, assume durable at-least-once comment events, idempotent fanout, a configurable aggregation window, owner preferences, and a bounded workload.
What to build
- For an ordinary content item, create one eligible push notification for each new comment.
- For a viral content item, aggregate comments into a bounded-window summary instead of one push per comment.
- Enforce per-owner notification limits across all content items without losing durable comment history.
- Respect mute, digest, and push-disabled preferences at send time, and recover from retries or provider failures without duplicate user-visible pushes.
At scalePractice assumption
- 200,000 comment events per second at peak and one viral content item may receive 20,000 comments per minute.
- Aggregate viral comments in a configurable five-minute window.
- Send at most three comment pushes to one owner in ten minutes, with excess activity represented by the next aggregate.
- Notification events are durable at least once; end-to-end push is best effort after eligibility is committed.