During server acceptance testing, one may encounter scenarios where—despite moderate CPU utilization and consistent disk test parameters—application latency fluctuates significantly, or the actual throughput of a multi-socket server falls far below theoretical expectations. When such issues recur, the troubleshooting focus should shift from "potential hardware failure" to "resource path alignment." A common culprit is a "NUMA mismatch"—a situation where a process runs on one NUMA node while its memory is allocated on a remote node, forcing every memory access to cross node boundaries. Empirical data from openGauss running on the Kunpeng platform showed that, under default configurations, the system achieved only 60% of the TPS observed in an x86 environment, with P99 write latency 50% higher; the root cause was that the process and its memory were not bound to the same NUMA node. After binding the main process to the local NUMA node, the TPS increased from 5,200 to approximately 6,800.
Acceptance testing serves as the final checkpoint for identifying and quantifying NUMA mismatches. The following methodology progresses from static to dynamic analysis, and from benchmarking to actual application workloads, with actionable commands and evaluation criteria provided for each step.
Step 1: Verify Topology and Establish a Reference Frame for "Alignment"
Identifying a NUMA mismatch requires a clear topological baseline. Without a precise understanding of the number of nodes, the CPU cores assigned to each node, and the inter-node distances, any subsequent observations will lack context and explanatory power.
Running `lscpu | grep -i numa` provides a quick overview of the number of nodes and the distribution of CPU cores. On a 4-node server, for instance, the output might indicate that Node 0 corresponds to CPUs 0–63, Node 1 to CPUs 64–127, and so on. This step is crucial: if a process has CPU affinity for cores on Node 3, yet a significant portion of its memory is allocated on Node 0, the mismatch is already evident at the topological level.
For a more comprehensive view of the topology, use `numactl -H`. The distance matrix provided in the output serves as the quantitative basis for distinguishing between "local" and "remote" resources. In a typical dual-socket system, the distance matrix shows a value of 10 for local node access, while access to a remote node may incur a cost of 12, 20, or even higher. A larger distance value implies a higher penalty for cross-node memory access. This matrix should be recorded as a baseline during acceptance testing; it can later be used to evaluate the potential costs associated with any observed "misalignment" (suboptimal NUMA placement).
Step 2: Use `numastat` to capture direct evidence of "misalignment."
While the system topology merely indicates the *possibility* of cross-node access, `numastat` provides real-time statistics on whether such "misalignment" is actually occurring. This is the primary diagnostic tool to use during acceptance testing.
Running `numastat` without any arguments produces a set of counters organized by node. An abnormal increase in two specific metrics serves as a direct indicator of NUMA misalignment: `numa_miss` (indicating that memory was allocated on the current node, even though the process intended for it to reside on a different node) and `other_node` (indicating that memory was allocated on a node other than the one where the process is running). Elevated values for these metrics suggest that the process’s memory access patterns are systematically deviating from the local node.
As a quantitative benchmark for acceptance testing, the local memory hit rate (the proportion of `local_node` accesses) should ideally be between 90% and 95%, with `numa_miss` accounting for less than 10%. In more stringent scenarios, the local proportion should exceed 95%, while `numa_foreign` should remain below 5%. Data from `numastat` should be collected during the steady state of a load test—not immediately after process startup, when memory allocation may not yet be fully established.
For specific application processes, use `numastat -p <PID>` to examine how their memory is distributed across different nodes. For latency-sensitive processes—such as databases or middleware—the vast majority of the heap memory should reside on the same node where the process is executing. If a process’s memory appears to be distributed roughly equally across two nodes—despite the process not being configured to use an interleaved allocation policy—this is a clear sign of misalignment. Step 3: Verify Bandwidth "Alignment" Using the STREAM Benchmark
While `numastat` provides statistical insights into allocation behavior, it does not directly answer the question: "What level of performance should be expected if the alignment is correct?" The STREAM benchmark provides absolute memory bandwidth values; however, in a NUMA environment, it must be correctly bound to specific nodes to yield meaningful results.
A frequently overlooked fact is that the STREAM benchmark itself is not "NUMA-aware." Running an unbound instance of STREAM on a dual-socket NUMA system often results in cross-node memory access, which can reduce average bandwidth by approximately 20% to 25%. More critically, this significantly increases the coefficient of variation in the results, rendering the data unreliable. Consequently, running STREAM with default settings during acceptance testing fails to reflect the true bandwidth of a single node and cannot be used to determine whether a "misalignment" exists.
The correct approach is to test each node individually by pinning the STREAM process to it. Use `numactl --cpunodebind=N --membind=N` to constrain both the CPU and memory of the test process to node N, then execute the STREAM benchmark. Record the bandwidth for each node. If the bandwidth on a particular node is significantly lower than that of others—or falls well below the platform's theoretical performance expectations—it suggests an anomaly in the resource path for that node. Conversely, if the bandwidth is significantly higher when pinned compared to an unbound state, it serves as evidence of the severity of the misalignment in the default (unbound) configuration. The acceptance criterion should be that the STREAM bandwidth, when pinned to a single node, reaches a reasonable percentage of the publicly stated baseline or the vendor-guaranteed performance figures for that specific hardware model.
Step 4: Final Confirmation of "Misalignment" via Workload Stress Testing
The first three steps provide evidence at the component level; however, the final determination for acceptance testing must be based on actual application workloads. A pragmatic approach is to conduct comparative stress tests—comparing performance before and after pinning the processes.
For instance, when testing a database or middleware process, first run a standard stress test (such as Sysbench OLTP) using the default system scheduler, and record the TPS (transactions per second) and P99 latency. Then, use `numactl --cpunodebind=N --membind=N` to pin the process to a single node and repeat the stress test under identical load conditions. If CPU pinning leads to a significant increase in TPS and a notable drop in P99 latency—while `numastat` shows the local hit rate recovering from below 90% to over 95%—then the existence and impact of "misalignment" are confirmed at the application level. In a case study involving Kunpeng-based openGauss, CPU pinning alone yielded a ~30% boost in TPS; with the subsequent addition of large-page memory and parameter tuning, the final TPS reached nearly double that of the default configuration.
During acceptance testing, tools like `perf` can be used to monitor hardware counters related to cache misses and cross-NUMA memory access. When the proportion of cross-node memory accesses rises abnormally, the `perf` data often corroborates the increase in `numa_miss` values reported by `numastat`, establishing a complete chain of evidence.
Foundational Determinism: Acceptance testing requires a "controllable" underlying platform.
The effectiveness of the aforementioned detection methods relies on one key premise: the observed misalignment must be genuine, rather than "noise" introduced by underlying virtualization or resource contention. If a cloud server is subject to aggressive CPU oversubscription or employs a "memory ballooning" mechanism, the actual execution node and memory allocation strategy may be disrupted by the host machine’s opaque scheduling. In such cases, `numastat` readings become impossible to interpret—you cannot distinguish whether a "misalignment" stems from the application’s own pinning configuration or is merely a byproduct of resource contention on the host.
Detecting NUMA misalignment during acceptance testing involves three core steps: establishing a topology baseline using `numactl -H`, identifying anomalies in `numa_miss` and `other_node` metrics via `numastat`, and quantifying the actual cost of misalignment through re-testing (using both the STREAM benchmark and application-level stress tests) after applying CPU pinning. By running this process on a stable, non-oversubscribed platform—such as one provided by Jtti—every data point captured points to a real, underlying issue rather than a mere artifact of virtualization noise.
EN
CN