How Do I Design High-Frequency Trading Systems and Its Architecture. Part III (2026 Update)

How Do I Design High-Frequency Trading Systems and Its Architecture. Part III (2026 Update) - 2026 05 19 hft architecture guide 2026 part i hero v4
How Do I Design High-Frequency Trading Systems and Its Architecture. Part III (2026 Update) - cc394c08a87eda9cbd2bb5d52a72f8ed4f6b4449e2e293f9d15c0d26ccff2c0c?s=96&d=mm&r=g

Ariel Silahian

Ariel Silahian is a senior technology executive in institutional electronic trading, with 30+ years across the buy and sell side (New York, Miami, London, Hong Kong). He is the author of "C++ High Performance for Financial Systems" (Packt) and the creator of VisualHFT, the open-source microstructure analytics stack. He writes on exchange architecture, market microstructure, and execution quality, and advises a select number of trading firms on infrastructure decisions that move P&L. Book a strategy call at hftAdvisory.com

About this update. This article was first published in 2017 — the original Part III (2017) is still online for reference. The core pattern — busy/wait spinning, thread affinity, risk controls, monitoring — holds in 2026. What has shifted is the naming (kernel-bypass, cgroups v2), the risk-control enumeration (six rules has grown to nine), and the monitoring bar (percentile histograms, not point alerts). The original structure and voice are intact; inline notes flag what is new.

This is the last part of 3 series of articles I’ve been writing. In this part, I’m going to explain what I’ve found as the best approach to ultra-low latency systems.

Even though I’ve been focused on trading systems, this can be applied to any low-latency systems: communication, audio, video, etc

So, the pattern I use is the following:

Busy/Wait or spinning: this is not categorized as a pattern, actually, it is considered the “anti-pattern” and usually is not recommended. But, when you are designing low latency systems, we don’t care how nice it is or if it follows the good practices. We only care about latency.

The process will be in a tight loop waiting for something, and that loop will consume 100% of CPU cycles. In our case, we are going to be reading market data, from our limit order book module, and if we meet certain strategy criteria, we will send specific orders to execute that trade. This is by far, the fastest way to get the data available from other modules.

Thank you for reading this post, don't forget to subscribe!

Subscribe by Email

But not only that, having this kind of process, we mostly will be avoiding cache misses and CPU’s context switching. Something that I have talked about in my last article.

2026 update — kernel bypass is the production name for this pattern. User-space polling via kernel bypass — DPDK polling-mode drivers, Solarflare/Xilinx Onload — is what the 2017 busy/wait description looks like in a modern production stack. The mechanism is identical: the process spins in user space reading from a shared memory ring, never blocking into the kernel. The 2026 expanded list of what busy/wait avoids includes NUMA locality loss, DDIO misses (on Intel platforms the NIC can DMA writes directly into L3 cache rather than main memory — only if the process and NIC are on the same socket), and IRQ affinity drift (NIC interrupts steering onto the hot spinning core degrades it). The 2017 “cache misses + context switching” framing is correct; it is now the short version of a longer list.

Busy/wait spinning loop: a tight CPU loop reading market data with no thread sleep, no context switch

The following is a basic code snippet on how it works

// Busy/wait spinning loop with C++20 + thread affinity via pthread
// Demonstrates: atomic sequence counter, spinning read, strategy eval,
// and core pinning via pthread_setaffinity_np.

#include <atomic>
#include <cstdint>
#include <pthread.h>
#include <sched.h>

struct MarketUpdate {
    double  bid_price;
    double  ask_price;
    int64_t bid_qty;
    int64_t ask_qty;
    std::atomic<uint64_t> sequence;   // updated by feed handler
};

static MarketUpdate g_book{};         // shared between feed thread and strategy

