Skip to content

Commit c773d33

Browse files
durable-workflow.github.io: update v2 changes
1 parent 02c8646 commit c773d33

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

docs/constraints/structural-limits.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,28 @@ Structural limits cap the resource consumption of a single workflow run. When an
2323

2424
All limits are enforced at the point of scheduling or recording. A value of `0` disables the check for that limit kind.
2525

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+
2648
## Configuration
2749

2850
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
4163
'memo_size_bytes' => (int) env('WORKFLOW_V2_LIMIT_MEMO_SIZE_BYTES', 262144),
4264
'search_attribute_size_bytes' => (int) env('WORKFLOW_V2_LIMIT_SEARCH_ATTRIBUTE_SIZE_BYTES', 40960),
4365
'history_transaction_size' => (int) env('WORKFLOW_V2_LIMIT_HISTORY_TRANSACTION_SIZE', 5000),
66+
'warning_threshold_percent' => (int) env('WORKFLOW_V2_LIMIT_WARNING_THRESHOLD_PERCENT', 80),
4467
],
4568
],
4669
```
@@ -157,7 +180,35 @@ The current structural limits configuration is included in the v2 health check s
157180
"payload_size_bytes": 2097152,
158181
"memo_size_bytes": 262144,
159182
"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:
197+
198+
```json
199+
{
200+
"structural_limits": {
201+
"configured": { "pending_activity_count": 2000, "..." : "..." },
202+
"backend_adjustments": { "max_single_timer_delay_seconds": 900 },
203+
"effective": { "pending_activity_count": 2000, "max_single_timer_delay_seconds": 900, "..." : "..." },
204+
"issues": [
205+
{
206+
"component": "structural_limits",
207+
"severity": "info",
208+
"code": "queue_max_delay_constraint",
209+
"message": "The [sqs] queue driver limits delayed dispatch to 900 seconds; timers exceeding this are chunked by the transport layer."
210+
}
211+
]
161212
}
162213
}
163214
```

0 commit comments

Comments
 (0)