HFT-grade Linux infrastructure validator.
Project description
โก latency-audit
The HFT Validator. A ruthless CLI tool that audits Linux infrastructure against Tier 1 High-Frequency Trading standards.
๐จ The Problem
Default Linux kernels are tuned for throughput (web servers), not latency (trading).
A single misconfigured setting can cost you:
| Misconfiguration | Latency Penalty |
|---|---|
swappiness > 0 |
+100ยตs (page fault) |
transparent_hugepages=always |
+50ยตs (compaction stalls) |
| GRO/LRO enabled | +30ยตs per packet |
| Wrong CPU governor | +200ยตs (frequency scaling) |
| C-States enabled | +500ยตs (wake-up latency) |
In HFT, 1 microsecond = $1M/year. These defaults are silent killers.
๐ What It Checks
Kernel
- Swappiness (should be 0)
- Transparent Hugepages (should be
never) - Kernel preemption model
CPU
- Frequency Governor (should be
performance) - C-States (should be disabled)
- Core Isolation (
isolcpusconfiguration) - NUMA topology awareness
Network
- NIC Offloads (GRO/LRO/TSO should be OFF for latency-critical paths)
- IRQ affinity
- Ring buffer sizes
Clock
- TSC reliability (
constant_tsc,nonstop_tsc) - Clocksource configuration
๐ฆ Installation
pip install latency-audit
Or install from source for the latest:
pip install git+https://github.com/nikhilpadala/latency-audit.git
โก Usage
Quick Audit (Read-Only)
latency-audit
Example output:
โก latency-audit v0.1.0
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ KERNEL CONFIGURATION โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
swappiness = 0
โ transparent_hugepages = always (should be: never)
โ
kernel.sched_min_granularity_ns = 100000
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CPU CONFIGURATION โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
governor = performance (all cores)
โ C-States enabled (max_cstate = 9, should be: 0)
JSON Output (for CI/CD)
latency-audit --json
{
"score": 72,
"checks": [
{"name": "swappiness", "status": "pass", "value": 0},
{"name": "thp", "status": "fail", "value": "always", "expected": "never"}
]
}
Check Specific Categories
latency-audit --category kernel
latency-audit --category cpu
latency-audit --category network
๐ Security
This tool is read-only by design. It:
- โ
Reads
/procand/sysfilesystem - โ
Reads
sysctlvalues - โ
Inspects NIC settings via
ethtool - โ Never modifies any settings
- โ Never requires root (though some checks are more complete with it)
๐ค Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
# Clone and install dev dependencies
git clone https://github.com/nikhilpadala/latency-audit.git
cd latency-audit
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
# Run tests
pytest
๐ Roadmap
-
--fixmode with guided remediation - Benchmark mode (measure actual latency)
- Docker container for isolated testing
- Ansible playbook generation
- Integration with Prometheus/Grafana
๐ License
MIT ยฉ Nikhil Padala
Built with obsessive attention to microseconds.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file latency_audit-0.1.0.tar.gz.
File metadata
- Download URL: latency_audit-0.1.0.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19169a0238bcc9bb8d4e7b9e73848ee9a64248bc90e4c6a34a62d03f1211dcb7
|
|
| MD5 |
da6b1c57a439bc33bef041302a15470b
|
|
| BLAKE2b-256 |
b56b5b03366026aacf8c0228ba967278682bdfe8d1122bc2e266a0f1b4937de6
|
Provenance
The following attestation bundles were made for latency_audit-0.1.0.tar.gz:
Publisher:
publish.yml on padalan/latency-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latency_audit-0.1.0.tar.gz -
Subject digest:
19169a0238bcc9bb8d4e7b9e73848ee9a64248bc90e4c6a34a62d03f1211dcb7 - Sigstore transparency entry: 763354923
- Sigstore integration time:
-
Permalink:
padalan/latency-audit@4e37f8eacca6bf233be94db49df0854ecb995599 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/padalan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e37f8eacca6bf233be94db49df0854ecb995599 -
Trigger Event:
release
-
Statement type:
File details
Details for the file latency_audit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: latency_audit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08bf1c80f167cb8ab38cb8250ddae315b95fb1e01af05e006ac174ce518b0d15
|
|
| MD5 |
d51c84d6af32b1b7915b0daa039560de
|
|
| BLAKE2b-256 |
c7f5d4ff8df276bf04e698aea2301e6f1f21cc78f24cd0a7795b7ad3d0b31ed3
|
Provenance
The following attestation bundles were made for latency_audit-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on padalan/latency-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latency_audit-0.1.0-py3-none-any.whl -
Subject digest:
08bf1c80f167cb8ab38cb8250ddae315b95fb1e01af05e006ac174ce518b0d15 - Sigstore transparency entry: 763354925
- Sigstore integration time:
-
Permalink:
padalan/latency-audit@4e37f8eacca6bf233be94db49df0854ecb995599 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/padalan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e37f8eacca6bf233be94db49df0854ecb995599 -
Trigger Event:
release
-
Statement type: