Benchmark
Measured throughput of the self-hosted Node + Postgres runtime at user bases up to a million, what limits it, how slow actions change it, and how to reproduce the numbers.
This page reports how fast the self-hosted runtime (sendwend/node, see Self-hosting) moves journeys on fixed, small hardware: a Postgres of 2 vCPU and 4 GB, and Node processes of 1 vCPU and 1 GB each. The benchmark ships with the SDK as packages/sendwend/bench/node-host.mjs, and every number below is its output from one run, copied unchanged.
The short version: about 440 journey runs a second (about 1,300 actions a second), the same at an empty database and at a million users, with Postgres at 100% of its two cores and the Node processes about half idle. The database is the limit. Adding Node processes does not help; a bigger database would. When actions take real time (a call to an email provider), throughput is set by concurrency instead, until it reaches the database's limit again.
What was measured
The script starts its own Docker containers and network (named wfbench-*), runs the built package inside them, and removes them when it is done. This process on the host only generates load and reads counts; everything measured runs in the containers.
| Postgres container | postgres:17 (17.11), 2 vCPU, 4 GB, shared_buffers=1GB, max_connections=300, otherwise defaults |
| Node containers | node:26-slim (Node 26.13.1), 1 vCPU, 1 GB each, running journeyNode with a postgres pool |
| SDK | sendwend 12.7.4 (commit 76663eb), postgres (postgres.js) 4.1.1 |
| Machine | Apple M1 Max, 10 cores, 64 GB, macOS 27.2 |
| Docker | Docker Desktop, Engine 29.1.3, Linux VM with 10 CPUs and 7.7 GB |
| Load generator | Node 24.22.1 on the host |
| Date | 29 November 2026 |
It runs three workflows, each with reentry: { mode: 'never' }:
The user base. Each size of population is built by copying one seed user, row for row in every table of the engine's schema: a user who has a profile and an event, and is asleep in the middle of the nap journey. So at "1M" the database holds a million profiles, a million events and a million runs waiting on a one-day delay, and the measured journeys have to find their work among them.
Two tests per size:
- Drain. 10,000
orderevents are written straight into the database first, so 10,000stepsruns are queued before any worker exists. Then fresh Node containers start and the clock runs from the first run that ends to the last. This measures how fast the runtime works through a backlog, separately from ingestion. - Wait. Node containers are started first, and 5,000
sign_upevents go to them over HTTP (POST /ingest, 40 requests at a time). Each journey runs its first action and parks on its wait. Then 5,000loginevents arrive over HTTP and each journey wakes, runs its last action and ends. This is the shape of a journey in service: events arriving while the hosts work.
CPU is sampled once per cell from docker stats, a third of the way in; 100% is one core.
What was not measured. The actions are no-ops and no provider is configured: nothing is rendered, sent or delivered, and no webhook arrives. Segment sweeps were not under load. There is one Postgres, on the same machine as the load, with no network between them beyond Docker's. These numbers are the cost of the engine itself (claiming runs, checkpointing steps, recording entries and wakes), not of a real journey with real sends. The delay mode below adds the time a send takes, but not its other costs.
Results
A backlog, by user base and hosts
| Users | Hosts | Runs at once, each | Runs/s | Transactions/run | Postgres CPU | Host CPU |
|---|---|---|---|---|---|---|
| 0 | 2 × 1 vCPU | 10 | 433 | 13.2 | 203% | 57% |
| 10k | 2 × 1 vCPU | 10 | 435 | 13.1 | 203% | 58% |
| 100k | 2 × 1 vCPU | 10 | 447 | 13.2 | 200% | 57% |
| 100k | 1 × 1 vCPU | 10 | 465 | 13.5 | 204% | 90% |
| 100k | 4 × 1 vCPU | 10 | 451 | 13.2 | 200% | 30% |
| 100k | 2 × 1 vCPU | 50 | 415 | 13.5 | 201% | 49% |
| 1M | 2 × 1 vCPU | 10 | 441 | 13.4 | 202% | 55% |
A run here is one whole steps journey: three actions, from the trigger to the end. "Runs at once, each" is the host's concurrency. "Transactions/run" is Postgres's committed transactions during the drain, divided by the runs.
A journey in service, with a wait
| Users | Hosts | Events/s accepted | Runs/s to parked | Wakes/s accepted | Runs/s woken to end | Postgres CPU | Host CPU |
|---|---|---|---|---|---|---|---|
| 0 | 2 × 1 vCPU | 542 | 264 | 786 | 293 | 208% | 50% |
| 10k | 2 × 1 vCPU | 620 | 293 | 875 | 322 | 203% | 51% |
| 100k | 2 × 1 vCPU | 597 | 286 | 894 | 313 | 202% | 44% |
| 100k | 4 × 1 vCPU | 473 | 272 | 677 | 313 | 199% | 29% |
| 1M | 2 × 1 vCPU | 613 | 288 | 861 | 318 | 208% | 53% |
"Events/s accepted" is how fast the hosts answered the 5,000 sign_up requests. "Runs/s to parked" counts from the first request to the moment every journey had run its first action and parked on its wait. "Wakes/s accepted" is the same for the 5,000 login requests, and "Runs/s woken to end" from the first wake to the last journey ending.
Size on disk
| Users | Rows in run | Engine schema on disk |
|---|---|---|
| 0 | 1 | 864 kB |
| 10k | 25001 | 86 MB |
| 100k | 130001 | 334 MB |
| 1M | 1080001 | 2398 MB |
The row counts include the runs the earlier tests left behind (ended runs are kept for 7 days by default). At a million users the engine's schema took about 2.4 GB.
When an action takes time
BENCH_MODE=delay repeats the drain with two hosts at a user base of 100k, with each of the three actions sleeping 200 ms or 1 s, as a call to a provider would.
| Action takes | Runs at once, each host | Runs/s | Actions/s | Runs/s the setting allows | Postgres CPU | Host CPU |
|---|---|---|---|---|---|---|
| 200 ms | 10 | 31.1 | 93.3 | 33.3 | 16% | 6% |
| 200 ms | 50 | 160 | 480 | 167 | 85% | 25% |
| 200 ms | 200 | 408 | 1225 | 667 | 201% | 50% |
| 1000 ms | 10 | 7.0 | 21.1 | 6.7 | 2% | 1% |
| 1000 ms | 50 | 35.7 | 107 | 33.3 | 8% | 2% |
| 1000 ms | 200 | 138 | 414 | 133 | 73% | 10% |
"Runs/s the setting allows" is the ceiling concurrency sets: hosts × concurrency ÷ (3 actions × action time). Two hosts at 10 places each, with 200 ms actions, can finish at most 20 ÷ 0.6 s = 33.3 runs a second. Measured rates can sit slightly above it because the clock starts at the first run that ends, not when the hosts start.
How to read the numbers
The database is the limit. In every backlog row Postgres sits at about 200%, both of its cores busy, while the hosts use about half a core each. One host at 90% of its core moved as many runs as four hosts at 30%. Raising concurrency from 10 to 50 did not help either: once the database is saturated, more work in flight only queues inside it. Each run of three actions cost about 13 committed transactions, because every step's effect is checkpointed before the next one starts; that durability is what makes a step at least once rather than lost when a process dies.
The size of the user base does not matter here. Throughput at a million users (441 runs/s) is within the run-to-run spread of the empty database (433). Workers claim due runs with FOR UPDATE SKIP LOCKED, and a million journeys asleep until tomorrow are not due, so in this test they cost disk, not speed.
A journey with a wait costs two turns. The wait workflow is two turns separated by an event, and each half ran at about 290 to 320 runs a second while the same database was also answering the HTTP ingest. Accepting an event is cheaper than running a turn: the hosts accepted 470 to 890 events a second, ahead of the runs they started.
An action that takes time changes the limit. A run holds one of a host's concurrency places while its action runs, so a host completes at most concurrency ÷ action time actions a second. At the default of 10 and a one-second send, that is 10 sends a second per host, and the measurement agrees: 7 runs (21 actions) a second for two hosts, with the database at 2% and the hosts at 1%. Nothing was busy; everything was waiting. Raise concurrency and throughput follows the ceiling line until the database saturates again: at 200 places and 200 ms actions, the hosts could have finished 667 runs a second and the database stopped them at 408.
Sizing concurrency
Set it from your slowest action, as the self-hosting guide says. Work out the actions a second you need, multiply by how long one action takes, and divide by the number of hosts:
Waiting on a provider costs almost nothing: in the last row, 400 runs in flight with one-second actions used 10% of each host's core. 200 per host is reasonable on one vCPU. The connection pool need not grow with it, because a connection is held for a query, not for an action (the benchmark caps its pool at 40). The ceiling to watch is the database's: past about 440 runs a second on this hardware, more places add waiting, not throughput.
Remember the provider has limits of its own. A higher concurrency sends faster only up to the provider's rate limit, and the runtime retries a failed step (5 times by default, from 10 seconds, doubling).
What this means in practice
Runs per second translate into journeys per day only with care. 440 runs a second, sustained for 24 hours, would be about 38 million three-action journeys a day. Nobody's traffic is that flat, and a real database also serves your app, sweeps segments and stores real message content. A more useful reading is burst capacity: a backlog of 100,000 journeys (a campaign launched to a 100k segment, say) clears in about four minutes on a 2 vCPU database with no-op actions, and the hosts it needs are small.
With real sends, the provider's latency and your concurrency decide. At 200 ms a send, 2 hosts × 200 places produced about 1,200 actions a second here. At 1 s a send, the same setting produced about 400.
Treat the absolute numbers as this machine's. These are Docker Desktop CPU limits on an Apple M1 Max, on a local virtual disk with no network latency between the hosts and Postgres. A cloud vCPU is often half a physical core, managed Postgres adds network round trips to every transaction, and disk flush times differ. What should carry over is the shape: flat in the size of the user base, bound by the database, and set by concurrency ÷ action time when actions are slow. Run the benchmark on hardware like yours before relying on a figure.
Reproduce it
You need Docker and a clone of the SDK repository. The script pulls postgres:17 and node:26-slim on first use, and the containers read the built package from your checkout.
The full run took about 15 minutes here, most of it building the million-user population; the delay mode took about 4. Shorter trial runs:
| Variable | Effect |
|---|---|
BENCH_POPULATIONS | Comma-separated user-base sizes (default 0,10000,100000,1000000); in delay and profile modes, the one size to use (default 100,000) |
BENCH_SCALE | A factor on the batch sizes, e.g. 0.1 for a quick check |
BENCH_MODE=delay | The slow-action table above |
BENCH_MODE=profile | One batch under pg_stat_statements: statement time, WAL and statements per run, and the statements that took the time |
A trial at that scale reports lower rates, because container start-up is a large share of a 1,000-run batch. The script removes its containers and network when it finishes; if a run is interrupted, docker ps -a --filter name=wfbench- lists what is left, and the next run removes it first.