If latency budgets leave no room for synchronous retries, never wait for TCP retransmissions on the live market data path; consume dual A/B UDP multicast lines through kernel-bypass NICs and arbitrate on sequence_number.
TL;DR30-second simplified summary▾
Deterministic feed handlers pair kernel-bypass DMA rings with sequence-number A/B arbitration.
Rare dual-line drops trigger out-of-band TCP replay while fixed-offset ITCH decoders push 64B ticks into lock-free SPSC rings.
Why Exchanges Use Dual UDP Multicast.
Why this matters: Understand why TCP head-of-line blocking is unacceptable for market data.
Exchanges fan out ticks to thousands of firms simultaneously.
Unicast TCP would multiply exchange egress by N and stall slow readers during retransmissions.
Dual UDP Multicast A/B Line Arbitration
1.First-Arrival Wins: Whichever line delivers seq_num N first is processed immediately; the slower twin is dropped.
2.Zero HoL Blocking: UDP multicast delivers every tick without TCP ACK stalls.
Dual-line UDP arbitration combines O(1) multicast fan-out with sub-microsecond failover.
Kernel-Bypass Networking (DPDK & Solarflare).
Why this matters: Eliminate Linux kernel interrupt, context-switch, and sk_buff copy overhead.
Think of Kernel-Bypass Networking (DPDK & Solarflare) as the intuition layer for Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction: Eliminate Linux kernel interrupt, context-switch, and sk_buff copy overhead.
Standard Linux sockets incur ~10–15 microseconds per packet due to hardware interrupts, kernel-to-userspace copies, and scheduler wakeups. Kernel-bypass (Solarflare OpenOnload/ef_vi or DPDK) maps NIC RX ring buffers directly into pinned userspace hugepages polled by a dedicated CPU core.
Kernel-Bypass DMA Ring vs Standard Kernel Stack
1.Zero Allocations: Pre-allocated hugepage pools prevent malloc/GC pauses on the hot path.
2.Core Pinning: Pinning polling threads to isolated cores eliminates OS context switches.
Kernel-bypass DMA rings cut packet ingress latency from ~15us down to <1us.
- Problem
- How to implement Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- If latency budgets leave no room for synchronous retries, never wait for TCP retransmissions on the live market data path; consume dual A/B UDP multicast lines through kernel-bypass NICs and arbitrate on sequence_number.
- Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Sequence Gap Detection & TCP Replay Recovery.
Why this matters: Recover lost packets without stalling live market data processing.
Think of Sequence Gap Detection & TCP Replay Recovery as the intuition layer for Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction: Recover lost packets without stalling live market data processing.
If both Feed A and Feed B drop sequence #1042, the Arbitrator buffers packets #1043–#1048 in a bounded reorder ring and fires an async TCP Replay request to the exchange recovery server. Once #1042 arrives (or a 5ms recovery timeout expires), the ring drains in order.
Bounded Reorder Ring & Out-of-Band TCP Replay
1.Micro-Jitter Tolerance: Wait 50us before requesting TCP replay in case Feed B delivers #1042 slightly late.
2.Snapshot Fallback: Massive bursts exceeding 1,024 packets trigger a clean L2/L3 snapshot reload.
A 50us jitter wait plus bounded TCP replay recovers rare dual-line drops cleanly.
Zero-Copy Binary Decoding (ITCH / SBE).
Why this matters: Parse fixed-width binary exchange protocols in nanoseconds.
Think of Zero-Copy Binary Decoding (ITCH / SBE) as the intuition layer for Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction: Parse fixed-width binary exchange protocols in nanoseconds.
Exchanges avoid text JSON/XML on fast feeds, using fixed-offset binary protocols like NASDAQ ITCH 5.0 or CME SBE (Simple Binary Encoding). By mapping wire structs directly in little-endian/big-endian C++ or Rust, fields like price, qty, and side are read via pointer offsets with zero heap allocation.
Fixed-Offset ITCH / SBE Binary Cast
1.Integer Fixed-Point: Prices travel as scaled integers (1e-4) to avoid floating-point rounding drift.
2.64B Cache Alignment: Packing normalized ticks into 64 bytes prevents CPU cache-line splits.
Fixed-offset binary casting parses market messages in tens of nanoseconds with zero allocations.
Lock-Free SPSC Ring Buffer & Cache Padding.
Why this matters: Pass decoded ticks between the feed handler and strategy engine without mutexes.
Think of Lock-Free SPSC Ring Buffer & Cache Padding as the intuition layer for Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction: Pass decoded ticks between the feed handler and strategy engine without mutexes.
Mutexes trigger OS context switches (~5us). A Single-Producer Single-Consumer (SPSC) lock-free ring buffer uses atomic acquire/release memory barriers on head and tail indices, padded to separate 64-byte CPU cache lines to prevent false sharing.
Cache-Padded SPSC Ring Buffer
1.False-Sharing Guard: Separating head and tail by 64 bytes stops L1/L2 cache-coherency ping-pong.
2.Bitwise Masking: Power-of-2 capacity replaces slow integer modulo (%) with fast bitwise AND (&).
Cache-padded SPSC ring buffers transfer ticks between threads in ~20 nanoseconds.
L2/L3 Order Book Reconstruction Data Structures.
Why this matters: Maintain real-time Bid/Ask depth with O(1) order cancel and modify.
L3 order books track every individual resting order ID.
Cancels and executions dominate exchange traffic (>85% of messages).
O(1) Hash Map + Price-Level Linked List
1.85%+ Cancels: Optimizing order_id lookup for O(1) cancels is the #1 book performance lever.
2.Contiguous BBO: Keeping the top 10 price levels in flat arrays maximizes CPU cache hits.
A flat order_id map linked to price-level lists handles >85% cancel traffic in O(1) time.
PTP Nanosecond Clock Sync & Cross-Feed Skew.
Why this matters: Order events accurately across multiple exchanges using IEEE 1588 PTP.
Think of PTP Nanosecond Clock Sync & Cross-Feed Skew as the intuition layer for Multicast Market Data Feed A/B Arbitration & Order Book Reconstruction: Order events accurately across multiple exchanges using IEEE 1588 PTP.
NTP drifts by milliseconds, making cross-exchange arbitrage timestamps meaningless. IEEE 1588 Precision Time Protocol (PTP) with hardware NIC timestamping synchronizes server clocks to grandmaster GPS/atomic clocks within <100 nanoseconds.
IEEE 1588 PTP Hardware Timestamping
1.Hardware Stamping: Stamping packets at the NIC PHY avoids OS scheduling jitter.
2.Regulatory Mandate: MiFID II and FINRA CAT require synchronized microsecond/nanosecond timestamps.
PTP hardware timestamping keeps multi-exchange tick logs accurate within 100 nanoseconds.
Practice: Make the trade-off yourself.
Why do financial exchanges broadcast live market data over dual UDP multicast lines instead of TCP?