HeadlinesBriefing favicon HeadlinesBriefing.com

TigerBeetle Architecture: Static Allocation & Zero-Copy I/O

Hacker News •
×

TigerBeetle, a specialized financial ledger database written in Zig, challenges conventional database design by prioritizing extreme mechanical sympathy, static resource allocation, and custom zero-copy interfaces. By rejecting dynamic memory allocation at runtime, bypassing the kernel cache via direct I/O, and leveraging a single-threaded execution loop backed by Viewstamped Replication (VSR), TigerBeetle achieves throughput rates exceeding hundreds of thousands of transactions per second with predictable, sub-millisecond tail latencies.

TigerBeetle addresses memory unpredictability by completely eliminating dynamic memory allocation after initialization. When the process starts, it calculates and allocates all memory needed for its lifetime—network buffers, storage cache, transaction logs, and consensus state machines. This static approach ensures zero memory fragmentation, deterministic tail latency, and hardware-level predictability through precise cache-line alignment. The trade-off is rigidity: fixed buffer sizes require defining maximum concurrency and cache limits at startup, applying backpressure rather than scaling dynamically.

Even with static allocation, standard I/O stacks bottleneck performance. TigerBeetle implements a custom zero-copy I/O path combining O_DIRECT with Linux's io_uring. Data moves from NIC to user-space buffers, then directly to NVMe via DMA, bypassing the OS page cache entirely. Core entities—Accounts and Transfers—are structured as fixed-size, 128-byte structs aligned to CPU cache lines and disk sectors, enabling identical memory and on-disk representations without serialization overhead.