Rule Cascade
Reference

Performance

How fast each runtime evaluates, how the rule server behaves under load, and how to measure it on your own hardware.

How fast each runtime evaluates, how the rule server behaves under load, and how to measure it on your own hardware. The numbers below were measured on one laptop; they are a record of what one run printed, not a guarantee, and they are not checked by CI (benchmarks on shared CI runners are too noisy to gate on).

Running the benchmarks

The benchmarks are part of the Rule Cascade source, not of the published packages. This section says what they do, so that the numbers below can be read and compared.

Every runtime benchmark does the same thing:

  • reads the payments bundle, acme.payments.transfer.bundle.json, with its fromBundle (no compiling from YAML);
  • evaluates the benchmark requests round-robin on the server channel, on one thread: an allowed domestic transfer, a denied one with a rendered message, an international one with three findings and an effect, and one narrowed to a component;
  • warms up for BENCH_WARMUP seconds (default 2), then measures for BENCH_SECONDS;
  • times every evaluation with the monotonic clock (so each latency includes one clock read) and reports evaluations per second (count / measured time) and the p50 and p99 latency (nearest rank).
RuntimeHarness
TypeScriptevaluate.mjs, on the built package
JavaBenchmark.java, a plain main (no JMH), compiled with javac after make java
GoBenchmarkEvaluateTransfer in bench_test.go, go test -bench with p50-ns, p99-ns and evals/s metrics
Pythonevaluate.py, timeit.default_timer per evaluation

The rule server load test, load.mjs, starts the server with the token on and the payments contracts as the rules, once with RULE_SERVER_WORKERS=0 and once with a worker pool, one after the other, and posts the same requests to /evaluations over keep-alive connections from load-generating worker threads. It needs no dependency. BENCH_CONNECTIONS (32), BENCH_CLIENT_THREADS (2) and BENCH_WORKERS ("0 N") change the setup. The generator runs on the same machine, so the result compares the two settings; it is not a capacity figure for a server on its own hardware.

Measured on

Apple M2, 8 cores (4 performance, 4 efficiency), 24 GB, macOS 27.2 (arm64); Node.js 24.22.1, OpenJDK 21.0.11, Go 1.26.5, CPython 3.14.6; Rule Cascade 1.0.0-alpha.10; 2 November 2026.

The machine is the one of the earlier records (1.0.0-alpha.2 on 3 October and 1.0.0-alpha.9 on 19 October 2026); Node.js moved from 22 to 24 and Java from 17 to 21. The machine was busy: the load average was between 9 and 10 (19 October: 3 to 8). Two consecutive runs of make bench with BENCH_SECONDS=5, verbatim:

Run 1 (load average 9.3 before, 10.1 after):

typescript rule-cascade 1.0.0-alpha.10 node 24.22.1: 102591 evals/s, p50 9.9 us, p99 15.3 us, 512954 evaluations in 5.0 s
java rule-cascade 1.0.0-alpha.10 jdk 21.0.11: 346194 evals/s, p50 2.8 us, p99 4.5 us, 1730971 evaluations in 5.0 s
BenchmarkEvaluateTransfer-8   	  602384	      9394 ns/op	    106448 evals/s	      8917 p50-ns	     17084 p99-ns
python rule-cascade 1.0.0a10 CPython 3.14.6: 16622 evals/s, p50 58.7 us, p99 101.0 us, 83111 evaluations in 5.0 s
rule server load test: node 24.22.1, 8 CPUs, 32 connections on 2 client threads, 2 s warm-up, 5 s measured
RULE_SERVER_WORKERS=0: 16842 req/s, p50 1.23 ms, p99 16.13 ms, 84209 requests, 0 not 200
RULE_SERVER_WORKERS=4: 25717 req/s, p50 1.15 ms, p99 2.57 ms, 128586 requests, 0 not 200

Run 2 (load average 10.1 before, 9.4 after):

