Databases 7 min read

Understanding NUMA and Its Impact on MySQL Performance

This article explains NUMA architecture, how its memory allocation policies can cause swap‑related performance issues for MySQL, provides step‑by‑step methods to disable NUMA at BIOS, kernel or MySQL levels, and discusses the innodb_numa_interleave parameter and best‑practice recommendations.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Understanding NUMA and Its Impact on MySQL Performance

Background – The discussion originated from a client’s doubt about disabling the NUMA setting when preparing a server for MySQL deployment, prompting an investigation into NUMA.

NUMA Overview – NUMA (Non‑Uniform Memory Access) partitions hardware resources into nodes, each with its own CPU and memory; memory access is fastest within the local node and slower across nodes.

NUMA and MySQL Analysis

Default: memory always allocated on the local node.

Bind: forces allocation to a specified node.

Interleave: distributes memory across all or selected nodes.

Preferred: tries a specified node first, then others.

Because MySQL is a single‑process, multi‑threaded system, it can only use memory from the node where its process runs. In NUMA‑enabled servers, this can lead to “swap insanity” where a MySQL instance exhausts its node’s memory, causing swapping even though other nodes have free memory.

Example: a 40 GB MySQL server with the process bound to a node that only has 20 GB local memory will swap the excess 10 GB to disk, degrading performance.

How to Disable NUMA

1. Hardware level : Turn off NUMA in the BIOS.

2. OS kernel level : Add numa=off to the Linux kernel boot parameters and reboot.

For RHEL 6 edit # vi /boot/grub/grub.conf and add kernel /vmlinuz-2.6.39-400.215.10.EL ro root=/dev/VolGroup00/LogVol00 numa=off .

For RHEL 7 edit # vi /etc/default/grub and set GRUB_CMDLINE_LINUX="... numa=off" , then rebuild the GRUB config with # grub2-mkconfig -o /etc/grub2.cfg .

3. Database level : Start MySQL with # numactl --interleave=all ./bin/mysqld_safe --defaults-file=/etc/my.cnf & to force interleaved memory allocation.

innodb_numa_interleave Parameter – Introduced in MySQL 5.6.27/5.7.9, this parameter makes MySQL set its NUMA policy to interleaved automatically, provided the server supports NUMA and MySQL is compiled with WITH_NUMA . Note that the binary packages before MySQL 5.7.17 do not support this option.

Testing results:

If the system lacks NUMA support, compiling with -DWITH_NUMA=ON fails.

MySQL 5.7.19+ binary packages include support for innodb_numa_interleave .

Recommendations

• For dedicated MySQL servers, disable NUMA via BIOS or kernel settings.

• If other workloads need NUMA, keep it enabled and use a MySQL version that supports innodb_numa_interleave .

Common Misconception: Not finding the numactl command means NUMA is disabled. In fact, numactl is an optional Linux utility for inspecting and tuning NUMA; its absence does not indicate that NUMA is off.

References

"The MySQL “swap insanity” problem and the effects of the NUMA architecture" – https://blog.jcole.us/2010/09/28/mysql-swap-insanity-and-the-numa-architect "A brief update on NUMA and MySQL" – https://blog.jcole.us/2012/04/16/a-brief-update-on-numa-and-mysql/ Linux NUMA documentation – https://www.kernel.org/doc/html/v4.18/vm/numa.html Additional guides – https://www.thegeekdiary.com/how-to-disable-numa-in-centos-rhel-67/ and others.
performanceDatabaseLinuxMySQLNUMAinnodb_numa_interleave
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.