Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
48 changes: 48 additions & 0 deletions src/content/changelog/workers/2025-03-25-higher-cpu-limits.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Run Workers for up to 5 minutes of CPU-time
description: Workers now support up to 5 minutes of CPU time per request. Allowing more CPU-intensive workloads.
products:
- workers
date: 2025-03-25T17:00:00Z
---

import { Render, TypeScriptExample, WranglerConfig } from "~/components";

You can now run a Worker for up to 5 minutes of CPU time for each request.

Previously, each Workers request ran for a maximum of 30 seconds of CPU time. This
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...while duration (wall-time) is unlimited in workers

(Or something)

meant that some compute-intensive tasks were impossible to do with a Worker. For instance,
a user might want to take the cryptographic hash of a large file from R2. If
this computation ran for over 30 seconds, the Worker request would have timed out.

By default, Workers are still limited to 30 seconds of CPU time. This protects developers
from incurring accidental cost due to buggy code.

By changing the `cpu_ms` value in your Wrangler configuration, you can opt in to
any value up to 300,000 (5 minutes).

<WranglerConfig>

```jsonc
{
// ...rest of your configuration...
"limits": {
"cpu_ms": 300000,
},
// ...rest of your configuration...
}
```

</WranglerConfig>

:::note
CPU time is the amount of time the CPU actually spends doing work during a given request.
If a Worker's request makes a sub-request and waits for that request to come back before
doing additional work, this time spent waiting **is not** counted towards CPU time.

Worker requests could run for more than 30 seconds of total time prior to this change — only
CPU time was limited.
:::

For more information, see the documentation on [Wrangler configuration for `cpu_ms`](/workers/wrangler/configuration/#limits)
and on [Workers CPU time limits](/workers/platform/limits/#cpu-time).
4 changes: 3 additions & 1 deletion src/content/docs/workers/wrangler/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ watch_dir = "build_watch_dir"

## Limits

You can impose limits on your Worker's behavior at runtime. Limits are only supported for the [Standard Usage Model](/workers/platform/pricing/#example-pricing-standard-usage-model). Limits are only enforced when deployed to Cloudflare's network, not in local development. The CPU limit can be set to a maximum of 30,000 milliseconds (30 seconds).
You can impose limits on your Worker's behavior at runtime. Limits are only supported for the [Standard Usage Model](/workers/platform/pricing/#example-pricing-standard-usage-model).
Limits are only enforced when deployed to Cloudflare's network, not in local development. The CPU limit
can be set to a maximum of 300,000 milliseconds (5 minutes).

<Render file="isolate-cpu-flexibility" /> <br />

Expand Down
Loading