v0.1.4 — Latest

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.swappiness

    Memory swap aggressiveness (should be 0 for latency workloads)

  • Transparent Hugepages

    THP compaction daemon causes 50ms+ stalls

  • Scheduler Granularity

    CFS timeslice affects context switch frequency

CPU

  • CPU Governor

    powersave vs performance mode: 200µs P-state penalty

  • C-States

    Deep sleep states (C6) have 100-500µs wake-up latency

  • isolcpus

    CPU isolation prevents scheduler interference

  • NUMA Binding

    Cross-socket memory access adds 30-100ns

Network

  • NIC Offloads

    GRO/LRO/TSO batch packets (adds latency by design)

  • Ring Buffers

    RX/TX queue sizes affect burst handling

  • IRQ Affinity

    Pin NIC interrupts to dedicated cores

Clock

  • TSC Reliability

    Timestamp counter must be invariant and reliable

  • Clocksource

    TSC 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

Python 3.10+

Cross-platform

MyPy Strict

Full type safety

42 Tests

Mocked filesystems

Rich CLI

Beautiful output

Roadmap

1 --fix mode with guided remediation
2 Benchmark mode to measure actual latency impact
3 Ansible playbook generation
4 Prometheus / Grafana integration

Ready to audit your infrastructure?

One command. 30+ checks. Know your score in 30 seconds.

$ pip install latency-audit && latency-audit