Design Notification Ranking

Free with account Updated Nov 16, 2026 · 17 min read
On this page

    Problem Description

    In this interview, we're going to design the system that decides which push notifications a social app sends, similar to the notifications from Facebook or Instagram. Many things happen that a user might want to hear about: a friend posts a photo, someone comments on their post or likes it, a friend has a birthday, someone new follows them. Each of these is a possible notification. For each one, the system decides whether to send it to the user's phone now, later, or not at all, so users get the notifications they care about without being overwhelmed; a user who gets too many turns notifications off. Users open notifications, ignore them, swipe them away, or turn some or all of them off, and the system keeps learning from what they do. You can use existing building blocks: the app's product services, which create a possible notification for each event, and a push service that delivers a notification to a phone, such as Apple's and Google's push services. This interview is about deciding which notifications to send and when, not about delivering them.

    Out of Scope

    • The in-app list of notifications (the bell) – it shows everything, newest first; ranking it is a good follow-up question.
    • Email and SMS – other channels with their own limits.
    • Writing the notification text – the product services provide it.
    • Delivering to phones – the push service does this.
    • Direct messages and security alerts – their own services send them at once, always; they never reach us.

    Good Clarifying Questions

    1. How many users and possible notifications? – About 500 million daily users, with about 50 possible notifications per user per day. A post by an account with 50 million followers can create 50 million at once.
    2. What does "care about" mean for the business? – Users open notifications that bring them back to the app, and keep coming back over weeks. A user turning notifications off is the worst outcome: we lose the channel for good.
    3. How quickly must notifications go out? – A reply or comment on the user's own post within a minute. Others can wait a few hours for a better moment.
    4. Are there limits per user? – Product rules: at most 6 push notifications a day, none during the user's night (10 pm to 8 am their time), never the same thing twice. The system may send fewer.
    5. What if the model is down? – Fall back to simple rules that send only the most important kinds (replies and comments on the user's own posts) within the limits; never send everything.

    Requirements

    Functional Requirements

    1. Decide What to Send – For each possible notification, the system decides to send it now, hold it for a better moment, or drop it, so each user gets the ones they care about most.
    2. Respect the Limits – The system never sends a user more than 6 notifications a day, never during their night, and never the same thing twice.
    3. Record What Users Do – The system records which notifications were sent and what each user did: opened, swiped away, ignored, or turned a kind of notification or all of them off.
    4. Keep Learning – The system trains a new model from these records at least daily and uses it only after it proves at least as good as the current one.

    Non-Functional Requirements

    1. Scale – 500M daily users × 50 = 25B possible notifications a day: about 290K/s on average, 900K/s at peak; one popular post can add 50M at once.
    2. Latency – A decision within 5 seconds of a notification arriving; replies and comments on the user's own posts delivered within 1 minute.
    3. Freshness – What a user did in the last minutes (opened the app, already saw the post) counts at the decision; a new model at least daily.
    4. Availability – 99.9%. If the model or the feature store is down, simple rules send only replies and comments within the limits; never a flood.