Professional Data EngineerDesigning data processing systemsEasy

A startup is building a new mobile application that generates user activity logs. They expect rapid growth, potentially leading to millions of events per second. The application needs a highly available and durable messaging service to decouple event producers from consumers, allowing for flexible scaling of downstream analytics and machine learning systems. The service must also handle message retention for at least 7 days for reprocessing in case of consumer failures. Which Google Cloud service is the most appropriate for this messaging requirement?

  1. ACloud Storage
  2. BCloud Pub/Sub
  3. CCloud Tasks
  4. DCloud SQL
Show answer & explanation

Correct answer: B. Cloud Pub/Sub

Cloud Pub/Sub is a fully managed, globally scalable, and durable messaging service designed for high-throughput event ingestion and delivery. It decouples senders and receivers, supports millions of events per second, and offers configurable message retention (up to 7 days by default, or longer with Pub/Sub Lite), making it ideal for this scenario.

Why the other options are wrong

  • A. Cloud Storage is an object storage service, not a messaging queue for real-time event streaming and delivery.
  • C. Cloud Tasks is designed for asynchronous task execution and queueing, not for high-throughput, real-time message streaming from millions of event producers.
  • D. Cloud SQL is a relational database, not suitable for high-throughput messaging from millions of event producers or for message queueing patterns.

Cloud Pub/Sub for Event Ingestion

A fully managed, globally scalable, and durable messaging service that enables asynchronous communication between independent applications, acting as a real-time event bus.

  • Decouples publishers and subscribers.
  • Scales automatically to millions of events/second.
  • Offers durable message storage and guaranteed delivery.
  • Supports message retention (default 7 days, configurable).
  • Ideal for real-time data ingestion, streaming analytics, and event-driven architectures.

Memory trick: To send a 'Pub/Sub' message, think of a global post office that never loses a letter, no matter how many are sent.

More Designing data processing systems questions