Quotas

This document describes the quota limits for Google Cloud Pub/Sub.

Rate Limits

The following table lists the rate limits on Google Cloud Pub/Sub operations:

Description Max Quota Default Quota
Publisher throughput unlimited
10,000,000 kB per 100 seconds (100 MB/s)
Subscriber throughput unlimited
20,000,000 kB per 100 seconds (200 MB/s)
Ack and ModifyAckDeadline throughput unlimited
20,000,000 kB per 100 seconds (200 MB/s)
Push subscriber throughput unlimited
20,000,000 kB per 100 seconds (200 MB/s)
Administrative operations 10,000 per 100 seconds (100 ops/s)
1,000 per 100 seconds (10 ops/s)

Notes:

  • You can increase your quotas from the API Manager in the Cloud Platform Console..
  • For Publisher throughput, quota usage is measured as the number of kilobytes per second sent in Publish requests. Every Publish call counts as the greater of 1 kilobyte and the total size of the request. Note that multiple messages can be included in a single Publish request, and there is no additional quota charge per message. The quota usage for each request is rounded down to the nearest kilobyte. For example, if a Publish request contains 100 messages of 50 bytes each, and the length of the topic name in the request is 30 bytes, then the quota usage of the request is max(1, floor(5030/1000)) = 5kB.
  • For Subscriber throughput, Ack and ModifyAckDeadline throughput, and Push Subscriber throughput, quota usage is measured as the number of kilobytes per second associated with receiving messages. For pull subscriptions, it is measured as the size of Pull responses, and the size of Acknowledge and ModifyAckDeadline requests. For push subscriptions, it is measured as the size of requests to the push endpoint. Each request or response, respectively, counts as the greater of 1 kilobyte and the total size of the request or response. The quota usage for each request or response is rounded down to the nearest kilobyte.
  • For push delivery requests made to the push endpoint, quota is charged against the project that contains the push subscription.
  • You can monitor the current quota utilization per topic or subscription by tracking the pubsub.googleapis.com/topic/byte_cost and pubsub.googleapis.com/subscription/byte_cost metrics respectively. Note that these metrics are in bytes, whereas the quota specification is in kilobytes.
  • The administrative operations consist of Get, List, Create, Delete, ModifyPushConfig, SetIamPolicy, GetIamPolicy, TestIamPermissions.

Project usage attribution

For Publish, Pull, Acknowledge, ModifyAckDeadline, and all the administrative operations, quota is charged against the project associated with the caller's credentials, not against the project that contains the requested resource (i.e. the project that appears in the topic or subscription name). Every request contains credentials that include a project ID. So, 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.

In particular, when using the Google Cloud SDK gcloud tool with a normal user account, Pub/Sub operations are limited to a rate suitable for manual operations. This may cause you to exceed quota, resulting in the error RESOURCE_EXHAUSTED. The solution is to make sure that you are using service account credentials. If you wish to use credentials from the Google Cloud SDK for automation, activate a service account for your Cloud Pub/Sub operations.

Other Limits

The following table lists other Google Cloud Pub/Sub limits:

Component(s) Limit
Project Can contain no more than 10,000 topics.
Can contain no more than 10,000 subscriptions.
Topic May have up to 10,000 subscriptions attached to it.
Subscription Retains unacknowledged messages in persistent storage for 7 days from the moment they were published. Subscriptions whose client presence has not been detected for 30 days may be automatically deleted. Presence is detected through calls such as Pull, Acknowledge, or successful push calls.
Publish request Total size must be no more than 10MB .
Must contain no more than 1,000 messages.
Message The maximum number of attributes per message is 100.
The maximum size of an attribute key is 256 bytes.
The maximum size of an attribute value is 1024 bytes.

Send feedback about...

Cloud Pub/Sub Documentation