Most trading systems are fast enough on a quiet day. The trouble comes when the market gets busy: quote rates jump, and a system that averaged a few microseconds starts to show occasional pauses that are thousands of times longer. Those pauses tend to arrive at the moment you most need the system to respond.
Blitz is the execution core and pre-trade risk layer we wrote from scratch at Forticia. The design goal was not the lowest possible average latency. It was to behave the same way under load as it does when idle. This piece explains how we went about that: no heap allocation on the order path, threads pinned to isolated cores, lock-free single-producer single-consumer (SPSC) ring buffers with cache-line alignment, and a fixed set of risk checks that run before any order leaves the process.
1. Where the Pauses Come From
A lot of execution software is written in Java or C#, often with Python around the edges. There are good reasons for that: those languages are productive and their runtimes are mature. But a managed runtime makes some decisions for you, and a few of them matter when message rates spike:
- Garbage collection: Modern collectors keep pauses short under steady load. During a burst, the allocation rate rises with the message rate, and the collector has more work to do at exactly the wrong time. How bad this gets depends heavily on the runtime, the collector and how carefully the code avoids allocating, but it is a source of tail latency that the application does not fully control.
- Fragmentation and page faults: Repeated allocation and freeing fragments the address space. A thread that asks for memory in the middle of a burst can hit a TLB miss or a page fault and stall while the kernel sorts it out.
- Stale orders: A pause of tens of milliseconds is a long time for a resting order. If the market moves while the process is stalled, it cannot cancel quotes that are now mispriced, and faster participants trade against them.
None of this means a managed runtime cannot be made to work. Plenty of firms do it well. We chose to remove the problem at the source instead of tuning around it.
Table 1: Blitz Latency Under Burst Load (100,000 Orders / Second)
| System | Median (p50) | 99th % (p99) | 99.9th % (p99.9) | Worst Case |
|---|---|---|---|---|
| Blitz Execution Core | 0.72 µs | 1.15 µs | 1.84 µs | 3.12 µs |
Note: These figures come from an internal benchmark on dual AMD EPYC processors, running a Linux kernel with a low-latency configuration and isolated, pinned cores. They measure time spent inside the process and exclude network transit. The method is not published here, so please read them as indicative, not as a reproducible result.
2. No Allocation on the Order Path
The main rule in Blitz is simple: once the process is running, the order path does not allocate or free memory. No malloc, calloc, realloc or free, and no new or delete.
Everything the order path needs is allocated at startup. The daemon maps contiguous arenas backed by Linux 2MB HugePages (hugetlbfs), which reduces TLB misses, and locks the whole address space into physical RAM with mlockall(MCL_CURRENT | MCL_FUTURE) so the kernel cannot swap or evict pages later. The memory is touched up front, so every page is backed by RAM before any strategy connects.
Order state slots, account ledgers and risk parameters all live at fixed offsets inside those arenas. When an order moves through its lifecycle (NEW → RISK_PASSED → ROUTED → FILLED), we flip flags in place in a pre-allocated array. There are no pointers to chase, and the data the hot path touches is laid out so that it tends to stay in the L1 and L2 caches.
3. Lock-Free Ring Buffers and Cache-Line Alignment
Threads have to hand work to each other, and the usual tools for that are mutexes and condition variables. Under contention those can involve the kernel, and a thread that is descheduled while waiting for a lock is another source of unpredictable delay.
Blitz uses a lock-free single-producer single-consumer (SPSC) ring buffer for every hand-off between threads: from the network ingest thread to the risk checks, and from the risk checks to the thread that writes to the broker socket. Buffer capacities are powers of two, so wrapping an index is a bitwise mask instead of a division.
Avoiding False Sharing
On x86-64 and ARM processors, cores keep their caches consistent one 64-byte cache line at a time. If the buffer's head_ and tail_ indices sit on the same line, every write to tail_ by the producer invalidates the consumer's cached copy of head_, and the line bounces back and forth between the two cores. This is false sharing, and it costs time even though the two threads never touch the same variable.
The fix is to pad the two indices onto separate 64-byte boundaries with alignas(64), so the producer and the consumer each write to their own cache line.
4. Pre-Trade Risk Checks
Brokers and counterparties reasonably want to know that a client's system cannot breach its limits or flood a venue with bad orders. Risk checks that run after the trade, or that depend on a database lookup, catch problems late. We wanted the checks to sit directly in the order path.
In Blitz, every order a strategy produces goes through ten checks before any bytes are written to the network socket:
-
Notional position limits: After the trade, gross and net notional across all contracts must stay within the mandate:
$$ |\text{CurrentPosition} + \text{OrderQuantity}| \times \text{MarkPrice} \le \text{MaxGrossNotional} $$(1)
-
Price collar: The limit price is compared with the current top of book. We reject any bid higher than $\text{BestAsk} + \delta$ or ask lower than $\text{BestBid} - \delta$, which catches fat-finger prices:
$$ \text{Price}_{\text{Bid}} \le \text{BestAsk} + \delta \quad \text{and} \quad \text{Price}_{\text{Ask}} \ge \text{BestBid} - \delta $$(2)
- Intraday drawdown limit: Blitz tracks high-water-mark equity through the day. If the intraday loss crosses the hard threshold (for example, -2.50%), it fails closed: open orders are cancelled and new routing is disabled.
- Order rate throttle: Two token-bucket limiters, over 1-second and 60-second windows, keep us inside exchange message-to-trade ratio rules.
- Margin check: Exchange margin requirements are computed across all sub-accounts, and an order is rejected if it would eat into the collateral buffer.
- Self-match prevention: An incoming order is checked against our own resting orders in the internal state table, and anything that would cross is removed before it reaches the exchange.
- Short-sale borrow: Short equity orders are accepted only if the prime broker's locate feed shows shares available to borrow.
- Maximum order size: A hard ceiling on the quantity of any single order, as a guard against a strategy stuck in a loop.
- Session heartbeat: The FIX session with the prime broker is monitored continuously. If heartbeat acknowledgments stop, routing is suspended.
- Fill quality check: Recent fills are compared with what the simulation expected. If child-order fill ratios drift beyond preset margins, orders switch to passive pegging or pause.
How the Checks Are Evaluated
The checks are an inline predicate that runs immediately before dispatch. The parameters they need (notional limits, position ceilings, price bands, rate counters) sit in contiguous, cache-aligned structures in static memory. The checks short-circuit, and there is no dynamic dispatch or function-pointer indirection.
If an order passes, the state machine updates balances in place and hands the packet to the socket ring buffer. If any check fails, the order is rejected on the spot. Neither path allocates memory or blocks, and the whole evaluation runs on a single core.
5. The "250 Microsecond" Broker Claim
Some brokers advertise "sub-250 microsecond execution" for FIX gateways reached over the internet. As an end-to-end figure, that cannot be right, and the arithmetic is short:
-
The speed of light in fiber: Light travels through single-mode optical fiber (silica glass with a refractive index $n \approx 1.468$) at approximately $204,000 \text{ km/s}$ (~$4.9 \text{ µs/km}$). Take a server in central London sending an order to a broker in Slough (LD4), roughly 35 km away in a straight line. The theoretical minimum round trip is:
$$ 2 \times (35 \text{ km} \times 4.9 \text{ µs/km}) \approx 343 \text{ microseconds} $$(3)
- Real routes are longer: Fiber follows railways and roads, not straight lines, and each router, amplifier and firewall along the way adds delay. The real figure is higher than the theoretical minimum, often by a wide margin.
- Longer distances: Between cities the numbers grow accordingly. London to Frankfurt is a matter of milliseconds, and London to New York is tens of milliseconds each way, because a transatlantic cable is several thousand kilometres long.
My reading is that a "250 microsecond" figure describes the time between the broker's own system receiving an order and acknowledging it. That is a legitimate thing to measure, but it leaves out the network between you and them.
We do not claim to beat the network either. Blitz deals with the part we can control: latency variance inside our own process. When the market gets busy, it checks risk and formats packets without allocating memory or waiting on a lock, so its own contribution to the delay stays roughly constant.
6. Telemetry Through PolarisLink
A fast execution path that nobody can observe is its own kind of risk. Blitz streams its telemetry (fills, margin utilization and the outcome of each risk check) through PolarisLink, our messaging protocol, which I describe in a separate piece.
On the Blitz side, telemetry records are fixed-width structs written into pre-allocated buffers, not JSON or XML strings built on the fly. That keeps logging cheap and means it does not break the no-allocation rule. The same stream feeds our risk reporting consoles, so positions and fills can be reviewed as they happen.
7. Conclusion
Blitz takes garbage collection, runtime allocation and lock contention off the order path, and puts the risk checks on it. The result is a system whose behavior under load is predictable. That is all it tries to be, and for an execution layer I think predictability matters more than a low average.