Benchmarks
Use the widget action suite to investigate the time between a person-card click and the resulting rental-history panel. The Criterion benchmarks further down this page measure workflow execution and allocator behavior in isolation.
Widget action measurements
Section titled “Widget action measurements”The suite has two workloads. The application workload runs an exported app through the web frontend, production API and executor routers, Postgres, Redis, and a local S3-compatible object store. Its fixture keeps the workflow topology and replaces database records with synthetic contacts and rental relationships. The diagnostic workload runs a small database-filter, widget-instantiation, and container-update graph with configurable transport delays.
Keep these boundaries separate when comparing results:
| Measurement | Boundary |
|---|---|
| Process readiness | Starting a local service until its readiness check succeeds |
| Page bootstrap | Document navigation until the configured person actions are available |
| History DOM | Click until the panel contains the selected person’s expected history |
| Frame opportunity | Two animation frames after the verified DOM update; physical display paint is not measured |
| Action handler settled | The frontend handler returns, including work after the first UI update; this timing alone does not establish workflow success |
The browser alternates between people with distinct history markers and checks the expected row count when configured. A stale table cannot satisfy the next sample. Visibility checks cover CSS display and visibility; they do not establish that every row is inside the viewport. Reports retain individual samples, failures, configuration, and machine details. Use at least 100 samples per scenario for tail-latency comparisons and repeat runs under the same background load.
Uncaught browser errors invalidate a run even when the expected rows appear. Reports retain up to 100 error messages, each limited to 4,000 characters, to help diagnose hydration and other application failures.
The application fixture returns through its overview control between person
clicks. The reset UI, handler, and successful terminal event must arrive before
the next measured action. Reports retain reset timings separately from the
rental-history round trip.
The optional browser reset configuration selects this control. Reset workflows
add load outside the timed history-click interval. Accounting callbacks after the
terminal event can still occupy an executor slot, as they do during normal use.
The application driver also verifies a successful terminal event in the invoke
stream. Matching rows followed by a failed workflow count as a failure.
Bootstrap must finish successfully before the first action; its earlier cards
DOM and frame timestamps remain separate from completion verification.
requireTerminalSuccess: false is an explicit mode for unverified browser probes.
Chrome DevTools Protocol stream observation, DOM observation, polling, and browser
automation add overhead; keep the same instrumentation when comparing revisions.
Application workload
Section titled “Application workload”You need Docker Compose, Node.js, Bun, the installed workspace dependencies,
Rust, Python 3.11 or later, uv, protoc, OpenSSL, AWS CLI, and an authorized
metadata export of the investigation app. Keep exports outside the repository.
The fixture builder recognizes that app’s existing page, event, widget, and
board identifiers.
It removes credentials, external destinations, saved widget data, and comments
before importing source objects into the local stack.
The read-only exporter supports S3 directory buckets and downloads only current source objects. It checks each object’s ETag and writes a hash inventory:
python3 tests/widget-action-stack/export.py \ --bucket "$WIDGET_BENCH_META_BUCKET" --app-id "$WIDGET_BENCH_APP_ID" \ --region eu-west-1 --output /tmp/widget-app-exportThen prepare and run the local stack:
python3 tests/widget-action-stack/run.py prepare \ --metadata-export /tmp/widget-app-exportpython3 tests/widget-action-stack/run.py buildpython3 tests/widget-action-stack/run.py benchmarkPreparation creates a separate Docker Compose project, local credentials, a
signed test session, and a synthetic Lance dataset. The build uses optimized
Rust and the real frontend’s production static export. Web build products are
isolated from apps/web/.next and apps/web/out. The benchmark starts the
services, waits for readiness, navigates the actual Personen page, clicks the
configured person actions, then stops the processes it started.
The default database profile reproduces the inspected manifest’s physical
shape: 47 live rows, 58 physical rows, 36 fragments, and three deletion files.
Arrow types, nullability, and primary-key metadata also match. Entity counts and
relationships are synthetic; the hosted table’s customer records are not copied.
This preserves the cost of opening many small fragments that a compact fixture
would miss. Preparation also accepts --fixture-layout compact to put the same
logical records in one fragment. Use the separate states described under
Storage layout comparisons to retain both fixtures.
State, private service logs, fixture hashes, startup timings, and browser
results live in /tmp/flow-widget-stack by default. The generated
fixture/browser-config.json controls sample count, warmups, navigations,
concurrency, and semantic expectations. Use concurrency: 1 for the isolated
reference, then repeat with concurrency: 8 to send synchronized bursts from
independent headless browsers. Each browser performs the normal page bootstrap.
Start the service with --executor-slots 8 to admit eight concurrent runs, or
keep fewer slots when measuring admission failures under overload.
These bursts share one local API process and one executor process. They measure
contention within that pair of processes. --workers changes their thread count;
it does not add replicas. Lambda can assign concurrent invocations to separate
execution environments, so this workload does not establish a Lambda scaling
bottleneck. Use the independent-process runner below to test one active invocation
per environment, with separate warm and cold-cache scenarios.
samples is the planned action count per navigation across all workers. The
runner stops after a failed burst and retains partial results and failure counts,
including executor admission rejections. Initial and repeat navigation labels
describe document loads; neither label establishes that backend caches were cold.
To keep the services available for inspection:
python3 tests/widget-action-stack/run.py serve# In another terminal:python3 tests/widget-action-stack/run.py benchmark --existing \ --output /tmp/widget-app-candidateCompare two application runs with:
python3 tests/widget-action-stack/compare.py \ /tmp/widget-app-baseline /tmp/widget-app-candidateThe comparison checks graph and record hashes, build profiles, browser versions,
concurrency, and instrumentation settings before calculating changes. Failed or
unverified actions remain failures. Changing the fragment layout is allowed when
the logical records match. --allow-mismatch shows incompatible runs side by side
without calculating a percentage improvement.
Use serve --trace for a separate diagnostic run with every API span sampled
and written to private service logs. Trace mode has extra overhead, so compare
it with another trace run. The run manifest records the instrumentation settings.
--workers, --executor-slots, and --thread-stack-mb control local runtime
capacity. The default 32 MiB thread stack accommodates the large graph in debug
builds; keep that setting fixed across comparisons.
Press Ctrl+C in the service terminal to stop its processes. To stop the isolated infrastructure while retaining its data:
python3 tests/widget-action-stack/stack.py downThis path exercises the production authentication, authorization, page bootstrap, prerun, quota, compilation, widget snapshot, HTTP dispatch, executor, database, streaming, and browser rendering code. The local adapter supplies the compute-accounting context normally supplied by Lambda. Its 2 GB accounting metadata does not impose a memory limit on the process. A pre-authenticated local OpenID Connect session exercises token verification; interactive sign-in and an external identity provider are outside the measurement.
Local Postgres and RustFS do not reproduce DSQL network latency, Lambda scheduling, or CDN behavior. Process readiness excludes periodic API housekeeping workers. Use the same fixture and configuration across revisions, and confirm the resulting change against hosted traces before claiming a hosted latency target. The source export’s hash and version also matter: a later draft may execute a different graph from an earlier production trace. The benchmark binary includes the standard and data node implementations used by the entire Personen board. Other pages that require image, document, or AI nodes need those catalog features added before they can be benchmarked.
Process-cold comparisons
Section titled “Process-cold comparisons”Use fresh API and executor processes to measure startup separately from warmed actions. Build both revisions first and keep their binaries at distinct paths.
To isolate compiled board preparation, pass the same .flcb artifact to each
benchmark binary:
/tmp/widget-baseline/release-fast/widget_action_stack \ template-benchmark /tmp/widget-board.flcb 100/tmp/widget-candidate/release-fast/widget_action_stack \ template-benchmark /tmp/widget-board.flcb 100This command reports each template load after three warmups. It includes archive decompression, validation, board reconstruction, catalog resolution, and lookup construction. It reads the file once before timing and reports catalog registry initialization separately. Each sample creates a fresh template; disposal happens outside the timer. Storage fetches, process startup, workflow execution, and browser rendering are outside this measurement. Use the application trials below to check whether a faster loader improves navigation or the first history click.
Use separate source and Cargo target directories for each revision. Copying a revision over an existing checkout while preserving file timestamps can cause Cargo to reuse artifacts from the previous revision. If you reuse a target directory, force the affected crates to rebuild and retain the build log with each binary.
python3 tests/widget-action-stack/cold.py \ --baseline /tmp/widget-baseline/release-fast/widget_action_stack \ --candidate /tmp/widget-candidate/release-fast/widget_action_stack \ --config /tmp/flow-widget-stack/fixture/browser-config.json \ --trials 12 --modes navigation action --output /tmp/widget-cold-comparisonpython3 tests/widget-action-stack/cold_compare.py /tmp/widget-cold-comparison \ --json-output /tmp/widget-cold-comparison/comparison.jsonEach pair runs both binaries, alternating their order between pairs. Every trial owns a fresh browser and performs one measured action without warmups.
Frontend changes can use separate production stages. Build each with
node tests/widget-action-stack/web.mjs build --state STATE --source-root SOURCE_COPY,
then pass --baseline-web-state and --candidate-web-state to the cold runner.
For copied sources, also pass the matching --baseline-web-source-root and
--candidate-web-source-root. Keep source copies inside the workspace so
Turbopack can resolve dependencies. Keep the snapshots and installed workspace
dependencies fixed during each build. The runner verifies the selected frontend’s
source hash and build ID throughout the suite. Ordinary run.py runs accept
--web-state and --web-source-root for the same purpose.
| Mode | Cold boundary | Main measurement |
|---|---|---|
navigation | API and executor start before document navigation | Navigation until the person cards appear, including bootstrap and page onLoad |
action | After successful page onLoad, API and executor restart while the browser document stays open | Click until the expected rental-history rows appear |
The action mode rejects background API requests between the restart boundary and the click because they could warm the backend. The runner checks persisted quota and compute completion before restarting or stopping the processes. These checks and process readiness are outside the navigation and click clocks. Readiness uses 20 ms polling by default and remains a separate measurement.
Storage objects, Postgres, Redis, and operating-system caches remain available.
These trials measure fresh local processes, not the AWS container, scheduling,
or network envelope. Use --trace only in a separate diagnostic suite.
The comparison requires successful execution, fresh process identities, matching workloads, and completed cleanup. It reports paired median differences with bootstrap confidence intervals. Twelve pairs are exploratory; small effects and tail estimates need more repetitions. Request records also contain a hash of the HTTP method and path, excluding queries and credentials. Repeated hashes identify endpoints to inspect; requests with different parameters can still be necessary.
Independent API and executor processes
Section titled “Independent API and executor processes”Use the replicated runner to avoid putting eight concurrent actions on one local
executor. With --replicas 8, it starts eight frontend API processes, eight
executor processes, and eight additional API processes for callbacks and execution
resources. Each process uses a current-thread Tokio runtime. A local proxy admits
one request per process and keeps the slot occupied until the upstream HTTP
response ends, including accounting after the terminal execution event.
The callback pool lets executors finish while frontend API requests wait for
their streams. It also serves browser messages to execution channels. All
processes use the same fixture database and object storage.
API database pools use the AWS connection budget of four connections maximum,
with no minimum. The benchmark records process identities, runtime models,
binary hashes, admissions, queue time, and full response lifetimes.
The runner uses the standard fixture ports and reserves ports 8442 and 8443,
plus backend ports starting at 18440, 18540, and 18640. It refuses to adopt
existing listeners. --thread-stack-mb applies to spawned Rust threads;
it does not resize the current-thread runtime’s main stack.
Build both revisions with the current benchmark adapter, then run:
python3 tests/widget-action-stack/replicated.py \ --baseline /tmp/widget-baseline/release-fast/widget_action_stack \ --candidate /tmp/widget-candidate/release-fast/widget_action_stack \ --config /tmp/flow-widget-stack/fixture/browser-config.json \ --replicas 8 --samples 104 --warmup 3 --trials 4 \ --modes warm navigation action --output /tmp/widget-replicatedpython3 tests/widget-action-stack/replicated_compare.py /tmp/widget-replicated \ --json-output /tmp/widget-replicated/comparison.jsonThe runner alternates baseline and candidate order. Passing the same binary
twice provides an A/A check of measurement variation. Frontend stage options are
the same as for cold.py. Use --replicas 1 in a separate suite for a sequential
reference. Comparisons across different process topologies are descriptive and
cannot establish a code speedup.
Warm trials require completed work on every replica before measured clicks. Navigation trials start fresh pools before loading the pages. Action trials verify all page loads and their accounting, drain outstanding requests, then replace every backend process while preserving each browser document. Unexpected requests before a worker’s click invalidate that cold boundary. The comparison checks the complete admission ledger and persisted accounting; failed or partially observed trials cannot produce improvement claims. Concurrent actions are correlated, so uncertainty is calculated across paired trials rather than treating eight actions in one burst as eight independent experiments.
The browser intentionally cancels invoke streams after successful terminal events. Such cancellations are accepted only when the matching request has verified execution success, persisted accounting, and a fully drained upstream response. Older API revisions may return 404 for the optional telemetry sampling configuration. The manifest declares this single exception; the browser must observe it during bootstrap, and it never counts as successful warmup work.
These processes still share the host’s CPU and memory. The proxy, browsers, Postgres, Redis, and object store also run locally. No CPU or memory quota is enforced. Fresh processes leave storage and OS caches warm, and process readiness is measured separately from navigation and clicks. The native adapter uses the default allocator and its local API initialization path; AWS binaries use mimalloc and a different bootstrap. Local timers keep running between requests. Lambda scheduling, DSQL latency, and the API Lambda compute-attempt wrapper remain outside this test. Confirm hosted latency with AWS traces after identifying an improvement locally.
Storage layout comparisons
Section titled “Storage layout comparisons”Compare fragmentation separately from code changes. Keep the existing fragmented state and prepare a second state from the same metadata export, using different infrastructure ports:
python3 tests/widget-action-stack/stack.py --state /tmp/widget-compact prepare \ --postgres-port 55450 --redis-port 56450 --s3-port 9054python3 tests/widget-action-stack/run.py --state /tmp/widget-compact prepare \ --metadata-export /tmp/widget-app-export --fixture-layout compactBoth infrastructure stacks must be running and both prepared browser sessions must be valid. Keep the frontend API and web origins identical. Pass the same backend binary and production frontend stage for both variants:
python3 tests/widget-action-stack/replicated.py --fixture-layout-experiment \ --baseline-state /tmp/flow-widget-stack --candidate-state /tmp/widget-compact \ --baseline /tmp/widget-candidate/release-fast/widget_action_stack \ --candidate /tmp/widget-candidate/release-fast/widget_action_stack \ --baseline-web-state /tmp/flow-widget-stack \ --candidate-web-state /tmp/flow-widget-stack \ --replicas 8 --samples 104 --warmup 3 --trials 4 \ --modes warm navigation action --output /tmp/widget-layout-comparisonOmitting --config selects each state’s prepared browser session. Use
--baseline-config and --candidate-config for explicit per-state overrides.
Copied frontend sources also need the matching source-root options described
above. The runner alternates states between trials; it does not compact,
reimport, or rewrite either fixture during measurement.
The comparison requires identical record and schema hashes, graph identity, backend binary, and frontend build. It permits different fragment and deletion file layouts only in this explicit experiment. Ordinary code comparisons reject physical layout differences. This measures the benefit of an already compact dataset; it does not measure maintenance cost or justify compaction on each write.
Diagnostic workload
Section titled “Diagnostic workload”Install the workspace dependencies, then start the optimized diagnostic server:
mise run bench:widgets:serve -- --profile localIn another terminal, run warm-cache, fresh-template-cache, and concurrent-burst scenarios:
mise run bench:widgets -- --samples 100 --concurrency 8 \ --output /tmp/widget-baseline.jsonThe four variants isolate serial accounting, overlapping accounting, bundled widgets, and both changes together. The real executor template loader, accounting client, widget source, LanceDB filter, and UI nodes execute in every variant. The loopback hub supplies the accounting and widget endpoints. It does not run the API’s authentication, quota database, dispatch, or snapshot producer.
--profile calibrated on the server injects illustrative stage delays informed
by observed hosted requests. Those delays are inputs to the experiment, not a
measurement of AWS performance. Individual stages can be overridden with the
server’s --*-ms options. The default local profile injects no delay.
The diagnostic cold scenario uses a new executor template-cache key. It leaves
the process, database connection, and OS page cache warm. Its dormant board nodes
exercise preparation cost; they do not reproduce the application’s executed loops.
To compare a subsequent run and enforce a server-patch budget:
mise run bench:widgets -- --samples 100 --concurrency 8 \ --compare /tmp/widget-baseline.json --output /tmp/widget-candidate.json \ --budget-ms 500This budget applies to receipt of the semantic history patch. Use the application browser workload to evaluate the user-visible 500 ms target. Debug Rust builds and a development frontend are useful for verifying the fixture, but their latencies should not be presented as optimized application performance.
In-process runtime benchmarks
Section titled “In-process runtime benchmarks”What the harness measures
Section titled “What the harness measures”The throughput benchmark:
- loads the checked-in test app and board from
tests/flow; - initializes the current node catalog and local object stores;
- suppresses normal execution logs;
- warms the runtime before sampling;
- runs the same board concurrently at configured in-flight levels;
- reports Criterion latency and element-throughput distributions.
It measures in-process workflow execution. It does not include ingress, external APIs, remote storage, model inference, databases, queueing, network latency, container startup, or an end-user request path.
Historical reference snapshot
Section titled “Historical reference snapshot”The previous internal run used:
| Setting | Recorded value |
|---|---|
| CPU | 16-core Apple M-series machine |
| Memory | 32 GB |
| Operating system | macOS |
| Build | Optimized benchmark profile with thin LTO |
| Allocator | mimalloc |
| Workload | Small checked-in workflow; two nodes and five pins |
Four worker threads
Section titled “Four worker threads”| Concurrent executions | Approximate throughput | Approximate batch latency |
|---|---|---|
| 128 | 65,000 exec/s | 2.0 ms |
| 512 | 100,000 exec/s | 5.1 ms |
| 1,024 | 112,000 exec/s | 9.1 ms |
| 2,048 | 121,000 exec/s | 17 ms |
| 4,096 | 123,000 exec/s | 33 ms |
| 8,192 | 124,000 exec/s | 66 ms |
Sixteen worker threads
Section titled “Sixteen worker threads”| Concurrent executions | Approximate throughput | Approximate batch latency |
|---|---|---|
| 128 | 60,000 exec/s | 2.1 ms |
| 512 | 140,000 exec/s | 3.6 ms |
| 1,024 | 177,000 exec/s | 5.7 ms |
| 4,096 | 228,000 exec/s | 18 ms |
| 8,192 | 238,000 exec/s | 35 ms |
| 32,768 | 241,000 exec/s | 135 ms |
| 65,536 | 244,000 exec/s | 269 ms |
These values describe this synthetic in-process workload. A workflow that performs HTTP requests, model inference, storage, database work, or substantial serialization will be dominated by those operations.
Allocator snapshot
Section titled “Allocator snapshot”The historical high-concurrency allocator run recorded approximately:
| Allocator | Throughput at 1,024 concurrent executions |
|---|---|
| mimalloc | 222,000 exec/s |
| System allocator | 179,000 exec/s |
Allocator effects vary by platform, allocation pattern, and concurrency. Run both variants on the deployment target rather than assuming the same percentage improvement.
Run the benchmarks
Section titled “Run the benchmarks”Run commands from the repository root.
FL_WORKER_THREADS=4 \FL_CONCURRENCY_LIST="128,512,1024,2048,4096,8192" \FL_MEASURE_SECS=10 \RUST_LOG=off \cargo bench -p flow-like-catalog \ --bench throughput_bench \ --features mimalloc \ -- peak_throughputFL_WORKER_THREADS=4 \FL_MAX_IN_FLIGHT=32 \RUST_LOG=off \cargo bench -p flow-like-catalog \ --bench throughput_bench \ --features mimalloc \ -- raw_throughputRUST_LOG=off cargo bench -p flow-like-catalog \ --bench allocator_bench \ -- --save-baseline system
RUST_LOG=off cargo bench -p flow-like-catalog \ --bench allocator_bench \ --features mimalloc \ -- --baseline systemThe helper script runs both variants and formats their output:
bash packages/catalog/benches/compare_allocators.shRUST_LOG=off cargo bench -p flow-like-catalog --features mimallocThe first run may spend significant time compiling the optimized benchmark profile. Later runs reuse Cargo artifacts unless relevant code or features changed.
Configuration
Section titled “Configuration”| Environment variable | Default | Purpose |
|---|---|---|
FL_BOARD_ID | Checked-in benchmark board | Board loaded from the test app |
FL_START_ID | Checked-in start node | Entry node executed by the benchmark |
FL_APP_ID | Checked-in test app | App directory under the test store |
FL_TESTS_DIR | ../../tests from the package | Local benchmark object store |
FL_WORKER_THREADS | Logical CPU count | Tokio runtime worker threads |
FL_MAX_BLOCKING_THREADS | Worker threads × 4 | Tokio blocking-thread ceiling |
FL_CONCURRENCY_LIST | Automatic sweep | Comma-separated in-flight levels |
FL_MAX_CONCURRENCY | Logical CPU count × 8 | Maximum automatic sweep value |
FL_MEASURE_SECS | 10 | Criterion measurement duration per level |
FL_MAX_IN_FLIGHT | Logical CPU count × 4 | In-flight tasks in the raw benchmark |
RUST_LOG | Inherited environment | Set to off for low-noise measurements |
Make a comparison reproducible
Section titled “Make a comparison reproducible”Record these details with every result:
- Commit SHA and whether the worktree is clean.
- Rust and Cargo versions.
- Operating system, kernel, CPU model, core topology, and memory.
- Power mode, virtualization, and container limits.
- Allocator and Cargo feature set.
- Board, start node, app ID, and any changes to the test fixture.
- Worker, blocking-thread, concurrency, and measurement settings.
- Criterion estimate and confidence interval, not only the fastest sample.
Compare two commits on the same machine with the same fixture and environment. Alternating baseline and candidate runs helps reveal thermal or background-load drift.
Interpret results
Section titled “Interpret results”- Single execution isolates the overhead of one small in-process run.
- Throughput shows how efficiently the runtime uses concurrency.
- Batch latency grows with queue depth even while throughput improves.
- Peak throughput is not the same as a safe production operating point.
- External-node workflows require end-to-end benchmarks that include their actual dependencies.
Do not compare these numbers directly with another product unless the workload, durability, logging, retries, isolation, hardware, and measurement boundary are equivalent.
Contributing a benchmark
Section titled “Contributing a benchmark”- Add or update a target under
packages/catalog/benches/. - Keep the workload deterministic and check in its fixture.
- Document the measurement boundary and environment variables.
- Include before-and-after Criterion output for performance changes.
- Explain any change in behavior, durability, or correctness that accompanies the performance result.