Search code examples
mysqlmemoryintelnumanumactl

numactl --localalloc on Mysql


I run mysql on 2*Intel 6226 Server.

When I use numactl -N 0 --localalloc /usr/sbin/mysqld to start mysql service I find that the memory from node 1 is be used, which is different from using option numactl -N 0 -m 0 /usr/sbin/mysqld.

Why numactl --localalloc can’t Limit memory usage to node 0 ?

Please help explain why this happens.

Much thanks!

Node memory when using numactl -N 0 -l

Node memory when using numactl -N 0 -m 0

Mysql execute command in /usr/lib/systemd/system/mysql.service


Solution

  • See https://github.com/numactl/numactl/issues/143

    --localalloc :Preferably allocate memory on local node, but if memory cannot be allocated there fall back to other nodes, like --preferred local node, it is kernel default mempolicy.

    so numactl -N 0 --localalloc is more like numactl -N 0 --preferred 0;

    but numactl -N 0 -m 0 mean only allocate memory from nodes, Allocation will fail when there is not enough memory available on nodes.