This example stress-tests Dapr workflow scheduling by starting many concurrent SustainedWorkflow instances. Each workflow calls one DoWork activity, which sleeps for a short varied interval and returns input * 2.
Environment variables:
WORKFLOW_COUNT: number of workflow instances to schedule. Defaults to100and is capped at10000for safety.WORKFLOW_CONCURRENCY: maximum number of in-flight scheduling/waiting tasks. Defaults toWORKFLOW_COUNTso all workflows start in parallel.
Dapr workflows pin to a Redis state store named wf-store. If running multiple examples at once, give them distinct app IDs; they can share the store.
Start Redis locally on port 6379, then run:
WORKFLOW_COUNT=5 \
dapr run --app-id workflow-sustained \
--resources-path ./config \
-- cargo run --example workflow-sustainedExample with explicit load settings:
WORKFLOW_COUNT=1000 WORKFLOW_CONCURRENCY=100 \
dapr run --app-id workflow-sustained \
--resources-path ./config \
-- cargo run --example workflow-sustainedThe program prints total count, succeeded/failed counts, total elapsed time, throughput, and latency average/min/p50/p95/p99/max.