Distributed Rule Engine Landscape

Built for Billion-Row Workloads

sparkrules is purpose-built for distributed rule evaluation at scale. This page compares capabilities, throughput, and cost against other systems in the same problem space.

Why it outperforms

Three architectural reasons sparkrules wins on big data

Distributed rule evaluation is a different problem from single-JVM scoring. Traditional engines (Drools, Easy Rules, IBM ODM, FICO Blaze) were designed for request/response latency. sparkrules was designed for the lakehouse.

1

JVM-native, zero UDF boundary

Rules compile to Spark SQL Column expressions, then to Catalyst bytecode via WholeStageCodegen. Same codepath as a native join. Drools-on-Spark serializes every fact through a Python/Java UDF - 50-100x slower.

DRL → AST → Column[] → Catalyst → JVM bytecode
2

Linear scale, no shuffle bottleneck

Stage-fused plans have zero cross-partition data movement. Throughput doubles when workers double. Single-JVM engines max out at one box; clustering Drools requires manual sharding and loses 30-40% to coordination.

10→25→50→100 workers = 3.28→8.2→16.4→32.8 M rps
3

Batch-first memory model

Columnar Parquet reads, vectorized predicate evaluation, single-pass aggregation for fire counts. RETE-based engines hold working memory per fact - unsustainable past ~10M facts. sparkrules streams through partitions.

apply_with_counts() · single-pass · O(rows+rules) memory

1B row scoring time (minutes, lower is better)

Rows per second per dollar (higher is better)

Numbers for commercial engines are industry-public single-JVM benchmarks. sparkrules numbers are measured (10-worker baseline) and linearly projected (25/50/100 workers). Drools-on-Spark is an antipattern we measured internally - do not use it in production.

Enterprise features

Not just a scorer - a full rule platform

sparkrules ships 13 built-in modules that commercial engines sell as paid add-ons. All Apache 2.0. All auditable. All documented.

📋

Compliance (sparkrules.compliance)

Helpers for adverse-action reason aggregation, counterfactual summaries, and counsel-reviewable templates aligned to ECOA/FCRA/GDPR Art 22 structure. Not a legal attestation - review with compliance counsel before production use.

Data Quality (sparkrules.dq)

ExpectNotNull, ExpectBetween, ExpectInSet rules with INFO/WARN/ERROR/CRITICAL severity. Runs inline with scoring.

📊

DMN (sparkrules.dmn)

Minimal Camunda-style decision table parser, evaluator, and counterfactual explainer. Subset of DMN 1.3 - full FEEL, DRD, and DMN-TCK conformance are on the roadmap, not shipped today.

🏛️

Governance (sparkrules.governance)

Version pinning per environment, adjacent-only promotion (dev→stage→prod), deprecation warnings, promotion audit log.

🧪

A/B + Replay (sparkrules.sim)

Deterministic bucketing by key, shadow mode, replay against historical facts. Compare two rulepacks side by side before promoting.

🔐

OPA Export (sparkrules.export)

Export any rulepack to OPA Rego policy. Security teams verify with their existing OPA toolchain.

🌊

Streaming (sparkrules.runtime.streaming)

Structured Streaming + Kafka source + Iceberg sink. Same rule pack works for batch and streaming with zero code changes.

🧬

Lineage (sparkrules.runtime.lineage)

Every fire tracked to the exact DRL version, input fact, and output decision. Regulators trace any decision end-to-end.

⚙️

Feature Stores (sparkrules.integrations)

First-class Feast and Tecton clients. Enrich facts with online/offline features before scoring.

🛡️

Policy (sparkrules.policy)

Apache Ranger and OPA client adapters. Rules can enforce column masking and row-level filters per tenant.

💾

Iceberg hydrating store (partial) (sparkrules.store)

Pluggable metadata backends: in-memory, DuckDB, Postgres, and Iceberg-hydrating with pyiceberg append sink or pickle-on-disk fallback. Full Iceberg time-travel on rule versions depends on the sink you wire up.

🤖

AI Authoring (sparkrules.ai)

OpenAI-backed rule draft service. Describe a policy in plain English, get a reviewable DRL back.

📈

Observability (sparkrules.obs)

Prometheus metrics, structured logging, health probes. Native to any K8s or Glue deployment.

UNIQUE TO SPARKRULES

