Choosing Pub/Sub or Pub/Sub Lite

This page is intended to help you choose between Pub/Sub and Pub/Sub Lite.

Pub/Sub and Pub/Sub Lite are both horizontally scalable, managed messaging services. Pub/Sub should be the default solution for most application integration and analytics use cases. Pub/Sub Lite is only recommended for applications where achieving extremely low cost justifies some additional operational work.

Pub/Sub offers a broader range of features, per-message parallelism, global routing, and automatically scaling resource capacity.

Pub/Sub Lite can be as much as an order of magnitude less expensive, but offers lower availability and durability. In addition, Pub/Sub Lite requires you to manually reserve and manage resource capacity.

For example, the cost difference for a system with a single subscription (each message is intended to be read once) can be 85% cheaper. To make this concrete, if you published and received 1 MiB/s (60 MiB/min, or 2.5 TiB/mo) of data and stored messages for 24 hours (84 GiB/mo of storage capacity), Pub/Sub Lite cost would be $30/mo compared to $200/mo with Pub/Sub.

For details on the cost differences between Pub/Sub and Pub/Sub Lite, see Pub/Sub Lite pricing.

Comparison table

Feature Pub/Sub Pub/Sub Lite
Message replication Multi-zone in single region Single zone
Capacity Automatically provisioned Provision before you use
Pricing Pay for the capacity that you use Pay for the capacity that you provision
Storage Unlimited 30 GiB-10 TiB per Lite topic
Retention period Up to 7 days Unlimited
Service endpoints Global and regional Regional
Resource namespace Global Zonal
Message routing Global Zonal

Message routing

Pub/Sub routes messages globally. Applications hosted in any region can publish messages to a single topic. These are processed in the nearest region permitted by your organization policies and forwarded to subscribers independently of the source.

Pub/Sub Lite routes messages zonally. Subscribers must connect to the instance of the service in the region where the topic is located. As a result, publishers and subscribers must maintain network connectivity to the same region to communication. Publishers can publish data to any topic from anywhere, but this may require connecting to a remote region, adding network latency. Subscribers that need aggregate data published to topics in different locations must connect to every relevant local service instance to read the messages.

Resource namespace

Pub/Sub topics and subscriptions are global resources. The Pub/Sub service can store messages in any region allowed by a topic storage policy. In addition, a topic and a subscription to that topic can be stored in different projects, allowing for fine-grained billing and access control. Finally, subscribers get the same data regardless of which service endpoint they use to connect to Pub/Sub or which service endpoint was used by the publisher of the data.

Pub/Sub Lite topics and subscriptions are zonal resources that must be in the same Cloud project and zone. If you run a publisher or subscriber on Google Cloud, the application can run in a different Cloud project from the Cloud project that the Lite topic and Lite subscription are in. For a list of zones that Pub/Sub Lite supports, see Pub/Sub Lite locations.

Capacity management

Pub/Sub scales automatically. Capacity for message publishing is automatically provisioned, so you can send and receive message at any rate, up to the quotas you configure for your project.

Pub/Sub Lite storage is manually provisioned. You must manually provision the capacity to publish messages to Lite topics, receive messages from Lite topics, and store messages in Lite topics. When you create a Lite topic, you specify the number of partitions and the storage per partition. You can scale the capacity of partitions to increase the capacity of a Lite topic.

Delivery Modes

Pub/Sub supports multiple message delivery modes. These include Pull (traditional polling), Push (HTTPS POST), StreamingPull (bidirectional RPC, for lowest latency and highest efficiency), and pull over HTTP REST and gRPC.

Pub/Sub Lite only supports streaming gRPC pull message delivery. To request messages, subscribers establish bidirectional streaming connections with each partition.

Parallelism

Pub/Sub uses per-message parallelism. This enables concurrent processing of any number of messages, from one or thousands of clients for a single subscription.

Pub/Sub Lite uses partition-based parallelism. This forces a client to process each data partition in linear order on a single client instance. This limits the maximum number of client instances to at most the number of partitions.

Streaming pipelines

Both Pub/Sub and Pub/Sub Lite are integrated with Dataflow for serverless stream processing and data integration. Pub/Sub allows Dataflow to scale more flexibly and supports Dataflow SQL.

To get started with Dataflow and Pub/Sub or Pub/Sub Lite, try these tutorials: