Every workflow is a line on a map.
Statehelm runs AWS Step Functions style state machines on a PostgreSQL you already operate. It speaks the Step Functions API (tested with boto3) and needs only Postgres.
Press Replay a run to play back a recorded execution.
All recorded events
Press Replay a crash to play back a recorded run in which one replica is killed.
Time since start
Step lease No step is leased yet.
All recorded changes
Run it locally.
Clone the repository, then start Postgres, the engine and the Studio UI with one compose command. Ports are published on localhost only.
Terminal
docker compose up -d --build
open http://localhost:8080
Python, with boto3
import boto3, json, time
sfn = boto3.client(
"stepfunctions",
endpoint_url="http://localhost:8080",
region_name="us-east-1",
aws_access_key_id="local",
aws_secret_access_key="local",
)
machine = sfn.create_state_machine(
name="hello",
roleArn="arn:aws:iam::123456789012:role/unused",
definition=json.dumps({
"StartAt": "Greet",
"States": {"Greet": {"Type": "Pass", "Result": "hello", "End": True}},
}),
)
run = sfn.start_execution(stateMachineArn=machine["stateMachineArn"], input="{}")
while (
status := sfn.describe_execution(executionArn=run["executionArn"])["status"]
) == "RUNNING":
time.sleep(0.5)
print(status) # SUCCEEDED
The default auth mode skips signature checks. That is fine on your own machine and wrong on an exposed one. The tests use boto3, and other AWS SDKs take the same endpoint override. The AWS Terraform provider works too.
Test results and benchmarks.
Each row can be reproduced from the repository.
| Line | Result | Detail |
|---|---|---|
| Crash recovery | 200 of 200 finished | 3 replicas, 8 processes killed with SIGKILL mid-run. No lost transitions, no duplicate events, no stuck steps. Run it yourself with tests/chaos/run.sh. |
| API compatibility | 37 of 37 passing | The official boto3 client against a running engine, across all 19 Step Functions actions in scope. |
| Automated checks | Passing on every push | About 380 Java tests with a real PostgreSQL, the boto3 suite, the crash test, the UI tests and a Docker image smoke test all run in CI. |
| Throughput | 234 to 851 transitions per second | Pass-only machine of 5 states: 374 on one replica, 851 on three. Machine with HTTP tasks, 3 states: 234 and 394. One run per row on a single laptop, with Postgres and the load generator on the same machine. p99 latency 0.5 to 1.1 seconds. Results vary a lot between runs. No other engine was measured, so there is no comparison. |
How it works.
Postgres is the only datastore. Any number of identical replicas run against it.
-
Claiming steps
Replicas take due steps with
FOR UPDATE SKIP LOCKEDin a single statement, so they never wait on each other's rows. -
One transaction per transition
A step runs outside any transaction. Applying its result is one transaction guarded by status and attempt number, so a stale replica cannot overwrite a newer claim.
-
At least once
If a replica dies, a reaper returns its step to pending and another replica runs it again. Task targets must tolerate a repeated call.
-
The SSRF guard
The check runs inside the HTTP client's DNS lookup, so a hostile DNS answer cannot swap the address between the check and the connection.
What it does not do yet.
Statehelm is version 0.1.
- It supports a subset of the language: no JSONata, distributed S3 Map, activity polling or the 200 plus native AWS integrations.
- Published state machine versions are not supported, so ListStateMachineVersions always returns an empty list.
- SQS is tested against ElasticMQ, an SQS-compatible server, but not against AWS SQS itself.
- It has not run under production load. There is one benchmark, on a laptop.
- Steps run at least once, so a target that is not safe to call twice needs its own deduplication.
Read the code.
The code, the tests and the design notes are in one repository, under the Apache License 2.0.