diff --git a/src/content/changelog/queues/2025-04-17-pull-consumer-limits.mdx b/src/content/changelog/queues/2025-04-17-pull-consumer-limits.mdx new file mode 100644 index 000000000000000..a15081d5a9e4c85 --- /dev/null +++ b/src/content/changelog/queues/2025-04-17-pull-consumer-limits.mdx @@ -0,0 +1,30 @@ +--- +title: Increased limits for Queues pull consumers +description: Queues now supports consuming up to 5,000 messages per second per queue over HTTP. +products: + - queues +date: 2025-04-17 12:00:00 UTC +--- + +[Queues pull consumers](/queues/configuration/pull-consumers/) can now pull and acknowledge up to **5,000 messages per second per queue**. Previously, pull consumers were rate limited to 1200 requests / 5 minutes, aggregated across all queues. + +Pull consumers allow you to consume messages over HTTP from any environment—including outside of [Cloudflare Workers](/workers). They’re also useful when you need fine-grained control over how quickly messages are consumed. + +To setup a new queue with a pull based consumer using [Wrangler](/workers/wrangler/), run: +```bash title="Create a queue with a pull based consumer" +$ npx wrangler queues create my-queue +$ npx wrangler queues consumer http add my-queue +``` +You can also configure a pull consumer using the [REST API](/api/resources/queues/subresources/consumers/methods/create/) or the Queues dashboard. + +Once configured, you can pull messages from the queue using any HTTP client. You'll need a [Cloudflare API Token](/fundamentals/api/get-started/create-token/) with `queues_read` and `queues_write` permissions. For example: +```bash title="Pull messages from a queue" +curl "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/queues/${QUEUE_ID}/messages/pull" \ +--header "Authorization: Bearer ${API_TOKEN}" \ +--header "Content-Type: application/json" \ +--data '{ "visibility_timeout": 10000, "batch_size": 2 }' +``` + +To learn more about how to acknowledge messages, pull batches at once, and setup multiple consumers, refer to the [pull consumer documentation](/queues/configuration/pull-consumers). + +As always, Queues doesn't charge for data egress. Pull operations continue to be billed at the [existing rate](/queues/platform/pricing), of $0.40 / million operations. The increased limits are available now, on all new and existing queues. If you're new to Queues, [get started with the Cloudflare Queues guide](/queues/get-started). diff --git a/src/content/docs/queues/configuration/pull-consumers.mdx b/src/content/docs/queues/configuration/pull-consumers.mdx index 69a6ef5c2c5a5a0..d5356d3a2656a69 100644 --- a/src/content/docs/queues/configuration/pull-consumers.mdx +++ b/src/content/docs/queues/configuration/pull-consumers.mdx @@ -96,7 +96,7 @@ curl "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/queues/${QU --data '{ "visibility_timeout": 10000, "batch_size": 2 }' ``` -You may authenticate and run multiple concurrent pull-based consumers against a single queue, noting that all consumers will share the same [rate limit](/queues/platform/limits/) against the Cloudflare API. +You may authenticate and run multiple concurrent pull-based consumers against a single queue. ### Create API tokens @@ -248,7 +248,7 @@ Additionally: - You should provide every `lease_id` in the request to the `/ack` endpoint if you are processing those messages in your consumer. If you do not acknowledge a message, it will be marked for re-delivery (put back in the queue). - You can optionally mark messages to be retried: for example, if there is an error processing the message or you have upstream resource pressure. Explicitly marking a message for retry will place it back into the queue immediately, instead of waiting for a (potentially long) `visibility_timeout` to be reached. -- You can make multiple calls to the `/ack` endpoint as you make progress through a batch of messages, but we recommend grouping acknowledgements to avoid hitting [API rate limits](/queues/platform/limits/). +- You can make multiple calls to the `/ack` endpoint as you make progress through a batch of messages, but we recommend grouping acknowledgements to reduce the number of API calls required. Queues aims to be permissive when it comes to lease IDs: if a consumer acknowledges a message by its lease ID _after_ the visibility timeout is reached, Queues will still accept that acknowledgment. If the message was delivered to another consumer during the intervening period, it will also be able to acknowledge the message without an error. diff --git a/src/content/docs/queues/platform/limits.mdx b/src/content/docs/queues/platform/limits.mdx index 4ff9c3c4a29369c..5b648e69160bdaf 100644 --- a/src/content/docs/queues/platform/limits.mdx +++ b/src/content/docs/queues/platform/limits.mdx @@ -25,8 +25,7 @@ import { Render, WranglerConfig } from "~/components" | [Consumer CPU time](/workers/platform/limits/#cpu-time)| 30 seconds (default). [Configurable to 5 minutes](/queues/platform/limits/#increasing-queue-consumer-worker-cpu-limits) | | `visibilityTimeout` (pull-based queues) | 12 hours | | `delaySeconds` (when sending or retrying) | 12 hours | -| Requests to the Queues API (incl. pulls/acks) | [1200 requests / 5 mins](/fundamentals/api/reference/limits/) | - +| Requests to the Queues API (excluding pull consumer operations)6 | [1200 requests / 5 mins](/fundamentals/api/reference/limits/) | 1 1 KB is measured as 1000 bytes. Messages can include up to \~100 bytes of internal metadata that counts towards total message limits. @@ -39,6 +38,8 @@ import { Render, WranglerConfig } from "~/components" 5 Refer to [Workers limits](/workers/platform/limits/#cpu-time). +6 [Pull Consumers](/queues/configuration/pull-consumers) allow you to consume messages from a queue over HTTP. Pulls, acknowledgements, and retries over HTTP are not subject to the API rate limit. + ### Increasing Queue Consumer Worker CPU Limits diff --git a/src/content/release-notes/queues.yaml b/src/content/release-notes/queues.yaml index 06ed826318558f7..d066e4fbf5e33d2 100644 --- a/src/content/release-notes/queues.yaml +++ b/src/content/release-notes/queues.yaml @@ -5,6 +5,12 @@ productLink: "/queues/" productArea: Developer platform productAreaLink: /workers/platform/changelog/platform/ entries: + - publish_date: "2025-04-17" + title: Improved limits for pull consumers + description: |- + [Queues Pull Consumers](/queues/configuration/pull-consumers/) can now pull and acknowledge up to 5,000 messages per second per queue. Previously, pull consumers were rate limited to 1200 requests / 5 minutes, aggregated across all queues. + + Refer to the [documentation on pull consumers](/queues/configuration/pull-consumers/) to learn how to setup a pull consumer, acknowledge / retry messages, and setup multiple consumers. - publish_date: "2025-03-27" title: Pause delivery and purge queues description: |-