Serving Predictions via Firebase Cloud Messaging for Scale

PMLE By islever Editorial Last updated

Short answer

D Use Firebase Cloud Messaging to send personalized push notifications to registered user devices when their individual predicted balance falls below the threshold.

Question

Your team is building an application for a global bank that will be used by millions of customers. You built a forecasting model that predicts customers' account
balances 3 days in the future. Your team will use the results in a new feature that will notify users when their account balance is likely to drop below $25. How
should you serve your predictions?
    1. Create a Pub/Sub topic for each user. 2. Deploy a Cloud Function that sends a notification when your model predicts that a userג€™s account balance will drop below the $25 threshold.
    1. Create a Pub/Sub topic for each user. 2. Deploy an application on the App Engine standard environment that sends a notification when your model predicts that a userג€™s account balance will drop below the $25 threshold.
    1. Build a notification system on Firebase. 2. Register each user with a user ID on the Firebase Cloud Messaging server, which sends a notification when the average of all account balance predictions drops below the $25 threshold.
    1. Build a notification system on Firebase. 2. Register each user with a user ID on the Firebase Cloud Messaging server, which sends a notification when your model predicts that a userג€™s account balance will drop below the $25 threshold.
    Correct Answer

Key Takeaways

The main trap is assuming Pub/Sub can handle one-topic-per-user architectures; FCM is the scalable solution for individual push notifications.

Learn how to serve ML predictions to millions of users using Firebase Cloud Messaging (FCM) instead of Pub/Sub to avoid quota limits and ensure personalized delivery.

Common mistake: Candidates often choose Option A (Pub/Sub + Cloud Function) because it feels like a standard serverless pattern, failing to recognize that creating millions of topics hits hard quota limits and does not scale.

Expert Analysis

The Trap: Pub/Sub for Personalization Option A is the most attractive distractor because it attempts to provide a real-time, event-driven architecture using Cloud Functions and Pub/Sub. In many serverless scenarios, this pattern works well. However, the question specifies "millions of customers" and requires individual notifications based on specific user predictions. Creating a dedicated Pub/Sub topic for each of millions of users exceeds Google Cloud's hard quota limits (typically 10,000 topics per project) and makes subscription management impossible at scale. This violates the scalability constraint inherent in objective 4.2.

Why Firebase Cloud Messaging (FCM) is Correct Option D correctly utilizes Firebase Cloud Messaging (FCM), which is designed specifically for sending push notifications to mobile and web clients at scale. FCM allows you to register user devices with unique tokens or IDs and target messages to specific individuals without managing individual message queues for every user. It handles the delivery infrastructure, ensuring that when your model predicts a balance drop below $25, the notification reaches the correct device efficiently and cost-effectively.

Eliminating Other Options Option B suffers from the same Pub/Sub quota issue as Option A. Option C is incorrect because it sends notifications based on the average of all account balances, whereas the requirement is to notify users when their own predicted balance drops below the threshold. Therefore, D is the only option that satisfies both the technical constraints (scalability/quota) and the business logic (personalized alerts).

Official Reference

These links open the official vendor documentation in a new tab.

Exam Strategy

When designing solutions for 'millions' of users, always check service quotas first. If an option suggests creating one resource instance (like a Pub/Sub topic or Datastore entity) per user, it is likely incorrect due to scalability limits. Prefer managed messaging services like FCM for end-user notifications over building custom queue-per-user architectures.

Frequently Asked Questions

Why can't I create a Pub/Sub topic for each user?

Google Cloud enforces strict quotas on resources like Pub/Sub topics (typically 10,000 per project). Creating millions of topics would exceed these limits, making the architecture non-functional at scale.

What is the difference between Option C and Option D?

Option C sends notifications based on the average of all balances, which is not personalized. Option D targets specific users based on their individual predictions, meeting the requirement to notify users about their own accounts.

More PMLE FAQ →

Community Votes

D
91%
A
9%

91% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 19 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 19

  1. salsabilsf 👍 20
    Should be D ! creating a Pub/Sub topic for each user is overkill
  2. SlipperySlope 👍 9 Answered D
    D is correct. Firebase is designed for exactly this sort of scenario. Also, it would not be possible to create millions of pubsub topics due to GCP quotas https://cloud.google.com/pubsub/quotas#quotas https://firebase.google.com/docs/cloud-messaging
  3. fdmenendez 👍 4
    Project limit is 10,000 topics, you could have multiple projects but that does not scale well. so D. https://cloud.google.com/pubsub/quotas#resource_limits
  4. Danny2021 👍 4
    Answer is D. FCM is designed for this type of notification sent to mobile and desktop apps.
  5. Y2Data 👍 3
    Yes, create a topic is overkill but not a NOTIFICATION SYSTEM. it's totally normal. Seriously, the step two involves "REGISTER EACH USER ....", how is this better than create a topic???? should be A and it's so obvious!
Show 14 more comments
  1. Danny2021 👍 3
    A doesn't work. There is a quota limit on the number of pub/sub topics you can create, also one Cloud function cannot subscribe to millions of topics. A doesn't scale at all.
  2. q4exam 👍 3
    I think A is straight forward answer but in real life, customer also consider cost, so practically, app engine will be picked in this case..... because of the large user base
  3. NamitSehgal 👍 3
    D looks more relevant Notification messages: Simply display a message content, which is handled by the FCM SDK. Data Messages: Display a message with some set interactions
  4. Mohamed_Mossad 👍 3 Answered D
    "Create a Pub/Sub topic for each user" this is crazy , we can not imagine a system with millions of pub/sub topics , so A,B wrong C also wrong
  5. Kowalski 👍 3
    Pub/Sub has a limit of 10,000 topics only and can't be increased https://cloud.google.com/pubsub/quotas#resource_limits.
  6. Vidyasagar 👍 3 Answered D
    I think, D is the best answer
  7. SergioRubiano 👍 2 Answered D
    "Create a Pub/Sub topic for each user" xD
  8. OpenKnowledge 👍 1 Answered D
    This is similar to how the push notification works to send notifications to ios and android devices. Firebase cloud messaging (FCM), formerly known as Google cloud messaging (GCM), can be set to configure push notifications to ios, Android and web applications from server (in this case the banking application server) when the user registers his device to receive the notifications.
  9. taylz876 👍 1 Answered D
    D- You need to send a personalized push notification to each of millions of users, based on that user's own prediction. Firebase Cloud Messaging (FCM) is built for this. It's free, scales to millions of devices, and delivers a message to a specific user's phone. Registering each user with a user ID lets you target the notification at the right person.
  10. harithacML 👍 1 Answered A
    simple answer , use tools most mentioned during training . , cloud functions
  11. mmona19 👍 1 Answered D
    D- is more automated compared to A. A is overkill
  12. fragkris 👍 1 Answered D
    D is correct. Firebase is used for applications.
  13. PhilipKoku 👍 1 Answered D
    D) Firebase
  14. M25 👍 1 Answered D
    Went with D

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All PMLE Questions

Access 65 questions with complete answers and detailed explanations.

View Full PMLE Practice Test →

← Back to PMLE Study Guide