// Pin the calling thread to a single logical core (e.g., core 3).
// Call this once at thread startup — before the spin loop begins.
inline void pin_to_core(int core_id) noexcept {
    cpu_set_t cpuset;
    CPU_ZERO(&cpuset);
    CPU_SET(core_id, &cpuset);
    pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
}

[[noreturn]] void strategy_spin_loop(int core_id) {
    pin_to_core(core_id);

    uint64_t last_seq = 0;
    while (true) {
        // Acquire-load: cheapest coherency fence; no syscall, no sleep.
        const uint64_t seq = g_book.sequence.load(std::memory_order_acquire);
        if (seq != last_seq) {
            last_seq = seq;
            // Evaluate strategy on the new snapshot.
            if (g_book.bid_price > 0.0 /* strategy condition */) {
                // submit_order(...);
            }
        }
        // No yield, no sleep — 100 % of this core's cycles are ours.
    }
}

But, not everything as good as it seems, busy/wait processes are very hard to design and are too dangerous for the overall performance since it could take the entire CPU power bringing down the entire system’s performance.

Now, the key part to use busy/waits in our systems is set a thread affinity to a specific CPU core. That means, that we will say to our system to run this busy/wait process in only one CPU core (could be core 1, 2, 3, etc). And we will be able to “pin” as many processes as CPU cores we have. If we don’t do this because how the thread schedule works, will use the entire CPU power.

2026 update — cgroups v2 cpuset is now the preferred isolation mechanism. The pthread_setaffinity_np call in the code above pins the thread to a core. The complementary step — removing that core from the OS scheduler’s general pool — has an updated recommendation. isolcpus on the kernel command line still works but cannot be changed at runtime. For production systems, cgroups v2 cpuset controllers are now preferred: they achieve the same OS-scheduler isolation and can be adjusted without a reboot. The 2017 advice (pin threads) is correct; the preferred kernel-side complement in 2026 is cgroups v2 cpuset isolation rather than isolcpus alone.

Using this type of methods, threading model, I/O model and memory management should be designed to collaborate with each other to achieve best overall performance. This goes against the OOP concept of loose coupling, but it’s necessary to avoid runtime cost of dynamic polymorphism.

Of course, you still need to take care of synchronization methods (locks) where is needed. My approach to this is to design my data structures in a way that I will need to have a low amount of synchronization.

Conclusion, this part is the most sensitive thing in our system, and using this technique will give you the best latency.

6. Position & Risk Management

All orders sent by the strategy should be consolidated in positions, so you can keep track of your open/close orders and most important, how your exposure to the market is. Ideally, your strategy should keep a flat exposure, but in certain strategies, like market making, you may allow having controlled exposure (if holding inventory).

From having stop loss per position or for the overall exposure to portfolio management, the risk module it is an important piece that will interact with your strategy and will be monitoring in real-time all open positions and the overall exposure to the market.

The following are some popular risk management rules:

  • Position limit: Control the upper limit of the position of a specified instrument, or the sum of all positions of instruments for a specified product.
  • Single-order limit: Control the upper limit of the volume of single order. Sometimes, control the lower limit of the volume of single order, which means that the quantity of your order must be a multiple of it.
  • Money control: Control the margin of all positions not to exceed the balance of the account.
  • Illegal price detection: Ensure the price is within a reasonable range, such as not exceed price limit, or not too far from the current price.
  • Self-trading detection: Ensure the orders from different strategies will not cause any possibility of trade between them.
  • Order cancellation rate: Calculate the order cancellation situation and ensure it does not exceed the limitation of exchange.

2026 update — three more named controls, and kill switches are now an exchange-side requirement. By 2024 the FIA white paper on Automated Trading Risk Controls had explicitly enumerated three additional named controls beyond the original six: (7) a firm-side kill switch that halts all order submission instantly, (8) a real-time P&L drawdown limit that triggers automated position flattening when a threshold is breached, and (9) an exposure drift / net notional limit that bounds gross notional in flight across all strategies simultaneously. The kill switch in particular is no longer only a best practice — NYSE Pillar and several other venue operators now require documented kill-switch capability as a condition of sponsored access. FINRA’s 2024 Annual Regulatory Oversight Report flagged Market Access Rule (Rule 15c3-5) compliance around automated pre-trade controls as an ongoing examination priority.