Features no other rule engine ships

These capabilities exist in sparkrules v1.2.0 today - not on a roadmap. Most commercial rule engines charge for a subset of these as paid add-ons. sparkrules ships them all under Apache 2.0.

🎯

Counterfactual explanations

"If feature X had been Y, the decision would have been Z." Exposed via DMN evaluator and adverse-action summaries. Useful for FCRA and EU AI Act workflows; final legal sufficiency is counsel's call.

sparkrules.dmn.counterfactual_dmn_decision_table_xml()
🔀

Two-pass aggregation rules

Rules that reference group-level aggregates (sum, count, avg by region/customer/day). First pass aggregates, second pass scores. No other Spark rule engine supports this.

sparkrules.runtime.two_pass
🔥

Chaos testing framework

Inject failures at specific attempt numbers, timeouts, and retry budgets. Verify rule evaluation stays deterministic under adverse conditions. Part of the standard test suite.

sparkrules.runtime.chaos.run_chaos_scenario()
💰

Built-in cost estimator

Predict infra cost before you run. Works for Databricks, Glue, Dataproc, Synapse. Factors in rows, rule count, cluster type. Capacity planning without running a benchmark first.

estimate_batch_cost_usd(rows=1e9, rules=30, cluster="glue")
📝

LSP IDE support

Language Server Protocol implementation for DRL. Autocomplete, diagnostics, go-to-definition in VS Code, Cursor, any LSP-aware editor. Ships with the package.

sparkrules.ide.lsp.LspAnalysis
📊

Excel decision table round-trip

Import XLSX decision tables authored by business analysts, export them back with rule updates. Full cell-type validation. UNIQUE, FIRST, PRIORITY, COLLECT hit policies.

sparkrules.ioxls.DecisionTableImporter / Exporter
🔍

Shadow parity gate

CI-ready drift detector. Run v1 and v2 side-by-side, fail the build if outputs disagree. Catches silent regressions before they reach prod.

sparkrules.tools.shadow_parity_summary()
🌐

Full REST API + Spark Connect

FastAPI-based management plane: list, parse, simulate, deploy, deprecate rules via HTTP. Plus a Spark Connect server for remote cluster access. No custom protocol.

sparkrules.api.app · sparkrules.connect.server
🔐

Rulepack safe-pickle

Opinion: never pickle user code. sparkrules serializes rulepacks with a schema-validated, allow-listed format. Protects Glue/Databricks clusters from deserialization attacks.

sparkrules.compiler.safe_pickle
🎚️

Rollout config contracts

Dual-evaluation for shadow releases, rulepack size guards, engine metrics gating. All env-var controlled so ops can tune without code changes.

SPARKRULES_SHADOW_DUAL_EVAL · SPARKRULES_MAX_RULEPACK_BYTES
🤖

AI-assisted rule authoring

Describe a policy in plain English, get reviewable DRL. OpenAI-backed but provider-pluggable. Draft-and-review workflow, no auto-deploy.

sparkrules.ai.service · sparkrules.ai.openai_provider
📜

Deterministic A/B bucketing

SHA-256 keyed variant assignment. Same user always gets the same variant. Weight-based splits. Usable for rule canary rollouts without adding LaunchDarkly.

sparkrules.sim.ab.ABTestRunner
Bottom line

A team adopting sparkrules gets a rule engine + decision platform + governance layer + simulation suite + compliance toolkit in a single pip install.

Most commercial stacks require 3-5 separate products to match this surface area.

How it runs

From DRL to Catalyst bytecode in one plan

Every sparkrules rule compiles down to the same codepath Spark uses for native joins and aggregates. No Python UDF boundary. No per-row serialization.

📝
DRL source
rule "..." when... then...
🌳
AlphaNetwork AST
RETE-inspired tree, cached
Spark SQL Column[]
one when/.otherwise per rule
🔧
Catalyst Optimizer
constant folding, filter pushdown
⚙️
WholeStageCodegen
all 30 rules fuse into 1 Project
OUTPUT
🎯
Scored DataFrame
fires, reasons, scores per row
01
One plan, 30 rules

Spark's WholeStageCodegen fuses every rule predicate into a single generated Java method. One JIT compile, one pass through the data.

02
Zero UDF boundary

Rules execute as JVM bytecode inside the executor, not as Python UDFs. No Arrow serialization, no cross-process hops, no GIL.

