numa architecture

**NUMA (Non-Uniform Memory Access)** — a memory architecture where access time depends on which CPU socket the memory is attached to, critical for multi-socket server performance. **Architecture** ``` [CPU 0] ← local memory (fast: ~80ns) | interconnect (~120-180ns) [CPU 1] ← local memory (fast: ~80ns) ``` - Each CPU socket has its own memory controller and local DRAM - Accessing local memory: ~80ns - Accessing remote memory (other socket): ~120-180ns (1.5-2x slower) **Impact on Software** - NUMA-unaware programs can suffer 30-50% performance loss - OS tries to allocate memory on the socket where the thread runs - Thread migration between sockets → sudden performance drop (all memory accesses become remote) **NUMA-Aware Programming** - Pin threads to specific cores/sockets (`numactl`, `taskset`) - Allocate memory on the local node (`numa_alloc_onnode()`) - First-touch policy: Memory is allocated on the node where it's first accessed - Partition data so each thread works on locally-allocated data **Checking NUMA Topology** - `numactl --hardware` — show nodes, CPUs, and memory - `numastat` — show memory allocation per node **NUMA** matters significantly for databases (MySQL, PostgreSQL), HPC applications, and any memory-intensive workload on multi-socket systems.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account