Google Cloud · Data Analytics

Pub/Sub

A global messaging service: publishers send to topics, every subscription gets a copy, delivered at least once by push or pull.

On the Google Cloud Associate Cloud Engineer exam listPublish and subscribeQueueingEvent routing

What it is and what problem it solves

Pub/Sub decouples services with topics and subscriptions. Publishers send messages to a topic; each subscription receives every message and delivers it to subscribers by pull or push (HTTPS). Subscribers acknowledge messages before an ack deadline or they're redelivered; delivery is at least once (exactly-once is available for pull subscriptions). Ordering keys, dead-letter topics, filters and retention support reliable event-driven designs.

When to use it

  • Fan-out of events to several independent consumers.
  • Streaming data into Dataflow and BigQuery.
  • Buffering bursts between producers and slower consumers.

When to avoid it

  • Rate-limited calls to a single endpoint with scheduling: Cloud Tasks.
  • Apache Kafka compatibility requirements: Managed Service for Apache Kafka.

Limits and quotas

ItemValueContextSource
Maximum message size 10 MB
Fixed limit
Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Cost model

What you pay for

  • Throughput (data published and delivered) per TiB.
  • Message retention storage and cross-region egress.

Where it is cost-efficient

High-volume event delivery replacing polling and point-to-point integrations.

Where costs grow

Large messages sent to many subscriptions; long retention on high-volume topics.

Cost controls and common surprises

Keep messages small (store payloads in Cloud Storage), filter subscriptions, and set retention sensibly.

Prices differ by Region and change over time; see the pricing page linked under Sources.

Security

Controls the service provides

IAM on topics and subscriptions; encryption at rest (CMEK optional); authenticated push with OIDC tokens.

What you configure

Separate publisher and subscriber permissions, verify push tokens, and keep consumers idempotent.

Exam cues and common confusions

  • Fan-out, decoupling, streaming ingestion: Pub/Sub.
  • Not acknowledged before the deadline: redelivered; consumers must be idempotent.
  • Poison messages: a dead-letter topic with max delivery attempts.

Related

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Google. Google Cloud and service names are trademarks of Google LLC.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake