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
Copy file name to clipboardExpand all lines: docs/constraints/structural-limits.md
+52-1Lines changed: 52 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,28 @@ Structural limits cap the resource consumption of a single workflow run. When an
23
23
24
24
All limits are enforced at the point of scheduling or recording. A value of `0` disables the check for that limit kind.
25
25
26
+
## Soft-limit warnings
27
+
28
+
Before a hard limit terminates a run, the engine can warn you that a resource is approaching its ceiling. When a count-based resource (pending activities, children, timers, command batch size, or history transaction events) crosses a configurable percentage of the hard limit, the executor logs a structured warning.
29
+
30
+
The default warning threshold is **80%**. For example, with the default `pending_activity_count` limit of 2,000, a warning is logged when a run reaches 1,600 pending activities. The run continues executing normally — the warning gives operators time to react (scale workers, trigger continue-as-new, raise the limit) before the hard guard fails the run.
31
+
32
+
Configure the threshold via `workflows.v2.structural_limits.warning_threshold_percent`:
33
+
34
+
```env
35
+
WORKFLOW_V2_LIMIT_WARNING_THRESHOLD_PERCENT=80
36
+
```
37
+
38
+
Set to `0` to disable soft-limit warnings entirely.
39
+
40
+
Warning log entries include structured context:
41
+
42
+
```
43
+
[Durable Workflow] Run 42 approaching structural limit [pending_activity_count]: 1620 / 2000 (81% utilization, warning at 80%).
44
+
```
45
+
46
+
The structured log context includes `workflow_run_id`, `workflow_type`, `limit_kind`, `current`, `limit`, and `utilization_percent` for integration with log aggregation and alerting tools.
47
+
26
48
## Configuration
27
49
28
50
Override any limit through `workflows.v2.structural_limits` in your config or via environment variables:
@@ -41,6 +63,7 @@ Override any limit through `workflows.v2.structural_limits` in your config or vi
@@ -157,7 +180,35 @@ The current structural limits configuration is included in the v2 health check s
157
180
"payload_size_bytes": 2097152,
158
181
"memo_size_bytes": 262144,
159
182
"search_attribute_size_bytes": 40960,
160
-
"history_transaction_size": 5000
183
+
"history_transaction_size": 5000,
184
+
"warning_threshold_percent": 80
185
+
}
186
+
}
187
+
```
188
+
189
+
## Backend-dependent limits
190
+
191
+
The backend capabilities snapshot publishes the full structural-limit contract adjusted for the current infrastructure. Most limits are backend-independent configuration values, but certain backends impose additional constraints:
192
+
193
+
-**SQS queue** — Amazon SQS caps delayed message delivery at 900 seconds, so the capability snapshot includes `max_single_timer_delay_seconds: 900`. Timers exceeding this are chunked by the transport layer.
194
+
-**SQLite database** — SQLite serializes writes, so the snapshot notes `concurrent_write_safety: limited`. High pending-count limits may cause lock contention under concurrent worker load.
195
+
196
+
The full contract is available in the `structural_limits` section of the backend capabilities response:
0 commit comments