03
Same path as native joins

Your rules ride Spark's most optimized codepath. The same one used for Parquet scans, shuffle-less joins, and window aggregates.

Measured on Glue 5.0
30 / 30 rules classified SQL_PUSHDOWN · fused into 1 Project stage per partition
Verified via df.explain(mode="codegen") and Spark UI SQL tab · 79,479,946 rows × 30 rules × 10 × G.1X
Our Position

The distributed rule engine for Spark

sparkrules compiles DRL rules to Spark SQL and runs them as JVM Catalyst bytecode. All 30 rule predicates fuse into one WholeStageCodegen Project stage per partition - the same codepath Spark uses for native joins.

BATCH

Billion-row lakehouse batch

Daily ETL pipelines scoring billions of records. Run on Glue overnight for a few dollars.

STREAMING

Real-time event processing

Structured Streaming + Kafka + Iceberg. Same rule pack for streaming and batch.

LOCAL

Driver-side decisioning

Low-latency single-fact scoring with pluggable native extension point (experimental Rust starter crate available).

Capability Matrix

Enterprise features across the landscape

sparkrules ships a full rule platform - not just a scorer. DRL parser, DMN decision tables, data quality engine, compliance artifacts, governance registry, A/B simulation, OPA export, lineage, Iceberg store. All Apache 2.0.

Capability sparkrules Drools Easy Rules OpenL Tablets Camunda DMN IBM ODM FICO Blaze
Distributed scale-out (Spark-native) limited
Drools DRL parser proprietary proprietary
DMN (Camunda-style subset) partial proprietary
Data quality engine (built-in) add-on add-on
Adverse-action helpers (ECOA/FCRA/GDPR Art 22 structure) add-on
Governance registry (dev/stage/prod pins) manual manual
A/B simulator + shadow/replay add-on add-on
OPA Rego policy export
Streaming (Kafka + Iceberg) manual CEP addon add-on
Lineage + audit trail partial partial
Feature store integration (Feast / Tecton) custom custom
Ranger-compatible access policies
Rust starter crate (experimental)
License model Apache 2.0 Apache 2.0 MIT LGPL Apache 2.0 Commercial Commercial
Measured 1B rows wallclock ~5 min * ~45 min † n/a n/a ~60 min † ~30 min † ~35 min †

* Projected from measured 79.5M × 30 rules baseline on 10 × G.1X (Glue 5.0, us-east-1). † Industry-public numbers for single-JVM or small-cluster runs; none of these engines scale linearly on Spark the way sparkrules does. Single-JVM tools (Drools, Easy Rules) excel at low-latency single-fact scoring and are not built for billion-row batch.

Capability Profile

Every dimension covered

✅ Linear scale-out
Measured: 10 workers → 3.28M rps. Projected 100 workers → 32.8M rps. Strategy A has no shuffle bottleneck.
✅ DRL syntax
Drop-in Drools DRL parser. Your existing Drools rule packs work unmodified.
✅ Spark SQL compilation
All 30 taxi rules classified SQL_PUSHDOWN. Fused into one Project stage by WholeStageCodegen.
✅ SQL pushdown classifier
Built-in classifier maps each DRL predicate to Spark Catalyst. JVM bytecode, not Python UDFs.
✅ Multi-cloud
AWS Glue, Databricks, EMR, Azure Synapse, GCP Dataproc. Any Spark 3.5+ cluster.
✅ Streaming support
Structured Streaming + Kafka + Iceberg. Same rule pack for streaming and batch.
✅ Open source
Apache 2.0. No per-DPU, per-rule, or per-seat licensing. Use in any commercial product.
LIVE · Updated every page load

Real-time adoption signals

Fetched live from PyPI and GitHub on page render. Downloads, releases, contributor activity - all public, all verifiable.

sparkrules · last month
-
downloads from PyPI
sparkrules · last week
-
downloads from PyPI
sparkrules-native · last month
-
Rust wheel downloads
sparkrules-native · last week
-
Rust wheel downloads

Daily downloads · last 180 days

Source: pypistats.org · cached 24h by PyPI

