Skip to content

Introduction

ZigBolt is an ultra-low-latency, lock-free messaging system written in pure Zig for high-frequency trading systems. Zero GC pauses, zero JVM safepoints, zero runtime overhead.

Traditional HFT messaging systems are either:

  • Java-based (Aeron, LMAX Disruptor, Chronicle Queue) — subject to GC pauses, JVM safepoints, and large runtime overhead
  • C/C++-based (ZeroMQ, nanomsg) — complex build systems, memory safety issues, undefined behavior risks

ZigBolt combines the best of both worlds:

  • Zero overhead like C — no GC, no runtime, direct hardware access
  • Safety — comptime validation, no undefined behavior, clear error handling
  • Simplicity — single file per module, no build system complexity, cross-compilation built in
  • Performance — sub-200ns IPC, 100M+ msg/sec codec throughput

ZigBolt is organized into seven layers, each depending only on layers below it:

+================================================================+
| Application Layer |
| Transport, Publisher(T), Subscriber(T), AgentRunner |
+================================================================+
| Channel Layer |
| IpcChannel (shm) UdpChannel NetworkChannel (reliable) |
| CongestionControl FlowControl(Min/Max/Tagged) |
+================================================================+
| Protocol Layer |
| Reliability (NAK) Fragmenter/Reassembler NakController |
| DataHeaderFlyweight StatusMessageFlyweight NakFlyweight |
+================================================================+
| Codec Layer |
| WireCodec(T) SbeEncoder/SbeDecoder FIX Messages |
+================================================================+
| Core Layer |
| SpscRingBuffer MpscRingBuffer LogBuffer Sequencer |
| BroadcastBuffer (1-to-N) CounterSet GlobalCounters |
+================================================================+
| Cluster / Archive Layer |
| RaftNode Cluster WriteAheadLog SnapshotManager |
| Archive Catalog SparseIndex Compressor/Decompressor |
+================================================================+
| Platform Layer |
| config.zig (cache lines, timestamps) memory.zig (shm/mmap) |
+================================================================+
ModuleFileDescription
SpscRingBuffersrc/core/spsc.zigLock-free single-producer single-consumer ring buffer
MpscRingBuffersrc/core/mpsc.zigMulti-producer single-consumer with CAS
LogBuffersrc/core/log_buffer.zigAeron-style term rotation buffer
WireCodecsrc/codec/wire.zigComptime zero-copy codec for packed structs
SbeEncoder/Decodersrc/codec/sbe.zigSBE wire format engine
FIX Messagessrc/codec/fix_messages.zigFIX/SBE market data messages
IpcChannelsrc/channel/ipc.zigShared-memory IPC channel
UdpChannelsrc/channel/udp.zigUDP unicast/multicast
NetworkChannelsrc/channel/network.zigReliable ordered UDP
BroadcastBuffersrc/core/broadcast.zig1-to-N fan-out for market data
Archivesrc/archive/archive.zigSegment-based message recording/replay
RaftNodesrc/cluster/raft.zigRaft consensus: election, replication
Sequencersrc/sequencer/sequencer.zigTotal-order sequence assignment
FFIsrc/ffi/exports.zigC-ABI exports for cross-language use