HFT-52 · Week 24 · Exchange v2

One order through exchange v2

Gateway, inbound queue, engine thread, journal, standby, release gate, ack. Trace one order hop by hop, then raise the offered load until the engine saturates and the bounded queue pushes back to the edge as busy rejects.

Order in → ack out, open-loop load, seeded
    One order, hop by hop on the ack path, workingwaitingin parallelack out, not yet durable
    End-to-end latency vs offered load (client-measured, from intended send) p50p99p99, other release modeedge rejects

    An open-loop Poisson stream of orders (seed 7, 16,000 orders per load point, the first 2,500 discarded as warmup). Each stage is a queue with the guide's shape and illustrative magnitudes: kernel TCP each way ≈ 5–6 µs; 4 gateway threads at ≈ 1.2 µs per order (decode, session, throttle, stateless risk); a bounded inbound queue of 64 (Little's law: 2M/s × 32 µs) that answers busy at the edge when full; one engine thread at ≈ 0.5 µs per order (sequence, stateful risk, journal append, replicate, match; 0.4% are 8 µs sweeps), so it saturates near 2M orders/s. The journal uses group commit: one fdatasync (≈ 10–15 µs, datacenter NVMe) covers every command appended before it starts. The standby acks the highest contiguous sequence after ≈ 14–20 µs. Matching runs ahead; with gating, the ack and market data wait for released_seq = matched, durable and replicated. Acking after match is faster, but every order in that window is acknowledged to a client and lost if the primary dies. Wakeups, NIC, contention on the writer threads and fsync stalls are not modelled.