First, Numa introduction
Before introducing Numactl, you need to talk about what NUMA is, so that you can better understand numactl.
NUMA (Non Uniform memory access Architecture) literally translates to "non-conforming RAM access", which first appears on the 2.6.7 version for the Linux kernel. This feature for the current large memory + multi-CPU is the trend of the X86 platform will certainly have a lot of performance improvement, but on the contrary, if configured improperly, it is also a big pit.
Non-Uniform Memory access (NUMA) is a computer memory design for multi-processor, and memory access time depends on the memory location of the processor. Under NUMA, the processor accesses its own local memory faster than the non-local memory (the processor or memory shared between the memory and the other processor). The NUMA architecture logically follows the symmetric multi-processing (SMP) architecture. It was developed in the 1990s, with developers including burruphs (superior systems), Convex computer (Hewlett-Packard), the Honeywell Information System (HISI) in Italy (later group Bull), Silicon Graphics Corporation (later Silicon Valley graphics), Sequent computer System (later IBM), General Data (EMC), Digital (later Compaq, HP). The technology developed by these companies later became a part of the Unix-like operating system and was applied to Windows NT to some extent.
The first commercial implementation of a NUMA-based UNIX system is a symmetric multi-processing XPS-100 series server designed by vast's Dan Gielen for HiSi. The great success of this architecture has made HiSi the top UNIX vendor in Europe.
NUMA attempts to address this problem by providing separate storage for each processor and avoiding the performance penalty that occurs when multiple processors access the same memory. For applications that involve scattered data (common in servers and server-like applications), NUMA can improve performance to n times through a shared memory, and N is approximately the number of processors (or separate memory).
The first Intel implemented NUMA on the Nehalem architecture, replacing the FSB front-end bus architecture that had been used previously, to combat AMD's HyperTransport technology. On the one hand, this architecture is characterized by the memory controller moving from the traditional North Bridge to the CPU, excluding the business strategic direction of consideration, the same way is to implement NUMA.
Intel's NUMA solution, Litrin, has always thought it was from the clan's Ando. His model is somewhat similar to MapReduce. By giving up access to the bus, dividing the CPU into multiple node, each node has its own separate memory space. Each node through the high-speed interconnection communication, communication channel is become QuickPath interconnect namely QPI.
Ii. introduction of Numactl
Numactl-control NUMA policy for processes or shared memory #官方介绍翻译: NUMA policies that control processes or shared memories
Linux provides a manually tuned command Numactl (not installed by default), which you can use to view the NUMA status of the system first
#numactl --hardware available: 2 nodes (0-1) node 0 cpus: 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30node 0 size: 16290 mbnode 0 free: 11947 mbnode 1 cpus: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31node 1 size: 16384 MBnode 1 free: 14282 MBnode distances:node 0 1 0: 10 21 1: 21 10 This system has 2 node, each receiving 16 CPUs and 16G of memory. This assumes that I want to execute a java param command that requires 12G of memory, and a python param command that requires 16G of memory. The best optimization scenario when Python executes in node0, while Java executes in Node1, the command is: #numactl --cpubind=0 --membind=0 python param# Numactl --cpubind=1 --membind=1 java param of course, you can also fooling the following configuration: #numactl  --CPUBIND=0&NBsp;--membind=0,1 java param to view NUMA status by numastat command Note: numastat - show per-numa-node memory statistics for processes and the operating System Chinese Translation: Displays memory statistics for each NUMA node of the process and operating system # numastat node0 node1numa_hit 61086587932 25494360922numa_miss 101325832 28581785059numa_foreign 28581785059 101325832interleave_hit 28949 28518local_node 61086561129 25494416828other_node 101352635 High 28581729153other_node means that NUMA needs to be re-planned.
Iii. using Numactl to start MongoDB
#numactl--interleave=all/opt/app/mongodb/bin/mongod-f/etc/mongodb.conf is assigned all node for its use, which is also the official recommended usage.
This article is from the "Knowledge System" blog, please be sure to keep this source http://linuxg.blog.51cto.com/4410110/1921697
Mongodb uses Numactl to start