How Exchanges Turn Order Books into Distributed Logs

https://news.ycombinator.com/rss Hits: 7
Summary

1. The Parallel Between Exchanges and Databases Let's think about the scale of exchanges for a moment: thousands of orders hitting the system every millisecond, yet every participant, from HFT firms in New York to pension funds in Singapore, sees the exact same sequence of events. This is distributed systems engineering at its finest, operating under one of the most demanding real-time constraints in computing. High-frequency chaos must be transformed into a single deterministic timeline. How do exchanges guarantee that when trader A's order arrives at 09:30:00.123456789 and trader B's arrives at 09:30:00.123456790, everyone agrees on which came first (even when those orders traverse different network paths, different gateways, different continents)? The answer: order books are distributed logs of market events. This architecture guarantees fairness through deterministic ordering. 2. The Problem: Ordering Chaos Physical reality is messy: orders don't arrive at exchanges in a neat, orderly stream. If they did, this article would be one paragraph long. Instead they pour in from different gateways, different data centers, different continents. Each packet might take a unique path through the internet's topology. A trader in London might route through Frankfurt. A firm in Chicago might have direct fiber. Another might bounce through three ISPs. The core problem: turning concurrent events into a single, globally-agreed sequence. The stakes are very high: price-time priority (the principle that earlier orders at the same price get filled first) requires perfect ordering. Market integrity depends on participants trusting that the game isn't rigged, that the sequence is fair and deterministic. A tempting idea is to simply timestamp orders on arrival. The problem: distributed clocks lie. Even with PTP (Precision Time Protocol), microsecond-level drifts happen. And with NTP (Network Time Protocol), it's orders of magnitude worse. And at a deeper level, there's no global "now"...

First seen: 2025-12-13 12:51

Last seen: 2025-12-13 18:52