Skip to content
GitHub

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.

Four scenario scripts live in parallel under tests/load/scripts/ (k6) and tests/load/locust/ (Locust). They share fixtures under tests/load/fixtures/.

ScenarioPurposeFixture / process id
linearPure throughput — Start → ScriptTask → End. Measures /Execution/start HTTP latency only.load-linear
parallel3-branch fork/join, each branch a ScriptTask. Same HTTP-latency surface, more state writes per start.load-parallel
eventsThree-phase event-driven loop: start → poll for waitMessage → POST /Execution/message.load-events
mixed40 / 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.

tests/load/docker-compose.yml is the roadmap’s target architecture scaled down to one laptop (10 CPU / 12 GB Docker VM):

PartWhat runs
RESTnginx in front of 2 fleans-api processes with Fleans:Role=Api — Orleans clients that serve REST and the external-task gRPC endpoint
Orleans cluster3 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 tasks2 replicas of a gRPC external worker, outside the cluster
JournalCitus — coordinator + 2 workers, journal tables sharded by instance id
Read modelPostgreSQL primary (written by the projector) with a streaming replica serving ConnectionStrings:fleans-query
Membership, reminderstheir own PostgreSQL server
StreamsKafka; 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.

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 with clustering.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.

The v0.1.0 stack: the shared scenarios drive k6 (local) or Locust (Azure Load Testing) against two fleans-api silos backed by PostgreSQL and Redis clustering. Open interactive diagram ↗

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 in docker 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)”
ScenarioMax VUsIterationsThroughput (req/s)p(95) durationError rateFirst bottleneck
linear500344 8151 049 / s174.88 ms96.90 %Postgres write saturation
parallel500322 452989 / s175.22 ms98.89 %Postgres write saturation
events2002 1666.6 / s32 000 ms21.40 %Postgres + event coordination
mixed1001 0503.2 / s38 220 ms66.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)”
ScenarioReqsRPSHTTP fail %p50p95max
linear @ 500 VU33 9071130.0 %1.9 s8.4 s11.4 s
parallel @ 500 VU22 701760.0 %1.9 s13.2 s15.5 s
events @ 500 VU (workflow_start)13 915470.0 %9.2 s18.5 s24.4 s
events @ 500 VU (poll_stall)13 76046100 %———
mixed @ 500 VU (parallel branch)3 653126.8 %4.1 s30.7 s33.7 s
linear @ 2 000 VU32 492108.547.0 %13.6 s33.5 s39.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:

RunThroughputp95 (workflow_start)HTTP fail %
Docker laptop, 2 silos, 8-core host1 049 / s175 ms97 %
Container Apps, 2 silos × 0.5 vCPU113 / s8 405 ms0 %

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.

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 → waitMessage in <500 ms; the message correlated and the workflow completed.
  • Under 500 VU on 0.5 vCPU silos, the silo cannot dispatch the step1 → waitMessage transition 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.

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.

#ActionWhy
P0Bigger 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.
P1Cap 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).
P2Bigger 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.
P2bMove 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.
P4Pre-warm before measurement. The first 30 s of each run mixes engine ramp-up with cold-start grain activation.Cleaner reported tails.

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, and Microsoft.LoadTestService resource providers (auto-register on first use).

  • Either local az CLI (Python 3.13 may have a pyexpat issue depending on platform; if so, use mcr.microsoft.com/azure-cli from Docker), or just the Azure portal.

  • The released fleans-api container image, re-tagged into your ACR. docker pull the image from ghcr.io/nightbaker/fleans-api:<version>, then docker tag + docker push it to your ACR (e.g. myacr.azurecr.io/fleans-api:<version>). Optionally verify the upstream image via cosign verify first (see Self-host with Docker Compose for the canonical command).

    Image tags carry no v prefix (the release v0.15.0 publishes fleans-api:0.15.0):

    Terminal window
    VERSION=0.15.0
    ACR=myacr.azurecr.io
    docker pull ghcr.io/nightbaker/fleans-api:$VERSION
    docker tag ghcr.io/nightbaker/fleans-api:$VERSION $ACR/fleans-api:$VERSION
    docker push $ACR/fleans-api:$VERSION

    Add fleans-web only 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.