Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mongodb starts using numactl

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Introduction of NUMA

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 as "inconsistent memory access" and first appeared in version 2.6.7 for the Linux kernel. This feature will certainly improve the performance of the current X86 platform with large memory and multi-CPU, but on the contrary, it is also a big pit if it is not configured properly.

Non-uniform memory access (NUMA) is a computer memory design for multiprocessors, and the memory access time depends on the memory location of the processor. Under NUMA, a processor accesses its own local memory faster than non-local memory (a processor or memory shared between the place of memory and another processor). The NUMA architecture logically follows the symmetric multiprocessing (SMP) architecture. It was developed in the 1990s by developers including Burruphs (Youli system), Convex Computer (Hewlett-Packard), Italy's Honeywell Information system (HISI) (later Group Bull), Silicon Graphics (later Silicon Valley Graphics), Sequent computer system (later IBM), General data (EMC), Digital (later Compaq, HP). The technologies developed by these companies later shone brilliantly in Unix-like operating systems and were applied to Windows NT to some extent.

The first commercial implementation of NUMA-based Unix system is the symmetrical multiprocessing XPS-100 series server, which is designed for HISI by Dan Gielen of VAST company. The great success of this architecture has made HISI the top Unix vendor in Europe.

NUMA attempts to solve this problem by providing separate memory to each processor to avoid performance loss when multiple processors access the same memory. For applications that involve distributed data (common in servers and server-like applications), NUMA can improve performance up to n times through a shared memory, where n is about the number of processors (or separate memory).

The earliest Intel implemented NUMA on the Nehalem architecture, replacing the FSB front-end bus architecture that had been used before, to counter AMD's HyperTransport technology. On the one hand, the characteristic of this architecture is that the memory controller is moved from the traditional North Bridge to CPU, excluding the consideration of commercial strategic direction. This method is also to implement NUMA.

Intel's NUMA solution, Litrin has always believed that it comes from our own Ando. His model is somewhat similar to MapReduce. Give up the access mode of bus and divide CPU into multiple Node, each node has its own independent memory space. Each node communicates with each other through high-speed interconnection, and the communication channel is called QuickPath Interconnect or QPI.

II. Introduction to numactl

Numactl-Control NUMA policy for processes or shared memory # official introduction to translation: NUMA policies that control processes or shared memory

Linux provides a manually tuned command numactl (not installed by default), through which you can first view the numa status of the system.

# numactl-- hardware available: 2 nodes (0-1) node 0 cpus: 0 24 6 8 10 12 14 16 18 20 24 26 28 30node 0 size: 16290 MBnode 0 free: 11947 MBnode 1 cpus: 13 57 9 11 13 17 21 23 25 27 29 31node 1 size: 16384 MBnode 1 free: 14282 MBnode distances:node 0 10: 10 21 1: 21 this system has two node, each receiving 16 CPU and 16 GB of memory. Suppose I want to execute a java param command that requires 12 gigabytes of memory and a python param command that requires 16 gigabytes of memory. The best optimization is when python is executed in node0 and java is executed in node1. The command is: # numactl-- cpubind=0-- membind=0 python param#numactl-- cpubind=1-- membind=1 java param, of course You can also make the following configuration: # numactl-- cpubind=0-- membind=0,1 java param can view the numa status through the numastat command Note: numastat-Show per-NUMA-node memory statistics for processes and the operating system Chinese translation: display process and operating system memory statistics of each NUMA node # numastat node0 node1numa_hit 61086587932 25494360922numa_miss 101325832 28581785059numa_foreign 28581785059 101325832interleave_hit 28949 28518local_node 61086561129 25494416828other_node 101352635 28581729153other_node too high means that numa needs to be replanned.

Third, start mongodb using numactl

# numactl-- interleave=all / opt/app/mongodb/bin/mongod-f / etc/mongodb.conf allocates all node for its use, which is also the officially recommended usage.

Start mongodb with an ordinary user

Close # su-mongodb-s / bin/bash-c "/ opt/app/mongodb/bin/mongod-f / opt/app/mongodb/etc/mongodb.conf-- shutdown" launch # su-mongodb-s / bin/bash-c "numactl-- interleave=all / opt/app/mongodb/bin/mongod-f / opt/app/mongodb/etc/mongodb.conf"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report