Load testing
Fleans ships a load-test suite under tests/load/. Two drivers are wired up: k6 (the
primary suite) and Locust (port of the same scenarios for Azure Load Testing). This page
summarises the most recent baseline measurements and the bottleneck profile they expose.
Scenarios
Section titled “Scenarios”Four scenario scripts live in parallel under tests/load/scripts/ (k6) and tests/load/locust/
(Locust). They share fixtures under tests/load/fixtures/.
| Scenario | Purpose | Fixture / process id |
|---|---|---|
linear | Pure throughput — Start → ScriptTask → End. Measures /Execution/start HTTP latency only. | load-linear |
parallel | 3-branch fork/join, each branch a ScriptTask. Same HTTP-latency surface, more state writes per start. | load-parallel |
events | Three-phase event-driven loop: start → poll for waitMessage → POST /Execution/message. | load-events |
mixed | 40 / 30 / 30 weighted blend of the above three. | (composite) |
timers-1m (k6 only, tests/load/scripts/timers-1m.js) arms 1 million durable timers that all
fall due within one minute and reports timer lag (fire − due) p50 / p99 from the read model, with
reminders on their own PostgreSQL. Pass: lag p99 under 2 s and no timer lost. It decides whether
Orleans reminders carry production timer counts or the roadmap’s sharded timer scheduler
is needed. On one laptop (2026-11-12, report),
10 000 timers due within one minute passed (lag p99 0.15 s). 60 000 failed: that is ~1 000 fires/s, above what the
laptop stack can process (~170–340 fires/s), and the burst got a Core silo declared dead instead of turning into lag. A full million (829 486 armed over 56 minutes, held
without trouble while pending) fired none: when they fell due, the Core silos sat at their memory limit in back-to-back GC pauses.
The reminder store was not the limit: reminders-Postgres stayed under one core and a pending timer costs ~250 B of
silo memory. Since v0.15.0 (#1066) each Core silo delivers at most
Fleans:Timers:DeliveryConcurrency due timers at a time (default 64, see Configuration);
a timer due while every slot is busy fires on its reminder’s next tick a minute later. On a 4-vCPU VM
(2026-11-19, report), 60 000 timers due within one minute now all fire within ~6.5 minutes
with no Core silo lost (lag p50 120 s, max 360 s); the unbounded build lost a Core silo 8 times to
out-of-memory and needed ~15 minutes. 10 000 due within one minute fire with lag p99 0.47 s.
signal-fanout (k6 only, tests/load/scripts/signal-fanout.js) parks N instances on one signal
catch, broadcasts the signal once, and runs linear-10 before and during the broadcast. Pass: every
instance receives the signal and linear-10 keeps its start rate and latency. On one laptop with
20 000 waiting instances the broadcast answered in 0.6 s, every instance received the signal within
19 s, and linear-10 kept its start rate (start p95 19 ms → 163 ms during the broadcast). The pace is
Fleans:Signals:DeliveryConcurrency (see Configuration).
At 100 000 waiting instances on the default 512 MB worker, every instance received the signal within
103 s, linear-10 kept its start rate (1 210 → 1 190 starts in 60 s) and its duration p99 stayed
under a second (0.20 s → 0.50 s), and the instance lists caught up 165 s after the broadcast
(#1011).
long-lived (k6 only, tests/load/scripts/long-lived.js) measures linear-10’s start rate on an
empty cluster, parks N instances on a message catch that never fires, and measures it again with
all of them waiting. Pass: the start rate drops by no more than 10 %. On one laptop with 20 000
waiting instances none was lost, and the start rate moved by 10–40 % between runs — as much as it
moved on the same stack with no waiting instances at all, following the journal’s append latency.
A laptop cannot resolve the 10 % gate; the roadmap’s target of 10 million needs the multi-node run.
throughput (k6, tests/load/scripts/throughput.js + throughput-ceiling.sh) is the roadmap’s headline metric: a constant start rate of a no-wait process — load-linear-10 (10 script tasks) or load-one-task (Zeebe’s benchmark process: one external task) — with completed instances per second and p50 / p99 process duration taken from the read model, plus CPU per service and database transactions per instance. A pre-release laptop run is summarised on the roadmap.
.NET 11 vs .NET 10 (2026-11-13, report): the same code and stack on a 4-vCPU VM, throughput ladders for load-linear-10 and load-one-task plus long-diverse, two rounds per runtime. At the same start rate the engine processes used 4–17 % less CPU on .NET 11 (the most at moderate load; near saturation, where the databases and Kafka bound the stack, 4–7 %), and linear-10 process duration was 12–46 % lower at p50 and 11–36 % lower at p99; one-task latency was on par. A 30-minute soak at 45 starts/s (81 000 instances each, none failed) gave p99 0.260 s against 0.293 s with 11 % less engine CPU. The rest of the suite — timers-1m, signal-fanout, long-lived, mi-fanout (scaled to 10 000 instances), the classic linear / parallel / events / mixed scripts — lost no instance on either runtime; under the classic scripts’ overload .NET 11 completed 11–17 % more instances (events −5 %). long-diverse (bound by its timers and client round trips) and memory were on par, startup unchanged.
The suite is documented in detail in tests/load/README.md.
Current load-test stack
Section titled “Current load-test stack”tests/load/docker-compose.yml
is the roadmap’s target architecture scaled down to
one laptop (10 CPU / 12 GB Docker VM):
| Part | What runs |
|---|---|
| REST | nginx in front of 2 fleans-api processes with Fleans:Role=Api — Orleans clients that serve REST and the external-task gRPC endpoint |
| Orleans cluster | 3 fleans-api silos with Fleans:Role=Core (workflow grains); 1 fleans-worker silo with Fleans:Role=Worker (scripts, conditional starts and the read-model projector) |
| Custom tasks | 2 replicas of a gRPC external worker, outside the cluster |
| Journal | Citus — coordinator + 2 workers, journal tables sharded by instance id |
| Read model | PostgreSQL primary (written by the projector) with a streaming replica serving ConnectionStrings:fleans-query |
| Membership, reminders | their own PostgreSQL server |
| Streams | Kafka; no Redis anywhere |
Every connection string caps its pool (Maximum Pool Size), so the stack stays inside the
servers’ max_connections — see Connection budget.
The scenario results above and the roadmap’s first run
were measured on this stack. They are laptop shapes, not published benchmarks.
Known engine issues
Section titled “Known engine issues”Issues the load tests surfaced that still apply to the current code:
-
Silo membership on hosts without a pod API. When a silo disappears without saying goodbye (a crashed container, a Container Apps scale-down), the other silos keep routing calls to it until their probes declare it dead. The High availability page measured about 6 seconds for a killed container and explains what makes the window longer — a host that drops off the network without closing connections; the v0.1.0 run on Container Apps below saw about a minute. A graceful stop (SIGTERM) leaves membership at once, and on Kubernetes with
Fleans:Kubernetes:Enabled=true(the Helm default) a deleted pod is declared dead immediately. For production, also move membership off Redis withclustering.provider=Postgres— see Clustering. -
Literal-only correlation key. A message’s correlation key is read by stripping a literal
"= "(equals sign and space) prefix, not by evaluating an expression:var variableName = messageDef.CorrelationKeyExpression.StartsWith("= ")? messageDef.CorrelationKeyExpression[2..]: messageDef.CorrelationKeyExpression;Any key that isn’t the exact form
"= variableName"("=requestId","= request.Id","= upper(requestId)") is looked up as a literal variable name and fails at runtime when no such variable exists. Zeebe-style FEEL expressions do not work; the load-test fixtures use the supported form.
Archived: v0.1.0 baseline (April 2026)
Section titled “Archived: v0.1.0 baseline (April 2026)”Two reports exist in fleans-load-results for v0.1.0. Each is anchored to its driving hardware/SKU and the date it was run:
- Local Docker Compose (
local/report.md) — 2 silos indocker compose, 500 concurrent virtual users per scenario. Hardware: developer laptop. Originally produced for issue #243. - Azure Container Apps + Azure Load Testing (
azure-2026-04-29/report.md) — 2 silos behind the Container Apps built-in load balancer, Postgres Burstable B2s, Redis Basic C0. 500 VUs per scenario plus a 2 000-VU scale test against the same topology.
Both reports include per-scenario throughput / latency tables, peak container CPU, threshold compliance, and ranked recommendations. The summary below pulls the headline numbers; reach for the report files for raw CSVs and full bottleneck attribution.
Local Docker Compose @ 500 VU (2026-04-28)
Section titled “Local Docker Compose @ 500 VU (2026-04-28)”| Scenario | Max VUs | Iterations | Throughput (req/s) | p(95) duration | Error rate | First bottleneck |
|---|---|---|---|---|---|---|
linear | 500 | 344 815 | 1 049 / s | 174.88 ms | 96.90 % | Postgres write saturation |
parallel | 500 | 322 452 | 989 / s | 175.22 ms | 98.89 % | Postgres write saturation |
events | 200 | 2 166 | 6.6 / s | 32 000 ms | 21.40 % | Postgres + event coordination |
mixed | 100 | 1 050 | 3.2 / s | 38 220 ms | 66.66 % | Postgres + event coordination |
The local laptop run is db-bound: PostgreSQL CPU peaks above 600 % across all scenarios. The error spikes are connection-pool exhaustion (max_connections=100 default vs. 200+ EF Core
connections under burst), not slow queries.
Azure Container Apps @ 500 VU and a 2 000-VU scale test (2026-04-29)
Section titled “Azure Container Apps @ 500 VU and a 2 000-VU scale test (2026-04-29)”| Scenario | Reqs | RPS | HTTP fail % | p50 | p95 | max |
|---|---|---|---|---|---|---|
linear @ 500 VU | 33 907 | 113 | 0.0 % | 1.9 s | 8.4 s | 11.4 s |
parallel @ 500 VU | 22 701 | 76 | 0.0 % | 1.9 s | 13.2 s | 15.5 s |
events @ 500 VU (workflow_start) | 13 915 | 47 | 0.0 % | 9.2 s | 18.5 s | 24.4 s |
events @ 500 VU (poll_stall) | 13 760 | 46 | 100 % | — | — | — |
mixed @ 500 VU (parallel branch) | 3 653 | 12 | 6.8 % | 4.1 s | 30.7 s | 33.7 s |
linear @ 2 000 VU | 32 492 | 108.5 | 47.0 % | 13.6 s | 33.5 s | 39.8 s |
The Azure Container Apps target is silo-CPU bound. With 2 × 0.5 vCPU silos the API tops out around 110 RPS regardless of VU count — adding load adds queue, not work. The 2 000-VU run is the same throughput as the 500-VU run, just with 47 % HTTP 500s instead of queued requests.
Two bottleneck profiles compared at the same VU count:
| Run | Throughput | p95 (workflow_start) | HTTP fail % |
|---|---|---|---|
| Docker laptop, 2 silos, 8-core host | 1 049 / s | 175 ms | 97 % |
| Container Apps, 2 silos × 0.5 vCPU | 113 / s | 8 405 ms | 0 % |
Same code, same fixtures, same scripts. The bottleneck moves from Postgres to silo CPU when the silo SKU shrinks far enough; both regimes are valuable for shaping a sizing decision.
What the events scenario revealed
Section titled “What the events scenario revealed”The events scenario reported a 100 % poll_stall rate in both the 2-silo and the 1-silo
re-run on Azure. We chased it because that’s a striking result. After investigation:
- The fixture and the Locust port are correct. A single-instance probe with no other load
showed
start → step1 → waitMessagein <500 ms; the message correlated and the workflow completed. - Under 500 VU on 0.5 vCPU silos, the silo cannot dispatch the
step1 → waitMessagetransition within the test’s 3 s poll budget. The test catches this correctly.
The run also surfaced the membership window and the correlation-key parsing listed under
Known engine issues, and lost cross-silo events on the in-memory stream
provider that v0.1.0 used by default. Any queue-backed provider (Redis, the default today;
Kafka; Azure Queue) is multi-silo-safe; memory is for a single silo only — see
Streaming.
Sizing lessons from v0.1.0
Section titled “Sizing lessons from v0.1.0”In priority order, based on what the v0.1.0 runs measured. A fourth lesson — use a queue-backed stream provider past one silo — is now the default.
| # | Action | Why |
|---|---|---|
| P0 | Bigger silo CPU. 0.5 vCPU is too small. Move to 1 vCPU / 2 GiB minimum, ideally 2 vCPU. | Silo CPU is the first thing that pegs on Azure. |
| P1 | Cap connection pools, or add PgBouncer between the hosts and Postgres. Each process’s pools grow to 100 connections by default; under burst this exhausts max_connections — see Connection budget. | The local Docker run failed at this exact wall (97 % errors). |
| P2 | Bigger Postgres SKU. Burstable B2s is fine for the events case at low VU; for sustained 500 VU+ pick General Purpose D2ds_v5 or larger. | Removes the secondary cliff that follows P0. |
| P2b | Move the workflow journal to its own database (ConnectionStrings__fleans-journal, optionally Persistence__Journal__Provider=Citus to shard it by instance id). See Separate journal database. | The journal takes most writes; once one Postgres primary is saturated, a separate or sharded journal keeps adding write capacity. |
| P4 | Pre-warm before measurement. The first 30 s of each run mixes engine ramp-up with cold-start grain activation. | Cleaner reported tails. |
Reproducing the runs
Section titled “Reproducing the runs”Both report files include a “How to reproduce” section that lists the exact az/docker
commands. The Locust scripts under tests/load/locust/ are uploaded directly to Azure Load
Testing as the test plan; the k6 scripts under tests/load/scripts/ now run against the
current stack above.
For the Azure run specifically, you’ll need:
-
Azure subscription with access to
Microsoft.ContainerRegistry,Microsoft.DBforPostgreSQL,Microsoft.Cache,Microsoft.App, andMicrosoft.LoadTestServiceresource providers (auto-register on first use). -
Either local
azCLI (Python 3.13 may have apyexpatissue depending on platform; if so, usemcr.microsoft.com/azure-clifrom Docker), or just the Azure portal. -
The released
fleans-apicontainer image, re-tagged into your ACR.docker pullthe image fromghcr.io/nightbaker/fleans-api:<version>, thendocker tag+docker pushit to your ACR (e.g.myacr.azurecr.io/fleans-api:<version>). Optionally verify the upstream image viacosign verifyfirst (see Self-host with Docker Compose for the canonical command).Image tags carry no
vprefix (the releasev0.15.0publishesfleans-api:0.15.0):Terminal window VERSION=0.15.0ACR=myacr.azurecr.iodocker pull ghcr.io/nightbaker/fleans-api:$VERSIONdocker tag ghcr.io/nightbaker/fleans-api:$VERSION $ACR/fleans-api:$VERSIONdocker push $ACR/fleans-api:$VERSIONAdd
fleans-webonly if you also want the management UI in Azure — it isn’t strictly needed for the tests themselves.
Estimated cost: ~$3 / day idle for the resource group, ~$5 in test runs.