Cloud · GCP

Cloud Pub/Sub (and vs Kafka)

gcpMediumgcppubsubkafkamessagingstreaming

Interview question

What is Google Cloud Pub/Sub, and how does it compare to Kafka?

How to answer

The short answer

Cloud Pub/Sub is GCP's managed messaging / event ingestion service. Publishers send messages to a topic; subscriptions deliver those messages to subscribers (push or pull).

Pub/Sub properties

  • Fully managed; no brokers to run
  • (design consumers idempotent)
  • Fan-out via multiple subscriptions on one topic
  • Great front door into Dataflow / BigQuery streaming inserts

Pub/Sub vs Kafka

DimensionPub/SubKafka
ModelTopic + subscriptionsTopic + +
OpsFully managed GCPSelf-managed or managed Kafka
ReplaySeek / snapshot patterns; retention limitsFirst-class log replay via offsets
OrderingPer ordering key (optional); not globalPer partition
EcosystemGCP-nativeBroad streaming ecosystem
Best fitGCP event bus, fan-out, serverlessDurable log, complex stream processing

Interview tip: "Pub/Sub = managed publish/subscribe on GCP; Kafka = durable partitioned log." Emphasize fan-out subscriptions vs Kafka consumer groups, and always mention idempotent consumers.