Pipeline · Multi

orderer

LMAX-Disruptor-style, multi-core order-matching engine with journaling, checkpoints, crash recovery and Raft-style replicated failover. Implemented in 5 languages with byte-identical output; replicas of different languages share one cluster.

In Progress GitHub
5
Languages
0
Dependencies
1.3
orderer-spec
Byte
Identical
5/5
Replicated
01

Features

  • Multi-partition order matching with durable journaling
  • JSONL and binary journal formats
  • Snapshot-based recovery and consistent state capture
  • Multi-goroutine safe publish mechanism
  • Pluggable matching cores (FIFO, no-op)
  • Configurable fsync policies
  • Raft-style replicated ingress log with kill -9-tested failover, exactly-once client sessions and linearizable reads
  • Pre-shared-key authenticated transport; scale-out over replica groups sharded by symbol
02

Architecture

Pipeline Flow
  • Handle.Publish → ingress → router → partition inboxes
  • Partition inboxes → matching engines → outboxes
  • Outboxes → egress plugs (callbacks, acknowledgments, metrics)
Partitioning
  • Each partition maintains its own journal
  • Independent matching engine per partition
  • Pluggable egress handlers for flexible output routing
03

Replication

Design
  • Raft-style replicated log as a pure state machine: pre-vote, check-quorum, log compaction and snapshot install
  • Ack at commit; the matching pipeline applies committed entries in log order, so every replica emits byte-identical events
  • Digest-based divergence detection: a replica whose state differs from the majority halts
  • Scale-out: independent replica groups sharded by symbol, no shared state between groups
Verification
  • Deterministic fault simulator (loss, duplication, reordering, partitions, crashes, torn disks) with mutation testing
  • 28 shared conformance traces and wire/storage fixtures that every language must reproduce byte for byte
  • Real processes under load with kill -9 of the leader: every acknowledged batch survives on every replica, in order, exactly once
  • Mixed-language clusters, including four languages at once, with authenticated transport and snapshots of live book state crossing language boundaries; all replicas end at the same SHA-256 state digest
Replicated throughput (3 nodes, M1, no-op state machine)
  • C++ ~19M commands/s, Rust ~17M, Go ~17M, Java ~10M, TypeScript ~2-3M
  • ~8-10M commands/s with fsync on a quorum (Rust, Go)
04

Implementations

C++20 ~28M/s
Rust ~33M/s
Java ~20M/s
Go ~19M/s
TypeScript ~8M/s
05

Dependencies

  • Rust, C++20, Java 17+, Go 1.21+, Node 18+ — one idiomatic implementation per language
  • matcher — Core matching library
  • Zero external dependencies across all implementations
06

Testing

Specification Benchmarks
  • Specification benchmarks via orderbench harness
  • Standardized performance measurement across implementations
Cross-Implementation Verification
  • Byte-identical output verification across all 5 languages
  • Deterministic replay testing for journal recovery
  • Snapshot consistency checks across implementations
  • Replication: shared protocol traces, wire fixtures and mixed-language failover runs