← Selected work Event Ledger / Case study Source ↗

Event Ledger

Correct events. Measured latency.

Live · 17 tests · Updated 2026

Java 21 · JUnit 5 · Maven · Concurrency

Context
Independent systems experiment · 2026
My role
Project design and implementation with AI-assisted development
Team
Solo project
Evidence
17 JUnit tests · raw benchmark results and source hashes

01 Problem

Low-latency claims need correctness, explicit measurement boundaries, and repeatable evidence. Average speed alone can hide queue saturation and long latency spikes.

02 Constraints

  1. 01Synthetic single-instrument events, not an exchange feed or live trading system.
  2. 02ADD, REDUCE and DELETE events use integer ticks and quantities; sequence errors reject without mutation.
  3. 03The optimized book requires dense order IDs and a bounded price range, trading memory and flexibility for fewer allocations.
  4. 04Service timings exclude parsing, disk IO and data generation. Scheduled-to-done includes producer lag, backpressure, queue wait and processing.
  5. 05Desktop Windows timing is noisy; no pinned cores, kernel bypass, wire-to-wire measurement or worst-case guarantee.

03 Architecture

Synthetic feedSequence validationBounded queueSingle writerOrder bookLatency evidence

04 Decisions

Keep a readable reference implementation.

Why Randomized differential checks compare state while explicit tests cover known failure cases.

Tradeoff A shared mistake remains possible; differential testing complements semantic assertions.

Measure service and scheduled completion separately.

Why Arrival deadlines remain fixed under backlog, so slow scheduling and queue saturation stay visible.

Tradeoff Timestamping and a volatile result sink perturb service timing; figures are workload-specific.

Retain every round and unsuccessful result.

Why Three JVM forks with alternating implementation order expose variability rather than cherry-picking the fastest run.

Tradeoff Median round percentiles are descriptive; they are not pooled percentiles or confidence estimates.

05 Failure

  • Duplicate, missing or out-of-order sequence.

    Reject the event without advancing state; repair or replay the input.

  • An order reduction exceeds its remaining quantity.

    Reject without mutating order or level totals.

  • The consumer falls behind.

    Bounded queue applies backpressure; timing includes the backlog and records blocked offers.

  • A journal record is corrupted.

    Hash validation rejects replay. Full-chain rewriting or clean suffix removal requires external evidence to detect.

06 Object

October 4, 2026 · i9-13900HK / Windows / Java 21 · synthetic workload

Median round service P99: reference 1.75 us / array 0.40 us 500k scheduled events/s completion P99: 487.75 us / 467.90 us Worst observed array service sample: 5.17 ms Engine speedup did not translate into comparable end-to-end speedup.

07 Inspect

08 What I would improve next

  1. Repeat on controlled Linux hardware with profiling and JMH.
  2. Add licensed exchange-event normalization and checkpoint recovery.
  3. Measure multiple symbols and different load distributions before generalizing.