Features
Eight crates, one locality model.
numaperf is a focused set of NUMA primitives, grouped by what you’re trying to do: discover the machine, place memory, pin threads, schedule work where its data lives, and observe the result. Use the facade for everything or pull in only the crates you need.
Know the machine before you place a single byte.
Topology discovery
Query NUMA nodes, CPUs, and inter-node distances at runtime with Topology::discover(). Stop assuming a fixed layout — read the real one and branch on it.
Device locality
Map NICs and NVMe devices to their NUMA nodes, then allocate device buffers on the device-local node. Skip the cross-node copy that packet- and storage-heavy paths pay by default.
Decide where memory lives, and make the decision stick.
Memory placement policies
Explicit MemPolicy: Bind, Preferred, Interleave, Local. You choose the policy instead of inheriting the kernel’s first-touch heuristic.
Prefaulting
Pair a policy with Prefault::Touch so pages are faulted in and placed at allocation time — before the hot path runs and before placement can drift.
Constrain where work runs, without leaking affinity across scopes.
RAII thread pinning
ScopedPin is a RAII handle that pins the current thread to a node’s CPUs and restores the previous affinity on drop. No affinity leaks across worker-pool transitions or refactors.
Run work where its data already is.
Per-node work scheduling
NumaExecutor runs per-node worker pools with node-scoped work stealing only. Schedule queries on data-local workers instead of whatever core happened to be free.
Sharded data structures
NumaSharded<T> gives you per-node data; ShardedCounter is lock-free counting that does not bounce a cache line across the box under contention.
Measure locality in numbers you can put on a dashboard.
Locality observability
Track locality ratios, generate health reports, and identify cross-node traffic. Find the placement leak before it shows up as a wandering p99.
Hard mode vs graceful
Strict enforcement when you need guarantees; graceful degradation when the hardware (or macOS) has no NUMA to enforce against. The default is your choice, not the OS’s.
See it end to end
The quickstart wires these together in five steps; the architecture page explains how the pieces compose.