Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/content/docs/workers/local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ head: []
description: Develop your Workers locally via Wrangler.
---

import { Aside } from "~/components";

Cloudflare Workers and most connected resources can be fully developed and tested locally - providing confidence that the applications you build locally will work the same way in production. This allows you to be more efficient and effective by providing a faster feedback loop and removing the need to [test against remote resources](#develop-using-remote-resources-and-bindings). Local development runs against the same production runtime used by Cloudflare Workers, [workerd](https://github.com/cloudflare/workerd).

In addition to testing Workers locally with [`wrangler dev`](/workers/wrangler/commands/#dev), the use of Miniflare allows you to test other Developer Platform products locally, such as [R2](/r2/), [KV](/kv/), [D1](/d1/), and [Durable Objects](/durable-objects/).
Expand Down Expand Up @@ -127,6 +129,19 @@ npx wrangler dev --remote

For some products like KV and R2, remote resources used for `wrangler dev --remote` must be specified with preview ID/names in the [Wrangler configuration file](/workers/wrangler/configuration/) such as `preview_id` for KV or `preview_bucket name` for R2. Resources used for remote mode (preview) can be different from resources used for production to prevent changing production data during development. To use production data in `wrangler dev --remote`, set the preview ID/name of the resource to the ID/name of your production resource.

<Aside
type="note"
title="Number of routes per zone in a remote development session"
>
When you run a remote development session using the `--remote` flag, a
[limit](/workers/platform/limits/#routes-and-domains) of 50
[routes](/workers/configuration/routing/routes/) per zone is enforced. The
Quick Editor in the Cloudflare Dashboard also uses `wrangler dev --remote`, so
any changes made there are subject to the same 50-route limit. If your zone
has more than 50 routes, you **will not be able to run a remote session**. To
fix this, you must remove routes until you are under the 50-route limit.
</Aside>

## Customize `wrangler dev`

You can customize how `wrangler dev` works to fit your needs. Refer to [the `wrangler dev` documentation](/workers/wrangler/commands/#dev) for available configuration options.
Expand Down
45 changes: 25 additions & 20 deletions src/content/docs/workers/platform/limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import { Render } from "~/components";

## Account plan limits

| Feature | Workers Free | Workers Paid |
| -------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Feature | Workers Free | Workers Paid |
| -------------------------------------------------------------------------------- | ------------ | ------------ |
| [Subrequests](#subrequests) | 50/request | 1000/request |
| [Simultaneous outgoing<br/>connections/request](#simultaneous-open-connections) | 6 | 6 |
| [Environment variables](#environment-variables) | 64/Worker | 128/Worker |
| [Environment variable<br/>size](#environment-variables) | 5 KB | 5 KB |
| [Worker size](#worker-size) | 3 MB | 10 MB |
| [Worker startup time](#worker-startup-time) | 400 ms | 400 ms |
| [Number of Workers](#number-of-workers)<sup>1</sup> | 100 | 500 |
| Number of [Cron Triggers](/workers/configuration/cron-triggers/)<br/>per account | 5 | 250 |
| [Simultaneous outgoing<br/>connections/request](#simultaneous-open-connections) | 6 | 6 |
| [Environment variables](#environment-variables) | 64/Worker | 128/Worker |
| [Environment variable<br/>size](#environment-variables) | 5 KB | 5 KB |
| [Worker size](#worker-size) | 3 MB | 10 MB |
| [Worker startup time](#worker-startup-time) | 400 ms | 400 ms |
| [Number of Workers](#number-of-workers)<sup>1</sup> | 100 | 500 |
| Number of [Cron Triggers](/workers/configuration/cron-triggers/)<br/>per account | 5 | 250 |

<sup>1</sup> If you are running into limits, your project may be a good fit for
[Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/).
Expand Down Expand Up @@ -58,11 +58,11 @@ Cloudflare does not enforce response limits on response body sizes, but cache li

## Worker limits

| Feature | Workers Free | Workers Paid |
| ------------------------ | ------------------------------------------ | ---------------- |
| [Request](#request) | 100,000 requests/day<br/>1000 requests/min | No limit |
| [Worker memory](#memory) | 128 MB | 128 MB |
| [CPU time](#cpu-time) | 10 ms | 5 min HTTP request <br/> 15 min [Cron Trigger](/workers/configuration/cron-triggers/) |
| Feature | Workers Free | Workers Paid |
| ------------------------ | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Request](#request) | 100,000 requests/day<br/>1000 requests/min | No limit |
| [Worker memory](#memory) | 128 MB | 128 MB |
| [CPU time](#cpu-time) | 10 ms | 5 min HTTP request <br/> 15 min [Cron Trigger](/workers/configuration/cron-triggers/) |
| [Duration](#duration) | No limit | No limit for Workers. <br/>15 min duration limit for [Cron Triggers](/workers/configuration/cron-triggers/), [Durable Object Alarms](/durable-objects/api/alarms/) and [Queue Consumers](/queues/configuration/javascript-apis/#consumer) |

### Duration
Expand Down Expand Up @@ -93,7 +93,7 @@ Scheduled Workers ([Cron Triggers](/workers/configuration/cron-triggers/)) have

## Cache API limits

| Feature | Workers Free | Workers Paid
| Feature | Workers Free | Workers Paid |
| ---------------------------------------- | ------------ | ------------ |
| [Maximum object size](#cache-api-limits) | 512 MB | 512 MB |
| [Calls/request](#cache-api-limits) | 50 | 1,000 |
Expand Down Expand Up @@ -290,6 +290,10 @@ If you need more than 500 Workers, consider using [Workers for Platforms](/cloud

Each zone has a limit of 1,000 [routes](/workers/configuration/routing/routes/). If you require more than 1,000 routes on your zone, consider using [Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/) or request an increase to this limit.

### Number of routes per zone when using `wrangler dev --remote`

When you run a [remote development](/workers/local-development/#develop-using-remote-resources-and-bindings) session using the `--remote` flag, a limit of 50 [routes](/workers/configuration/routing/routes/) per zone is enforced. The Quick Editor in the Cloudflare Dashboard also uses `wrangler dev --remote`, so any changes made there are subject to the same 50-route limit. If your zone has more than 50 routes, you **will not be able to run a remote session**. To fix this, you must remove routes until you are under the 50-route limit.

### Number of custom domains per zone

Each zone has a limit of 100 [custom domains](/workers/configuration/routing/custom-domains/). If you require more than 100 custom domains on your zone, consider using a wildcard [route](/workers/configuration/routing/routes/) or request an increase to this limit.
Expand Down Expand Up @@ -323,10 +327,11 @@ Unbound and Bundled plans have been deprecated and are no longer available for n
If your Worker is on an Unbound plan, your limits are exactly the same as the Workers Paid plan.

If your Worker is on a Bundled plan, your limits are the same as the Workers Paid plan except for the following differences:
* Your limit for [subrequests](/workers/platform/limits/#subrequests) is 50/request
* Your limit for [CPU time](/workers/platform/limits/#cpu-time) is 50ms for HTTP requests and 50ms for [Cron Triggers](/workers/configuration/cron-triggers/)
* You have no [Duration](/workers/platform/limits/#duration) limits for [Cron Triggers](/workers/configuration/cron-triggers/), [Durable Object alarms](/durable-objects/api/alarms/), or [Queue consumers](/queues/configuration/javascript-apis/#consumer)
* Your Cache API limits for calls/requests is 50

- Your limit for [subrequests](/workers/platform/limits/#subrequests) is 50/request
- Your limit for [CPU time](/workers/platform/limits/#cpu-time) is 50ms for HTTP requests and 50ms for [Cron Triggers](/workers/configuration/cron-triggers/)
- You have no [Duration](/workers/platform/limits/#duration) limits for [Cron Triggers](/workers/configuration/cron-triggers/), [Durable Object alarms](/durable-objects/api/alarms/), or [Queue consumers](/queues/configuration/javascript-apis/#consumer)
- Your Cache API limits for calls/requests is 50

---

Expand All @@ -336,4 +341,4 @@ Review other developer platform resource limits.

- [KV limits](/kv/platform/limits/)
- [Durable Object limits](/durable-objects/platform/limits/)
- [Queues limits](/queues/platform/limits/)
- [Queues limits](/queues/platform/limits/)