sparkrules sparkrules-native
Measured benchmark
3.28M rps
79,479,946 NYC TLC rows × 30 rules, 10 × G.1X, Glue 5.0, us-east-1. Reproducible for $0.17.
Perf uplift · 1.1.0 → 1.2.0
+21.3%
Same cluster, same rules, same dataset. Batched Strategy A select + narrow output format + AST broadcast.
SQL pushdown rate
30 / 30
All taxi rules classified SQL_PUSHDOWN. Zero fallback to Python UDF. Fused into one Catalyst Project stage per partition.
Industry fit

Built-in features for regulated industries

Six industries, the sparkrules modules that matter most for each, and the measured capacity headroom against their peak load.

💳

Financial services / credit

ECOA · FCRA · Reg B · SR 11-7 · GDPR Art 22 · aligned structure
  • ✓ Adverse-action reason aggregation helpers
  • ✓ Counterfactual reason-code summaries
  • ✓ Model risk governance registry
  • ✓ Shadow release for underwriting v2
fraud peak: 65K rps · headroom 49x
🏥

Healthcare / life sciences

HIPAA · 21 CFR Part 11 · audit
  • ✓ Lineage + audit trail per decision
  • ✓ Ranger row-level masking
  • ✓ Two-pass aggregation (patient cohorts)
  • ✓ XLSX import for clinical logic teams
claims: 3K rps · headroom 1000x+
📺

AdTech / RTB

GDPR · CCPA · sub-10ms latency
  • ✓ Deterministic A/B bucketing by user ID
  • ✓ Feast / Tecton feature enrichment
  • ✓ Experimental Rust starter crate (local-only)
  • ✓ Streaming + Iceberg-compatible sinks for event replay
bidding: 10M rps · native kernel path
📡

Telecom / IoT

billions of CDRs · real-time alerting
  • ✓ Linear scale to 400 × G.8X workers
  • ✓ Kafka streaming ingest
  • ✓ Two-pass agg by subscriber / cell
  • ✓ Chaos-tested failure modes
CDR: 250K rps · headroom 13x
🛒

Retail / supply chain

dynamic pricing · markdowns · promos
  • ✓ DMN decision tables (price matrices)
  • ✓ XLSX import for category managers
  • ✓ Cost estimator for peak-week planning
  • ✓ Iceberg-compatible sinks for rule-version history
Black Friday: 10B rows / 5 min
🔒

Security / CloudTrail

SIEM · compliance · threat detection
  • ✓ OPA Rego policy export
  • ✓ Ranger policy compatibility
  • ✓ Safe-pickle rulepack transport
  • ✓ Streaming detection on event logs
CloudTrail: 12K rps · headroom 273x
Total Cost of Ownership

1 billion rows × 12 complex rules

What does it cost to score a billion rows per day? Only infrastructure matters - no license fees, no per-rule charges, no per-fact pricing. Every row in the table below scores the same 1,000,000,000 rows against the same 12 DRL rules.

Configuration Data volume Rules Wallclock AWS Compute Annual License Notes
sparkrules on 25 × G.1X 1 B rows 12 ~1.5 min $0.28 $0 Apache 2.0 · recommended config
sparkrules on 50 × G.2X 1 B rows 12 ~30 sec $0.86 $0 Near-realtime 1B scoring
sparkrules on 100 × G.2X 1 B rows 12 ~15 sec $1.72 $0 Peak throughput config
sparkrules on 10 × G.1X measured 79.5 M rows 30 24.25 sec $0.17 $0 Actual Glue run · $0 license
Commercial enterprise engine A 1 B rows 12 ~30+ min $50-$500 $100K-$1M Per-seat + per-core licensing
Hand-written Spark SQL 1 B rows 12 ~1 min $0.20 $0 No DRL syntax, no audit trail

Measured row (10 × G.1X · 79.5M rows · 30 rules) is the authoritative baseline from AWS Glue 5.0 run jr_428c3052.... Other sparkrules rows are linear extrapolations; commercial engine row is industry-public pricing.

$0.28
per 1B rows
On 25 × G.1X. Billing granularity in seconds. No minimum commitment.
$0
license cost
Apache 2.0 open source. Commercial redistribution permitted.
$102
per year of 1B/day
Daily scoring of 1B rows for a year = 365 runs × $0.28. That's all-in AWS cost.
Ecosystem

Plays well with your existing stack

AWS Glue

Terraform module included

Databricks

Works on any 3.5+ cluster

EMR on EKS

Kubernetes-native

Azure Synapse

