Study notes on Linux under latency pressure
Low Latency Is Easy*
*and other lies about Linux in HFT
Kernel, hardware and fleet, from packet to trade
Alexander Sasha Rozenson
A note before you start
This book began as my own study notes. I work with Linux and have spent years near trading systems, and the same questions kept coming back without one place that answered them properly, from the ground up and with sources. Writing each topic out until I could explain it was how I learned it; the book is what that left behind, published because it may save someone else the same search.
Facts come from cited public sources or from labs you can repeat, and the text says which statements are measured, which are models and which are open. I wrote it with the help of AI tools and checked their output against the sources. Corrections and better methods are welcome, and they are how the next edition improves.
Alexander Sasha Rozenson
What the book covers
The question behind every chapter is how to make an ordinary server respond in a predictable time when the budget is measured in microseconds and one slow reply matters more than a good average. The answer is built layer by layer: processors, memory and devices first, then the kernel, the network, clocks, measurement, and finally what changes when there are hundreds of hosts instead of one. Each mechanism is explained before it is tuned, and each explanation ends on a live system, with the commands that show it working.
The technical chapters share a fixed layout, borrowed from Brendan Gregg's Systems Performance: terminology, models, concepts, architecture, methodology, observability, tuning, practice, exercises and references, always in that order. After a chapter or two you can jump straight to the section you need, the tools under "Observability" or the settings and their trade-offs under "Tuning".
Part 6 is different: eight investigations told from the first symptom to the fix. Each is reconstructed from public material, such as kernel commits, mailing-list discussions and vendor errata, or from a lab you can rerun, and each refers back to the chapter where its mechanism is taught.
Who it is written for
The reader I had in mind administers Linux and wants to understand what the machine is doing underneath. That covers the kernel command line and sysctls, interrupts and network cards, firmware settings, clock synchronisation, profilers and packet captures, and the routines that keep many hosts alike and changes under control. Processor design, application code and how markets work all appear, but only as far as you need them to reason about the system and to ask the right questions of the people who specialise in them.
One idea runs through the book. The people who write the trading software are responsible for what their code does; whoever runs the hosts is responsible for how the machine behaves and for proving that each host really is configured as intended. Chapter 27 turns that split into a written agreement.
Some comfort with everyday administration helps: a shell, package management, services, logs, remote access. Kernel internals are not assumed. Each new term is explained in a sentence the first time a chapter uses it.
What the labels on numbers mean
The latency figures describe current x86 servers to within an order of magnitude. A label after each number says how far you can trust it on your own hardware.
| Label | Meaning | What to do with it |
|---|---|---|
| physics | Fixed by nature or by a standard: the speed of light in fibre, the bytes in a frame. | Use it as it is. |
| arch | Depends on the processor or device generation: cache latency, a PCIe round trip. | Expect another value on another generation. |
| product | Depends on the release or the configuration: default sysctls, driver queue sizes, sample output. | Measure it yourself before relying on it. |
Finding your way
The chapters are meant to be read in order, since each part relies on the ones before it. If you need a shorter route, Appendix C suggests paths for someone new to the field, a trading developer, the owner of a fleet, someone preparing for an interview, and a reader with only an afternoon. Keep Appendix E close from the start: knowing that one trip to main memory takes about 100 ns arch, about as long as light needs to travel 20 metres of fibre at roughly 5 ns per metre physics, settles many questions about where time can be going before anyone measures.
Alongside each chapter is a workbook page made from the same text, with self-check questions, short quizzes linked to the sections they cover, and interactive models of the mechanisms that are hardest to picture. The chapter is always the authority; the workbook adds nothing the chapter does not say.
Where the material comes from
Only public material and reproducible labs went into this book: kernel source and documentation, manual pages, vendor documentation and open-source code, standards, regulations and exchange specifications that anyone can download. Every chapter ends with its sources. Nothing comes from any employer. There are no company, host, team, ticket, tool or person names, no internal settings, measurements or incidents, and nothing about any firm's network or its connections to trading venues. Every output in the book carries one of three labels: measured, marked "My results" or "My output", from a lab run on the virtual machine of Appendix M; illustrative, written to be representative of real hardware and not measured; or expected, for a test the text describes but I have not run, which the text says. The case studies of Part 6 are reconstructions around real, public mechanisms, and each says which of its parts were measured. The book is about the craft of running Linux where latency matters, not about how any particular firm practises it.
The cover shows a vector drawing of a pulse of light in an optical fibre, generated with an AI tool from the author's description; the lettering, in Inter, was added afterwards.
Conventions
The kernels described are the ones in production use as this edition is written: 6.1 in Debian 12, 6.12 in Debian 13, and the 6.18 long-term release. Changes from the 7.x series, up to 7.3, are mentioned where they alter what you would see or do, always with their version. Anything that depends on a version, a build option or a product is marked as such. Debian is the reference distribution; Appendix N collects what differs on AlmaLinux, RHEL and Rocky Linux, from the kernel build to tuned.
A $ prompt means an ordinary user can run the command; a # prompt means it needs root. Command blocks include their output, followed by a paragraph on how to read it; the few commands I could not run say so. Output counts as illustrative unless it was captured on the reference lab of Appendix M. That lab is modest: a two-CPU cloud virtual machine with a 6.18 kernel, on which interrupt affinity, boot parameters, idle states and hardware timestamping could not be changed. Its results show mechanisms, not what a tuned trading server achieves.
Two kinds of box appear beside the text. Hidden marks a trap: a setting whose name promises more than it does, a check that passes when it should fail, or a fault that surfaces far from where it starts. Lab marks something to try on your own machine.
Figures are numbered within each chapter, and a figure that shows a model rather than a measurement says so in its caption.
This edition
This working edition is dated December 2026. The text is complete. Each chapter was checked against the kernel source, documentation and references it cites, and the whole book was then reviewed by other AI models working independently of the one that helped write it; the programs compile and the shell commands parse, both checked by script. That checking does not replace running the labs on your own hardware, and nothing here was measured on bare metal. Errors will remain, so treat any figure you depend on as a pointer to its source rather than the final word. The date here will change with each edition. If you find a mistake, a command that fails or a claim without a source, please report it with the section, what you expected and, for a command, what your system printed.
Contents
Part 1Principles
Part 2Hardware
Part 3The Kernel
Part 4Networking and Time
Part 5Measurement and Operations
Part 6Investigations
- 28Real-Time Throttling and the Fair Server
- 29Residual Noise on an Isolated CPU
- 30Receive-Side Packet Drops
- 31Compaction Stalls and Transparent Huge Pages
- 32The OOM Killer under Memory Pressure
- 33A Timestamping Failure after a NIC Reset
- 34Scheduler Changes Across Kernel Releases
- 35Tuning a Server from Factory Defaults
Part 7Beyond the Server
Back matterAppendices
- AThe Path of a Packet
- BCommon Tuning Mistakes
- CSuggested Reading Orders
- DProduction Readiness Checklist
- EReference Latency Figures
- FBoot Parameter Reference
- GTerminology
- HOperational Playbooks
- IAutomated Host Verification
- JInterview Preparation and a Design Exercise
- KLab Index
- LCommand Index
- MThe Reference Lab
- NAlmaLinux and the Red Hat Family