latency-audit
HFT-grade Linux infrastructure validator. One command to audit your kernel, CPU, network, and clock configuration for ultra-low latency.
pip install latency-audit The Problem
The default Linux kernel is optimized for throughput, not latency. Most developers have no idea their infrastructure is misconfigured.
# Your kernel is probably doing this:
vm.swappiness = 60 # 100µs page fault penalty
cpu_governor = powersave # 200µs P-state transitions
transparent_hugepages = always # 50ms compaction stalls
I spent 3 weeks optimizing an algorithm to save 2ms. Then I fixed vm.swappiness and saved 100µs per request.
What You'll See
$ latency-audit
latency-audit v0.1.4
HFT-grade Linux infrastructure validator
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ KERNEL CONFIGURATION ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
[PASS] swappiness = 0
[FAIL] transparent_hugepages = always (should be: never)
[PASS] sched_min_granularity_ns = 100,000
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ CPU CONFIGURATION ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
[PASS] cpu_governor = performance (all cores)
[FAIL] cstates = enabled (should be: disabled)
[WARN] isolcpus = not set
───────────────────────────────────────────────────────────────────
Audit Summary
┌─────────────────────────────────────┬──────────────────────────────┐
│ Score │ 60/100 │
│ Passed │ 6 │
│ Failed │ 4 │
│ Warnings │ 2 │
└─────────────────────────────────────┴──────────────────────────────┘ 30+ Checks Across 6 Categories
Everything that matters for sub-millisecond latency
Kernel
-
vm.swappinessMemory swap aggressiveness (should be 0 for latency workloads)
-
Transparent HugepagesTHP compaction daemon causes 50ms+ stalls
-
Scheduler GranularityCFS timeslice affects context switch frequency
CPU
-
CPU Governorpowersave vs performance mode: 200µs P-state penalty
-
C-StatesDeep sleep states (C6) have 100-500µs wake-up latency
-
isolcpusCPU isolation prevents scheduler interference
-
NUMA BindingCross-socket memory access adds 30-100ns
Network
-
NIC OffloadsGRO/LRO/TSO batch packets (adds latency by design)
-
Ring BuffersRX/TX queue sizes affect burst handling
-
IRQ AffinityPin NIC interrupts to dedicated cores
Clock
-
TSC ReliabilityTimestamp counter must be invariant and reliable
-
ClocksourceTSC vs HPET: TSC is 10x faster to read
CLI Reference
Basic Audit
Run all checks and display results
latency-audit JSON Output
Machine-readable output for CI/CD pipelines
latency-audit --json Category Filter
Run only network-related checks
latency-audit --category network Verbose Mode
Show detailed explanation for each check
latency-audit --verbose Safe for Production
This tool is read-only. It never modifies your system. It only reads from /proc, /sys, and runs ethtool queries. Run it on production servers without fear.
Built for Quality
Cross-platform
Full type safety
Mocked filesystems
Beautiful output
Roadmap
--fix mode with guided remediation Ready to audit your infrastructure?
One command. 30+ checks. Know your score in 30 seconds.
pip install latency-audit && latency-audit