Skip to content

Commit 510326d

Browse files
committed
Adds changelog entry for cpu_ms limit bump
1 parent 10e6b11 commit 510326d

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Run Workers for up to 5 minutes of CPU-time
3+
description: Workers now support up to 5 minutes of CPU time per request. Allowing more CPU-intensive workloads.
4+
products:
5+
- workers
6+
date: 2025-03-25T17:00:00Z
7+
---
8+
9+
import { Render, TypeScriptExample, WranglerConfig } from "~/components";
10+
11+
You can now run a Worker for up to 5 minutes of CPU time for each request.
12+
13+
Previously, Workers could only run for up to 30 seconds of CPU time. This meant that
14+
some compute-intensive tasks were impossible to do with a Worker. For instance,
15+
a user might want to take the cryptographic hash of a large file from R2. If
16+
this computation ran for over 30 seconds, the Worker request would have previously
17+
timed out.
18+
19+
By default, Workers are still limited to 30 seconds of CPU time. This protects developers
20+
from incurring accidental cost due to buggy code.
21+
22+
By changing the `cpu_ms` value in your Wrangler configuration, you can opt in to
23+
any value up to 300000 (5 minutes).
24+
25+
<WranglerConfig>
26+
27+
```jsonc
28+
{
29+
// ...rest of your configuration...
30+
"limits": {
31+
"cpu_ms": 300000,
32+
},
33+
// ...rest of your configuration...
34+
}
35+
```
36+
37+
</WranglerConfig>
38+
39+
:::note
40+
CPU time is the amount of time the CPU actually spends doing work during a given request.
41+
If a Worker's request makes a sub-request and waits for that request to come back before
42+
doing additional work, this time spent waiting **is not** counted towards CPU time.
43+
44+
Workers were able to run for more than 30 seconds of total time prior to this change, only
45+
CPU time was limited.
46+
:::
47+
48+
For more information, see documentation on [Wrangler configuration for `cpu_ms`](/workers/wrangler/configuration/#limits)
49+
and on [Workers CPU time limits](/workers/platform/limits/#cpu-time).

src/content/docs/workers/wrangler/configuration.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ watch_dir = "build_watch_dir"
398398

399399
## Limits
400400

401-
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).
401+
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).
402+
Limits are only enforced when deployed to Cloudflare's network, not in local development. The CPU limit
403+
can be set to a maximum of 300,000 milliseconds (5 minutes).
402404

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

0 commit comments

Comments
 (0)