You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Maximum Workflow instance creation rate | 100 per second [^6]| 100 per second [^6]|
29
29
| Maximum number of [queued instances](/workflows/observability/metrics-analytics/#event-types)| 10,000 | 100,000 |
30
30
| Retention limit for completed Workflow state | 3 days | 30 days [^2]|
@@ -42,8 +42,65 @@ Many limits are inherited from those applied to Workers scripts and as documente
42
42
43
43
[^6]: Workflows will return a HTTP 429 rate limited error if you exceed the rate of new Workflow instance creation.
44
44
45
+
[^7]: Only instances with a `running` state count towards the concurrency limits. If an instance is in a `waiting` state it does not count these limits.
46
+
45
47
<Renderfile="limits_increase"product="workers" />
46
48
49
+
### `waiting` instances do not count towards instance concurrency limits
50
+
51
+
Instances that are on a `waiting` state - either sleeping, waiting for a retry or waiting for an event - do **not** count towards concurrency limits. It means that other `queued` instances will be scheduled when an instance goes from a `running` state to a `waiting` one, usually the oldest instance queued, in a best-effort basis. This state transition - `running` to `waiting` - might not happen if the duration of the wait is too short.
52
+
53
+
As an example, let's say we have a workflow that does some work, waits 30 days, and continues other work:
let resp =awaitfetch('https://api.cloudflare.com/client/v4/ips');
75
+
returnawaitresp.json<any>();
76
+
});
77
+
78
+
awaitstep.sleep('wait 30 days', '30 days');
79
+
80
+
awaitstep.do(
81
+
'make a call to write that could maybe, just might, fail',
82
+
// Define a retry strategy
83
+
{
84
+
retries: {
85
+
limit: 5,
86
+
delay: '5 second',
87
+
backoff: 'exponential',
88
+
},
89
+
timeout: '15 minutes',
90
+
},
91
+
async () => {
92
+
// Do stuff here, with access to the state from our previous steps
93
+
if (Math.random() >0.5) {
94
+
thrownewError('API call to $STORAGE_SYSTEM failed');
95
+
}
96
+
},
97
+
);
98
+
}
99
+
}
100
+
```
101
+
102
+
While a given Workflow instance is waiting for 30 days to pass, it will go to a `waiting` state, allowing other `queued` instances to run - if concurrency limits are exhausted.
103
+
47
104
### Increasing Workflow CPU limits
48
105
49
106
Workflows are Worker scripts, and share the same [per invocation CPU limits](/workers/platform/limits/#worker-limits) as any Workers do. Note that CPU time is active processing time: not time spent waiting on network requests, storage calls, or other general I/O, which don't count towards your CPU time or Workflows compute consumption.
0 commit comments