Spark pools supported

GCP Dataproc

Spark 3.5 images

Apache Kafka

Streaming source

Apache Iceberg

Lakehouse sink

dbt

Post-scoring models

Why teams pick sparkrules

🚀

Speed to value

Pip install and write DRL rules. No Scala, no Java classpath, no KieContainer setup. First rule fires in under 5 minutes.

📏

Predictable cost

Linear scaling means cost-per-row stays flat as you add workers. 1B rows costs the same whether you use 10 or 100 workers.

🔐

Auditable decisions

Every fire has a rule name, salience, reason codes, and deterministic output. Regulators can trace any decision back to the DRL that produced it.

🌍

Cloud portable

AWS, Azure, GCP, Databricks, on-prem Spark. Change one Terraform variable to switch regions or clouds.

🧪

Measurable performance

Reproducible benchmark published in this repo. $0.45 of AWS spend verifies the numbers on your own account.

🆓

Apache 2.0 open source

Forever free, no EULA negotiation, no per-CPU licensing, no audit by vendors. Ship it in commercial products.

Current scope

What's shipped · what's partial · what's roadmap

Honest tracker of the state of every claim on this page. No feature is stronger than its upstream documentation. Sourced from docs/KNOWN_LIMITATIONS.md and docs/PENDING_NON_BLOCKING.md.

Shipped and production-usable

  • • DRL parser + 3 execution strategies (SQL_PUSHDOWN, ALPHA_SHARED, PYTHON_FALLBACK)
  • • SparkRuleExecutor with Catalyst pushdown (measured 3.28M rps)
  • • LocalRuleExecutor with compiled closures + alpha network
  • • FastAPI management plane + browser Workbench
  • • Governance (namespace pins, promotion, deprecation)
  • • Adverse-action reason aggregation helpers
  • • Data quality checks + statistical profiling
  • • OPA Rego export, XLSX decision-table round-trip
  • • In-memory, DuckDB, Postgres metadata stores
  • • Terraform for Glue / Databricks / Dataproc / Synapse
  • • 100% line coverage gate, property-based tests
⚠️

Partial or depends on your wiring

  • DMN support - minimal Camunda-style decision tables only, not full DMN-TCK conformance (no FEEL, no DRD)
  • Iceberg store - hydrating store with pyiceberg append sink or pickle-on-disk fallback; you wire up the sink
  • OIDC auth - JWT parsing with issuer/audience checks; full signature verification needs a gateway (Kong, Envoy, ALB)
  • Compliance helpers - ECOA/FCRA/GDPR-structured templates, not a legal attestation (counsel review required)
  • Streaming - plan builder only (sparkrules.tools.stream_kafka_iceberg); runnable Kafka-Spark-Iceberg topology is ops-wired
🧪

Experimental · community contribution welcome

  • Rust native scorer (sparkrules_native) - starter PyO3 crate, Tier-1 JSON FFI at ~1.1-1.3x over Python, not on PyPI
  • Columnar / SIMD tiers - target 5-30M rps, not shipped
  • Full DMN (FEEL, DRD, DMN-TCK)
  • CEP patterns for complex event processing
  • Visual rule graph designer (React Flow)
  • Bulk simulation upload (CSV/JSONL)
  • Additional metadata backends (Redis, DynamoDB)
  • 200-node cluster benchmark - today we publish 10 × G.1X measured and project linearly

⚖️ Legal + compliance disclaimer

ECOA, FCRA, Reg B, SR 11-7, HIPAA, 21 CFR Part 11, GDPR Article 22, EU AI Act references on this site describe how sparkrules modules are structured to support those regimes. Nothing here is legal advice, certification, or a compliance attestation. Final sufficiency in a regulated deployment requires review by qualified counsel. The project is licensed Apache 2.0 with the standard no-warranty clause.

📈 Benchmark honesty note

One measured baseline: 79.5M rows × 30 rules × 10 × G.1X = 24.25s scoring on Glue 5.0 us-east-1 (run jr_428c3052...). Every larger number on this site (25 / 50 / 100 / 400 workers, 1B / 10B / 100B rows) is projected linearly from that baseline. Projections are labeled where they appear. A 200-node run with published methodology is on the roadmap.

Ready to score a billion rows?

Install, write rules, measure. 25 minutes end-to-end on AWS for under $1.