typescript rule-cascade 1.0.0-alpha.10 node 24.22.1: 107375 evals/s, p50 9.5 us, p99 13.8 us, 536876 evaluations in 5.0 s
java rule-cascade 1.0.0-alpha.10 jdk 21.0.11: 344968 evals/s, p50 2.8 us, p99 4.5 us, 1724842 evaluations in 5.0 s
BenchmarkEvaluateTransfer-8   	  593851	      9314 ns/op	    107360 evals/s	      8917 p50-ns	     14792 p99-ns
python rule-cascade 1.0.0a10 CPython 3.14.6: 16302 evals/s, p50 58.0 us, p99 135.4 us, 81512 evaluations in 5.0 s
rule server load test: node 24.22.1, 8 CPUs, 32 connections on 2 client threads, 2 s warm-up, 5 s measured
RULE_SERVER_WORKERS=0: 23931 req/s, p50 1.22 ms, p99 3.10 ms, 119653 requests, 0 not 200
RULE_SERVER_WORKERS=4: 22417 req/s, p50 1.27 ms, p99 3.07 ms, 112086 requests, 0 not 200

Against 1.0.0-alpha.9 on 19 October, at the median: Java 2.8 µs (was 3.2 to 3.3) with p99 4.5 µs (was 9.5 to 12.5), Go 8.9 µs (was 9.4), TypeScript 9.5 to 9.9 µs (was 9.6 to 10.0) with p99 14 to 15 µs (was 25 to 40), Python 58 µs (was 59 to 60), and the rule server 1.2 ms (was 1.3 ms), on a busier machine. Java and the TypeScript p99 improved the most; the runtime upgrades (JDK 21, Node.js 24) changed in the same step as the code, so these runs do not say which of the two did it. To compare two versions, run make bench for both, one after the other, on the same machine.

What the numbers say

  • Evaluating one request takes microseconds in every runtime: about 3 µs at the median in Java, 9 to 10 µs in Go and TypeScript, and 60 µs in Python, for this ruleset (14 rules, decimal arithmetic, message rendering). A service that embeds a runtime adds no noticeable latency to a request.
  • The rule server spends its time on HTTP, not on rules. At 17 000 to 26 000 requests per second, the median request takes about 1.2 ms end to end, of which the evaluation is some 10 µs. The rest is the HTTP stack, JSON parsing and serialisation, and the one log line per request.
  • The worker pool does not reliably raise throughput. In run 1 RULE_SERVER_WORKERS=4 answered more requests than 0 (25 700 against 16 800, where 0 had a 16 ms p99 on the busy machine); in run 2 fewer (22 400 against 23 900). Across all the recorded runs the order changes from run to run, so they do not show that workers help throughput. What is certain is the cost they add: a request crosses a thread boundary twice (structured clone of the request and of the result), and the evaluation it moves off the event loop is cheap. The pool exists to protect the event loop: an evaluation that runs too long (a pathological input, a slow custom operator) costs one worker for RULE_EVALUATION_TIMEOUT_MS and is answered 503, instead of stalling every other request. Enable it when your rulesets have evaluations that are slow relative to the HTTP work, or when the protection matters more than a few percent of throughput. To scale throughput, add replicas: the server is stateless.

Worker pool details

VariableMeaningDefault
RULE_SERVER_WORKERSWorker threads for evaluations; 0 evaluates on the event loop0
RULE_EVALUATION_TIMEOUT_MSWith workers: the longest an evaluation may run before it is answered 503 and its worker replaced; 0 for no limit5000
  • Each worker holds the current snapshot, read from the bundles of the rulesets being served. Before a worker is given a request it receives the store's current snapshot if it holds an older one, and the request's ruleset is resolved against that same snapshot, so a reload never puts a request and its rules out of step. Results are byte-for-byte the same as in process; the server tests compare them.
  • The timeout is measured from the moment a worker takes the request, not from its arrival. Waiting requests are bounded by count (256 per worker); beyond that the answer is 503 with Retry-After: 1.
  • Workers that die before answering anything (a broken installation) are not replaced in a loop: after three in a row the pool gives up, logs a fatal line, and evaluations are answered 503.
  • Custom operators cannot cross into a worker thread. An embedding host passes operatorsModule, an ES module that exports them, and still passes operators so that missingOperators() can check them. The program rule-cascade-server registers no custom operators.
  • An evaluation on the event loop (RULE_SERVER_WORKERS=0) cannot be interrupted; the timeout has no effect there and the server says so in a warning at start-up.

On this page