Quotas and limits

This document provides information about quotas and resource limits for Pub/Sub.

For more information about tracking your quotas (such as topic or subscription utilization), see Monitoring.

Viewing quota usage and managing quota limits

For a given project, you can use the APIs and services quotas dashboard to view current quotas and usage. You can also use this dashboard to modify one quota at a time.

To modify multiple quotas, use the IAM & admin quotas dashboard

You can use either of the above dashboards to:

  • Reduce your quotas.
  • Initiate a process to apply for higher quota limit(s).

Project usage attribution

For push subscriber throughput, quota usage is charged against the project that contains the push subscription.

For the following quotas, usage is charged against the project associated with the caller's credentials, not against the project that contains the requested resource (that is, the project that appears in the topic or subscription name):

  • Publisher throughput
  • Subscriber throughput
  • Administrator operations

For example: If a service account in project A sends a publish request to publish to a topic in project B, the quota is charged to project A. Every request contains credentials that include a project ID.

Quota limits

The quotas listed in the following table can be viewed and edited on a per-project basis in the APIs and services quotas dashboard.

Regional quotas are divided into 2 types:

  • Large regions: europe-west1, us-central1, us-east1
  • Small regions: all other regions

Quota Default quota limit Description
Publisher throughput per region
  • 12,000,000 kB per minute (200 MB/s) in large regions
  • 3,000,000 kB per minute (50 MB/s) in small regions
Quota usage is based on the size of the published PubsubMessages:

Note that multiple messages can be included in a single publish request, and there is no additional quota charge per message.

If messages have ordering keys, the maximum publisher throughput is 1 MB/s per ordering key.

Pull subscriber throughput per region
  • 24,000,000 kB per minute (400 MB/s) in large regions
  • 6,000,000 kB per minute (100 MB/s) in small regions
Quota usage is based on the size of the returned PubsubMessages:
Acknowledger throughput per region
  • 24,000,000 kB per minute (400 MB/s) in large regions
  • 6,000,000 kB per minute (100 MB/s) in small regions
Quota usage is based on the size of Acknowledge and ModifyAckDeadline requests:
Push subscriber throughput per region
  • 1,200,000 kB per minute (20 MB/s) in large regions
  • 300,000 kB per minute (5 MB/s) in small regions
For push delivery requests made to the push endpoint, quota usage is based on the size of the PubsubMessages sent to the push endpoint.
StreamingPull subscriber throughput per region
  • 24,000,000 kB per minute (400 MB/s) in large regions
  • 6,000,000 kB per minute (100 MB/s) in small regions
Quota usage is based on the size of the PubsubMessages streamed to the subscriber:

Note that Client Libraries use StreamingPull operations where possible.

Number of open StreamingPull connections per region
  • 24,000 open connections at a time in large regions
  • 6,000 open connections at a time in small regions
The number of open StreamingPull connections at any given time. See StreamingPull.
Administrator operations 6,000 per minute (100 ops/s) Each administrator operation, such as GetTopicRequest , charges one unit against this quota.

Get*, List*, Create*, Delete*, ModifyPushConfig, SetIamPolicy, GetIamPolicy, TestIamPermissions, and DetachSubscription are administrator operations.

Throughput quota units

Throughput quota usage is measured in 1kB units. 1 kB is 1000 bytes. For example, in a PublishRequest with 105 messages of 50 bytes each, the user data size is 105 * 50 bytes = 5250 bytes, so the quota usage is max(1kB, ceil(5250 bytes/1000)) = 6kB.

Resource limits

Resource Limits
Project 10,000 topics
10,000 attached or detached subscriptions
5,000 snapshots
Topic 10,000 attached subscriptions
5,000 attached snapshots
Subscription Retains unacknowledged messages in persistent storage for 7 days from the moment of publication. There is no limit on the number of retained messages.
If subscribers don't use a subscription, the subscription expires. The default expiration period is 31 days.
Publish request 10MB (total size)
1,000 messages
Message Message size (the data field): 10MB
Attributes per message: 100
Attribute key size: 256 bytes
Attribute value size: 1024 bytes
Push outstanding messages

3,000 * N by default.

30,000 * N for subscriptions that acknowledge >99% of messages and average <1s of push request latency.

N is the number of publish regions. For more information, see Using push subscriptions.

StreamingPull streams 10 MB/s per open stream
Pull/StreamingPull messages The service might impose limits on the total number of outstanding StreamingPull messages per connection. If you run into such limits, increase the rate at which you acknowledge messages and the number of connections you use.

Tips and caveats

High-volume operations

If you use the Cloud SDK gcloud tool with a normal user account (that is, a non-service account), Pub/Sub operations are limited to a rate suitable for manual operations. Rates in excess of this limit will result in the RESOURCE_EXHAUSTED error. The solution is to make sure that you are using service account credentials. If you wish to use credentials from the Cloud SDK for automation, activate a service account for your Pub/Sub operations.

Endpoints

If you have additional quota in particular regions, you can route requests to these regions using regional Pub/Sub endpoints. When you publish messages to a global endpoint, the Pub/Sub service might route traffic to a region that does not have sufficient quota.

Quota mismatches

Quota mismatches can happen when published or received messages are smaller than 1000 bytes. For example:

  • If you publish 10 500-byte messages in separate requests, your publisher quota usage will be 10,000 bytes. This is because messages that are smaller than 1000 bytes are automatically rounded up to the next 1000-byte increment.

  • If you receive those 10 messages in a single pull response, your subscriber quota usage might be only 5 kB, since the actual size of each message is combined to determine the overall quota.

  • The inverse is also true. The subscriber quota usage might be greater than the publisher quota usage if you publish multiple messages in a single publish request or receive the messages in separate Pull requests.