Also, within this module, you may want to analyze different allocations on strategies or trades. There have been many studies proving that having an allocation strategy could lead you to lower volatility in your returns and a great insurance if things go wrong.

7. Monitoring systems

Since we are building a fully automated system that must be able to open and close position within milliseconds, we must ensure proper monitoring systems to control the overall operation.

Imagine what would happen if a human realize that some strategy is not doing what it should, or if any venue is not providing prices as it should. When we must stop the system, unrecoverable losses may already be made.

How many minutes will take to this person to shut the system down? 5 minutes? 1 minutes?

We can have more than thousands of wrong open orders within that time frame. Scary!

That’s why we need to put monitoring systems in place, to check some of the following:

  • Overall PnL: if there is, let’s say, a flash crash, out system must be able to close all open position and shut it down itself.
  • Connectivity between venues: making sure that no one has been disconnected, activating reconnection systems in place.
  • Monitoring latencies: let’s say some switch start to fail, and you start to receive data with some delays. You will never realize of that until you start to analyze some logs. We need to monitor latencies between venues, to assure data delivery and alert us in the case of any issue.

2026 update — three-layer circuit breakers and multi-percentile latency histograms. The 2017 article describes firm-side automated shutdown triggered by PnL thresholds. That is still required and still the first layer. The full 2026 picture has two more layers above it. At the exchange level, Limit Up/Limit Down (LULD) bands pause trading in a single security for five minutes if its price stays outside its reference band. At the market level, S&P 500 circuit breakers (7% / 13% / 20% intraday drops) trigger 15-minute halts at Level 1 and 2 and a full-day halt at Level 3 — the L1 trigger fired on April 7, 2025 during the post-tariff announcement session. Your monitoring system needs to be aware of all three layers: your own kill-switch logic should not try to re-enter a market that is in an exchange or market-wide pause. On the latency-monitoring side, the 2017 “alert on latency degradation” framing is now considered first-generation. The 2026 standard is per-stage percentile histograms: p50 / p95 / p99 / p99.9 minimum, measured separately at feed handler, order book update, risk check, and order submission. Averaging percentiles across stages mathematically erases tail signal — each stage needs its own histogram. Sub-microsecond jitter and microburst windows are the observable tells for switch degradation that the 2017 log-analysis approach would catch only after the fact.

2026 update — FIX session resilience. The 2017 “activating reconnection systems” bullet has a more complete specification in 2026: exponential backoff with jitter on reconnect attempts (avoids thundering-herd on exchange recovery), sequence-number persistence across reconnects (ResetOnLogon=N in session config so you do not miss fills during a dropout), and active-active failover between redundant order paths rather than active-passive. Heartbeat monitoring should trigger a trading pause — not just an alert — when a session goes stale.

If you have read these articles, I would like to hear from you, and discuss new or different approaches. Please share !!


This is the 2026 update to the original 2017 article — same structure, same voice, same examples. Inline notes mark what has changed.

Never Miss an Update

Get notified when we publish new analysis on HFT, market microstructure, and electronic trading infrastructure. No spam.

Subscribe by Email

Ariel Silahian is a senior technology executive in institutional electronic trading, with 30+ years across the buy and sell side (New York, Miami, London, Hong Kong). He is the author of "C++ High Performance for Financial Systems" (Packt) and the creator of VisualHFT, the open-source microstructure analytics stack. He writes on exchange architecture, market microstructure, and execution quality, and advises a select number of trading firms on infrastructure decisions that move P&L. Book a strategy call at hftAdvisory.com

Leave a Reply

Your email address will not be published. Required fields are marked *