AI × Quant Trader Series — Day 20¶
What is Low-Latency Networking?¶
Reading time: ~20 minutes
Prerequisites: Shared Memory IPC, Lock-Free Programming, Event-Driven Architecture, Basic Computer Networks
Focus: understanding how modern trading systems minimize network latency
Part 1: Introduction¶
For most software applications, network performance is measured in milliseconds.
For High Frequency Trading, milliseconds are often too slow.
Professional trading systems aim to process market events in:
- Microseconds (μs)
- Sometimes even hundreds of nanoseconds inside the application
At these timescales, the network itself becomes one of the largest sources of latency.
The challenge is no longer simply sending packets.
The challenge is sending them as quickly, consistently, and predictably as possible.
This discipline is known as Low-Latency Networking.
Part 2: Why Network Latency Matters¶
Imagine two trading firms receive the same market update.
Firm A receives the packet:
after it leaves the exchange.
Firm B receives it:
later.
Both firms run the same strategy.
Both generate the same order.
Only one reaches the exchange first.
The difference is not intelligence.
The difference is network latency.
In High Frequency Trading, faster access to market information often creates a competitive advantage.
Part 3: Where Latency Comes From¶
A network packet travels through many layers before reaching an application.
Every step introduces additional delay.
Typical contributors include:
- Physical distance
- Switches and routers
- Network Interface Cards (NICs)
- Kernel networking stack
- Memory copies
- Context switches
- Application processing
Reducing latency means optimizing every stage of this pipeline.
Part 4: Measuring Latency¶
Latency is usually measured in:
- Nanoseconds (ns)
- Microseconds (μs)
- Milliseconds (ms)
For example:
In many HFT systems:
- Internal processing targets are measured in microseconds.
- Individual software optimizations may save only a few hundred nanoseconds.
Small improvements accumulate across the entire trading pipeline.
Part 5: TCP vs UDP¶
Most financial networks rely on two transport protocols.
TCP¶
Advantages:
- Reliable delivery
- Ordered packets
- Automatic retransmission
Disadvantages:
- Higher latency
- More protocol overhead
TCP is commonly used for:
- Order entry
- FIX sessions
- Administrative communication
UDP¶
Advantages:
- Extremely lightweight
- Low latency
- Minimal overhead
Disadvantages:
- No guaranteed delivery
- No retransmission
- Possible packet loss
UDP is widely used for:
- Market data feeds
- Multicast distribution
- Broadcast market updates
Many exchanges publish market data using UDP because speed is prioritized over guaranteed delivery.
Part 6: Network Interface Cards (NICs)¶
Not all network cards are equal.
Professional trading firms often deploy specialized low-latency NICs that provide:
- Hardware timestamping
- Kernel bypass support
- Reduced interrupt overhead
- Better packet processing performance
For HFT, the NIC is more than a peripheral.
It becomes an integral part of the trading infrastructure.
Part 7: Kernel Networking¶
Traditional network communication follows this path:
Each packet enters the operating system kernel before reaching the application.
This introduces:
- Context switches
- Buffer copies
- Scheduling delays
Although acceptable for general-purpose applications, these costs become significant in low-latency environments.
Part 8: Network Optimization¶
Professional trading systems apply numerous optimizations, including:
- CPU affinity
- Interrupt pinning
- Busy polling
- Huge Pages
- Receive Side Scaling (RSS)
- NUMA-aware networking
- Hardware timestamping
Each optimization contributes only a small improvement.
Together they significantly reduce end-to-end latency.
Part 9: Market Data Networking¶
Market data presents a unique networking challenge.
Rather than waiting for requests, exchanges continuously push updates.
A busy trading day may involve millions of market data messages per second.
The networking stack must process these messages efficiently while minimizing packet loss.
Part 10: Deterministic Networking¶
Average latency is only part of the story.
Professional trading systems care deeply about:
- Latency consistency
- Packet jitter
- Tail latency
- Predictable delivery
A system averaging 10 μs but occasionally taking 200 μs is often less desirable than one consistently operating at 20 μs.
Predictability is just as important as speed.
Part 11: Where godzilla.dev Fits¶
Modern electronic trading systems require more than fast trading algorithms.
They require an infrastructure capable of moving market data and execution messages through the system with minimal overhead.
The networking layer in godzilla.dev is designed to integrate cleanly with the framework's event-driven architecture and low-latency communication model.
Combined with shared memory, lock-free data structures, and modular exchange gateways, this design enables efficient processing of high-volume market events while maintaining predictable latency characteristics.
The framework focuses on providing a solid networking foundation upon which professional trading systems can be built.
Part 12: Key Takeaways¶
Low-Latency Networking is the discipline of minimizing the time required for information to travel between trading systems and electronic exchanges.
Achieving low latency requires optimization across the entire networking stack, including:
- Network protocols
- Hardware
- Operating systems
- CPU scheduling
- Application architecture
In High Frequency Trading, network latency is often just one part of a much larger end-to-end optimization problem.
Understanding how data moves through the network is essential for building modern electronic trading systems.
What's Next?¶
The next article explores one of the most important techniques for reducing networking overhead:
- What is Kernel Bypass?