Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queues throughput & concurrency changes #16953

Merged
merged 10 commits into from
Sep 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ To configure the concurrency settings for your consumer Worker from the dashboar
2. Select **Workers & Pages** > **Queues**.
3. Select your queue > **Settings**.
4. Select **Edit Consumer** under Consumer details.
5. Set **Maximum consumer invocations** to a value between `1` and `10`. This value represents the maximum number of concurrent consumer invocations available to your queue.
5. Set **Maximum consumer invocations** to a value between `1` and `250`. This value represents the maximum number of concurrent consumer invocations available to your queue.

To remove a fixed maximum value, select **auto (recommended)**.

Expand Down Expand Up @@ -97,7 +97,7 @@ To remove the limit, remove the `max_concurrency` setting from the `[[queues.con
### wrangler CLI

```sh
# where `N` is a positive integer between 1 and 10
# where `N` is a positive integer between 1 and 250
wrangler queues consumer update <script-name> --max-concurrency=N
```

Expand All @@ -120,7 +120,3 @@ Billing for consumers follows the [Workers standard usage model](/workers/platfo
### Example

A consumer Worker that takes 2 seconds to process a batch of messages will incur the same overall costs to process 50 million (50,000,000) messages, whether it does so concurrently (faster) or individually (slower).

```

```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Cloudflare Queues is integrated with [Cloudflare Workers](/workers). To send and

A Worker that can send messages to a Queue is a producer Worker, while a Worker that can receive messages from a Queue is a consumer Worker. It is possible for the same Worker to be a producer and consumer, if desired.

In the future, we expect to support other APIs, such as HTTP endpoints to send or receive messages. To report bugs or request features, go to the [Cloudflare Community Forums](https://community.cloudflare.com/c/developers/workers/40). To give feedback, go to the [`#queues-beta`](https://discord.cloudflare.com) Discord channel.
In the future, we expect to support other APIs, such as HTTP endpoints to send or receive messages. To report bugs or request features, go to the [Cloudflare Community Forums](https://community.cloudflare.com/c/developers/workers/40). To give feedback, go to the [`#queues`](https://discord.cloudflare.com) Discord channel.

## Producer

Expand Down
14 changes: 5 additions & 9 deletions src/content/docs/queues/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ To use Queues, you will need:

<Render file="prereqs" product="workers" />

## 1. Enable Queues

<Render file="enable-queues" />

## 2. Create a Worker project
## 1. Create a Worker project

You will access your queue from a Worker, the producer Worker. You must create at least one producer Worker to publish messages onto your queue.

Expand Down Expand Up @@ -52,7 +48,7 @@ Move into the newly created directory:
cd producer-worker
```

## 3. Create a queue
## 2. Create a queue

To use queues, you need to create at least one queue to publish messages to and consume messages from.

Expand All @@ -68,7 +64,7 @@ Queue names must be 1 to 63 characters long. Queue names cannot contain special

You cannot change your queue name after you have set it. After you create your queue, you will set up your producer Worker to access it.

## 4. Set up your producer worker
## 3. Set up your producer worker
maheshwarip marked this conversation as resolved.
Show resolved Hide resolved

To expose your queue to the code inside your Worker, you need to connect your queue to your Worker by creating a binding. [Bindings](/workers/runtime-apis/bindings/) allow your Worker to access resources, such as Queues, on the Cloudflare developer platform.

Expand Down Expand Up @@ -140,7 +136,7 @@ Copy your `*.workers.dev` subdomain and paste it into a new browser tab. Refresh

You have built a queue and a producer Worker to publish messages to the queue. You will now create a consumer Worker to consume the messages published to your queue. Without a consumer Worker, the messages will stay on the queue until they expire, which defaults to four (4) days.

## 5. Create your consumer Worker
## 4. Create your consumer Worker

A consumer Worker receives messages from your queue. When the consumer Worker receives your queue's messages, it can write them to another source, such as a logging console or storage objects.

Expand Down Expand Up @@ -213,7 +209,7 @@ With your `wrangler.toml` file and `index.ts` file configured, publish your cons
npx wrangler deploy
```

## 6. Read messages from your queue
## 5. Read messages from your queue

After you set up consumer Worker, you can read messages from the queue.

Expand Down
10 changes: 0 additions & 10 deletions src/content/docs/queues/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ type: overview
pcx_content_type: overview
sidebar:
order: 1
badge:
text: Beta
head:
- tag: title
content: Cloudflare Queues
Expand All @@ -24,14 +22,6 @@ Send and receive messages with guaranteed delivery and no charges for egress ban

<Plan type="paid" />

:::undefined


[Cloudflare Queues is now in open Beta](https://blog.cloudflare.com/cloudflare-queues-open-beta/). Join the [`#queues-beta`](https://discord.cloudflare.com) channel in our Developer Discord to learn more.


:::

Cloudflare Queues integrates with [Cloudflare Workers](/workers/) and enables you to build applications that can [guarantee delivery](/queues/reference/delivery-guarantees/), [offload work from a request](/queues/reference/how-queues-works/), [send data from Worker to Worker](/queues/configuration/configure-queues/), and [buffer or batch data](/queues/configuration/batching-retries/).
Oxyjun marked this conversation as resolved.
Show resolved Hide resolved

***
Expand Down
35 changes: 11 additions & 24 deletions src/content/docs/queues/platform/limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,35 @@ sidebar:

import { Render } from "~/components"

:::note


Many of these limits will increase during Queues' public beta period. [Follow our changelog](/queues/platform/changelog/) or join the [`#queues-beta`](https://discord.cloudflare.com) channel in our Developer Discord to keep up-to-date with changes.


:::



| Feature | Limit |
| --------------------------------------------- | ------------------------------------------------------------- |
| Queues | 10,000 per account <sup>beta</sup> |
| Queues | 10,000 per account |
| Message size | 128 KB <sup>1</sup> |
| Message retries | 100 |
| Maximum consumer batch size | 100 messages <sup>beta</sup> |
| Maximum consumer batch size | 100 messages |
| Maximum messages per `sendBatch` call | 100 (or 256KB in total) |
| Batch wait time | 60 seconds |
| Per-queue message throughput <sup>2</sup> | 400 messages per second <sup>3</sup> |
| Message retention period <sup>4</sup> | 4 days (96 hours) |
| Per-queue backlog size <sup>5</sup> | 25GB |
| Concurrent consumer invocations | 20 <sup>push-based only</sup> |
| Consumer duration (wall clock time) | 15 minutes <sup>6</sup> |
| Per-queue message throughput | 5,000 messages per second <sup>2</sup> |
| Message retention period <sup>3</sup> | 4 days (96 hours) |
| Per-queue backlog size <sup>4</sup> | 25GB |
| Concurrent consumer invocations | 250 <sup>push-based only</sup> |
| Consumer duration (wall clock time) | 15 minutes <sup>5</sup> |
| Consumer CPU time | 30 seconds |
| `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/) |



<sup>beta</sup> This limit is beta only and is expected to increase over time.

<sup>1</sup> 1 KB is measured as 1000 bytes. Messages can include up to \~100 bytes of internal metadata that counts towards total message limits.

<sup>2</sup> The maximum message throughput per queue will continue to increase during the beta period.

<sup>3</sup> Exceeding the maximum message throughput will cause the `send()` and `sendBatch()` methods to throw an exception with a `Too Many Requests` error until your producer falls below the limit.
<sup>2</sup> Exceeding the maximum message throughput will cause the `send()` and `sendBatch()` methods to throw an exception with a `Too Many Requests` error until your producer falls below the limit.

<sup>4</sup> Messages in a queue that reach the maximum message retention are deleted from the queue. Queues does not delete messages in the same queue that have not reached this limit.
<sup>3</sup> Messages in a queue that reach the maximum message retention are deleted from the queue. Queues does not delete messages in the same queue that have not reached this limit.

<sup>5</sup> Individual queues that reach this limit will receive a `Storage Limit Exceeded` error when calling `send()` or `sendBatch()` on the queue.
<sup>4</sup> Individual queues that reach this limit will receive a `Storage Limit Exceeded` error when calling `send()` or `sendBatch()` on the queue.

<sup>6</sup> Refer to [Workers limits](/workers/platform/limits/#cpu-time).
<sup>5</sup> Refer to [Workers limits](/workers/platform/limits/#cpu-time).

<Render file="limits_increase" product="workers" />
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ You can use Puppeteer to request all images on a page, save the colors used on a

<Render file="prereqs" product="workers" />

### Queues access

Additionally, you will need access to Queues.

<Render file="enable-queues" />

## 1. Create new Workers application

To get started, create a Worker application using the [`create-cloudflare` CLI](https://github.com/cloudflare/workers-sdk/tree/main/packages/create-cloudflare). Open a terminal window and run the following command:
Expand Down
1 change: 0 additions & 1 deletion src/content/docs/workers/platform/betas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ These are the current alphas and betas relevant to the Cloudflare Workers platfo
| Email Workers | | ✅ | [Docs](/email-routing/email-workers/) |
| Green Compute | | ✅ | [Blog](https://blog.cloudflare.com/earth-day-2022-green-compute-open-beta/) |
| Pub/Sub | ✅ | | [Docs](/pub-sub) |
| Queues | | ✅ | [Docs](/queues) |
| [TCP Sockets](/workers/runtime-apis/tcp-sockets/) | | ✅ | [Docs](/workers/runtime-apis/tcp-sockets) |
4 changes: 2 additions & 2 deletions src/content/partials/queues/enable-queues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

---

Queues is currently in [Public Beta](https://blog.cloudflare.com/cloudflare-queues-open-beta/) and is included in the monthly subscription cost of your Workers Paid plan, and charges based on operations against your queues. Refer to [Pricing](/queues/platform/pricing/) for more details.
Queues is included in the monthly subscription cost of your Workers Paid plan, and charges based on operations against your queues. Refer to [Pricing](/queues/platform/pricing/) for more details.
Oxyjun marked this conversation as resolved.
Show resolved Hide resolved

Before you can use Queues, you must enable it via [the Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers/queues). You need a Workers Paid plan to enable Queues.

To enable Queues:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com).
2. Go to **Workers & Pages** > **Queues**.
3. Select **Enable Queues Beta**.
3. Select **Enable Queues**.
Loading