If you are managing your cluster with MemSQL Ops, go here instead.
When running MemSQL on machines with multiple Non-Uniform Memory Access (NUMA) nodes, you should configure MemSQL for NUMA with numactl
for optimal performance. If you do not configure MemSQL this way, performance will be greatly degraded due to expensive cross-NUMA-node memory access. Configuring for NUMA should be done as part of the installation process; however, you can reconfigure your deployment later, if necessary.
To simplify the configuration process, the MemSQL management tools (memsql-admin, memsqlctl, etc.) can automatically detect if a host machine has multiple NUMA nodes and then configure MemSQL with numactl
to bind individual MemSQL nodes to NUMA nodes. To download and use the management tools, see the Installation Guides.
Configuring a new cluster for NUMA
Before binding NUMA nodes to specific MemSQL leaf nodes, you must install numactl
.
-
On each host, install the
numactl
package. For example, for Debian-based OSes:sudo apt-get install numactl
For Redhat/CentOS, run the following:
sudo yum install numactl
-
Check the number of NUMA nodes your machines by running
numactl --hardware
. For example:numactl --hardware **** available: 2 nodes (0-1)
The output shows that there are 2 NUMA nodes on this machine, numbered 0 and 1.
-
On each host that will contain MemSQL leaf nodes, create one leaf per NUMA node by running
memsql-admin create-node
and thenmemsql-admin add-leaf
until you have the same number of MemSQL leaf nodes as NUMA nodes. You will need to provide a different--port
argument for each MemSQL node on the same host.For example, on a host machine with two NUMA nodes, you would deploy two leaf nodes.
memsql-admin create-node --host <hostname|IP> --port 3307 --password <secure_pass>
memsql-admin create-node --host <hostname|IP> --port 3308 --password <secure_pass>
# Assign the nodes the role of "leaf" and add them to the cluster. memsql-admin list-nodes -q -r unknown | xargs -I % memsql-admin add-leaf --memsql-id % -y
-
Run
memsql-admin optimize
and confirm the prompt.memsql-admin optimize
This will configure
numactl
to bind MemSQL nodes to NUMA nodes, and configure MemSQL memory settings.See memsql-admin optimize for more information.
-
Restart the cluster for the configuration changes to take effect.
memsql-admin restart-node --all
Reconfiguring an existing cluster for NUMA
-
Follow the steps in the previous section to deploy and optimize your leaf nodes.
-
Rebalance all MemSQL databases by running REBALANCE PARTITIONS on each database:
REBALANCE PARTITIONS ON <database>