A NUMA adaptation method, a NUMA optimizer, and a chip

By obtaining the static and dynamic configuration of the NUMA architecture, the specified resources are determined according to the target mode selected by the user, and the non-invasive NUMA adaptation is achieved, which solves the problems of high adaptation costs and low efficiency in traditional solutions, and improves the adaptation efficiency and performance .

CN118708364BActive Publication Date: 2024-12-31ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411195295.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-31
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

Traditional NUMA adaptation solutions require time-consuming and labor-intensive independent adaptation for each product, every tool, and every script, resulting in high adaptation costs and complex quality verification, and poor quality and efficiency of adaptation.

Method used

Provide a general NUMA adaptation method, by obtaining non-consistent memory access to the static configuration of the server in the NUMA architecture and the dynamic configuration of the operating system, determine the specified resource according to the target mode selected by the user and start the application under the resource, to realize Non-invasive NUMA adaptation for different applications and languages.

Benefits of technology

The efficiency and performance of NUMA adaptation are improved, the adaptation cost and complexity are reduced, and the need to independently implement NUMA optimization is avoided. The adaptation cost is reduced from several months to several days, and the testing cost and adaptation complexity are also greatly reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708364B_ABST
    Figure CN118708364B_ABST
Patent Text Reader

Abstract

The present application provides a NUMA adaptation method, a NUMA optimizer, and a chip, wherein the NUMA adaptation method includes: obtaining the static configuration of the server and the dynamic configuration of the operating system in the NUMA architecture; determining the available target configuration according to the static configuration and the dynamic configuration; determining the specified resources for the target application in the target configuration according to the target mode selected by the user, encapsulating the target application and starting the encapsulated application under the specified resources, and the target mode is one or more modes in the NUMA adaptation mode. Through this application, the technical problem that the traditional solution in the related art is that it is time-consuming, labor-intensive and unreasonable to perform NUMA adaptation for each product, each tool and each script is solved, and the technical effect of improving the versatility of NUMA adaptation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip technology, and in particular to a NUMA adaptation method, a NUMA optimizer, and a chip. Background Art

[0002] Currently in the information innovation projects, most of the central processing unit (CPU) chips are based on the non-uniform memory access (NUMA) architecture. In addition, Intel also plans to adopt a multi-NUMA architecture in its latest chips. Among them, NUMA is a computer memory design for multi-processor architecture, in which each processor has its own local memory and shares access to global memory with other processors through a memory bus. The purpose of NUMA is to improve the scalability of memory access in multi-processor computer systems. However, traditional applications do not support NUMA. If the traditional solution requires every product, tool, and script to be NUMA-adapted, it is time-consuming and labor-intensive and unreasonable, so it is very necessary to adopt a NUMA adaptation solution with good versatility. Summary of the invention

[0003] The embodiments of the present application provide a NUMA adaptation method, a NUMA optimizer, and a chip to solve one or more of the above-mentioned technical problems.

[0004] In a first aspect, an embodiment of the present application provides a NUMA adaptation method, including:

[0005] Get the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture;

[0006] Determine an available target configuration according to the static configuration and the dynamic configuration;

[0007] According to the target mode selected by the user, designated resources are determined for the target application in the target configuration, the target application is encapsulated and the encapsulated application is started under the designated resources, wherein the target mode is one or more modes of the NUMA adaptation mode.

[0008] In a second aspect, an embodiment of the present application provides a NUMA optimizer, which is arranged between an application and an operating system OS, and includes:

[0009] An acquisition module, used to acquire static configuration of a server and dynamic configuration of an operating system in a non-uniform memory access NUMA architecture;

[0010] A determination module, configured to determine an available target configuration according to the static configuration and the dynamic configuration;

[0011] A processing module is used to determine designated resources for a target application in the target configuration according to a target mode selected by a user, encapsulate the target application and start the encapsulated application under the designated resources, wherein the target mode is one or more modes of the NUMA adaptation mode.

[0012] In a third aspect, an embodiment of the present application provides a chip that uses a multi-NUMA architecture and uses the above-mentioned NUMA adaptation method when adapting to NUMA.

[0013] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements any of the above methods when executing the computer program.

[0014] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the above is implemented.

[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which implement any of the methods described above when executed by a processor.

[0016] Compared with the related art, this application has the following advantages:

[0017] According to the embodiment of the present application, the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture are obtained; the available target configuration is determined according to the static configuration and the dynamic configuration; according to the target mode selected by the user, the specified resources are determined for the target application in the target configuration, the target application is encapsulated and the encapsulated application is started under the specified resources, wherein the target mode is one or more modes in the NUMA adaptation mode. That is, the present application proposes a universal NUMA adaptation scheme, and different applications can avoid independent implementation of NUMA optimization. Specifically, according to the target mode selected by the user, the specified resources can be determined for the target application in the target configuration, the target application can be encapsulated and the encapsulated application can be started under the specified resources, and the application of the OS layer can be adapted non-invasively, which is independent of the language c++ / java / scripting language implemented by the application, thereby solving the technical problem in the related art that the traditional scheme of each product, each tool and each script performs NUMA adaptation, which is time-consuming, labor-intensive and unreasonable, and achieves the technical effect of improving adaptation efficiency and performance.

[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments according to the present application and should not be regarded as limiting the scope of the present application.

[0020] Figure 1 A schematic diagram of an application scenario of the NUMA adaptation method provided in an embodiment of the present application is shown;

[0021] Figure 2 A flowchart of a NUMA adaptation method provided in an embodiment of the present application is shown;

[0022] Figure 3 A structural block diagram of a NUMA optimizer provided in an embodiment of the present application is shown;

[0023] Figure 4 A schematic diagram of a process flow of NUMA adaptation performed by a NUMA optimizer provided in an embodiment of the present application is shown;

[0024] Figure 5 A schematic diagram showing the adaptation of a chip provided in an embodiment of the present application using a NUMA adaptation method;

[0025] Figure 6 A block diagram of an electronic device in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the concept or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary in nature and not restrictive.

[0027] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies of the embodiments of the present application. The following related technologies can be combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.

[0028] There are several main resource optimization solutions for NUMA at present: physical machine level, virtual machine level, docker level and kubenetes level. The implementation details of the above resource optimization solutions at different levels and technology stacks are as follows:

[0029] The operating system (OS) at the physical machine level provides the numactl and taskset commands, which can help users control specified processes on specified CPU cores and memory NUMA nodes. This is a core capability of the Linux version, but it is highly professional and varies on different hardware and OS versions, making it difficult to implement.

[0030] At the virtual machine level, including Hyper-V and VMware, both use a method similar to cpupin to specifically implement NUMA optimization when establishing the mapping relationship between the virtual machine and the physical machine.

[0031] NUMA optimization in Kubernetes, starting from version 1.18, the topology manager was introduced, which can help effectively place workloads on NUMA nodes to optimize performance. (1) Enable the topology manager: Make sure the topology manager is enabled on the cluster nodes and set the appropriate policy. There are multiple policy options, such as no policy, best effort, restricted, and single NUMA node. For NUMA optimization, a single NUMA node policy is usually recommended. (2) Set the CPU manager policy: The CPU manager can allocate dedicated CPU cores to containers. By setting CPU manager policies (such as static), performance can be improved on NUMA architectures. (3) Use CPU and memory requests and limits: Set CPU and memory requests and limits in the container specification to ensure that the Kubernetes scheduler can consider the resource usage of each NUMA node. (4) Use container topology diffusion constraints: By configuring container topology diffusion constraints, you can specify how to distribute container replicas between different NUMA nodes.

[0032] Docker level (based on numactl or cgoup): When running a container such as Docker, you can use numactl or similar tools to directly manage NUMA affinity. For example, you can specify NUMA node affinity before starting the container. You can use numactl directly inside the container, and if it is clearly necessary, execute the process inside the container through numactl to manage affinity settings more finely.

[0033] However, the traditional OS layer needs to use numactl to do NUMA adaptation. Product development needs to clearly fill in several parameters, including cpunodebind, membind, localalloc and other parameters, which specifically describe which CPU and memory the process needs to be bound to. The main disadvantage is that there are many factors to consider when developing adaptation, such as whether NUMA is turned on, the number of sockets / NUMA nodes, hardware deployment topology, and kernel parameter adjustment, which leads to high adaptation costs for different products. The quality verification of adaptation is also different. The existing adaptation problems are similar but different, resulting in high adaptation quality and cost. A new round of adaptation work is required when new hardware is introduced.

[0034] K8s provides a relatively reasonable policy-based NUMA adaptation solution, currently supporting four policies: no policy / best effort / restricted / single NUMA node. There are several disadvantages: only the CPU is considered as the only consideration, but in fact it is not the CPU that affects the performance of the application. For example, the network card and the application across NUMA nodes are unacceptable to some applications, but there are currently no richer adaptation policies. The docker level and virtual machine level are similar.

[0035] In view of this, the embodiment of the present application provides a NUMA adaptation method to fully or partially solve the above technical problems. The main application scenarios of this method include: applications that are insensitive to proprietary cloud base components, where the base components include but are not limited to: computing components, storage components, network components, security components, management and automation components, backup and disaster recovery components, service portals and application programming interfaces (APIs). The overall architecture is as follows: Figure 1 shown.

[0036] In the above application scenario, the present application embodiment provides the following Figure 2 The NUMA adaptation method shown includes:

[0037] S202, obtaining a static configuration of a server and a dynamic configuration of an operating system in a non-uniform memory access NUMA architecture.

[0038] It should be noted that static configuration includes predefined NUMA configuration and / or hardware configuration, and dynamic configuration includes resource usage in the operating system running state. The above NUMA configuration may include the NUMA configuration on the server and the configuration related to NUMA optimization in the kernel parameters, wherein the NUMA configuration on the server includes information such as whether NUMA is turned on, the number of slots and NUMA nodes, the latency difference across slots and NUMA nodes, and the frequency of memory access across nodes in the current system. The configuration related to NUMA optimization in the above kernel parameters includes NUMA balance, scheduling (sched) scheduling related parameters, memory recovery mechanism, etc. The above hardware configuration includes information such as hardware driver information, location and configuration of the node where the network card is located, memory rate, mapping relationship between memory and NUMA nodes, location of disks and peripherals, etc.

[0039] In addition, it should be noted that the above dynamic configuration may include the busyness of CPU resources on different NUMA nodes, memory allocation and cross-path access conditions, etc.

[0040] In a possible implementation, the above-mentioned method of obtaining the static configuration of the server in the NUMA architecture may include: providing detailed information about the CPU architecture, including its relevance to NUMA, through the lscpu command, which displays the number of NUMA nodes and the CPU cores associated with each node. umactl is a set of tools for managing NUMA policies, in which the numactl--hardware command displays the memory and CPU distribution of NUMA nodes. dmidecode is a tool for obtaining hardware information, which can display hardware details, including memory modules, CPU information, etc., by parsing system BIOS information. The Linux sys file system contains a large amount of system and hardware information, including NUMA structure information. NUMA-related information can also be obtained by viewing the information in the proc file system.

[0041] S204: Determine an available target configuration according to the static configuration and the dynamic configuration.

[0042] S206, according to the target mode selected by the user, determining designated resources for the target application in the target configuration, encapsulating the target application and starting the encapsulated application under the designated resources, wherein the target mode is one or more modes of the NUMA adaptation mode.

[0043] It should be noted that the above-mentioned designated resources include at least one of the following: CPU, memory. The above-mentioned target applications include but are not limited to: traditional applications before the emergence of modern cloud computing, microservices and containerization technologies (for example, enterprise resource planning (ERP) systems, customer relationship management (CRM) software, database management systems (DBMS), email systems, financial accounting software, desktop office software, file storage systems, etc.).

[0044] In addition, it should be noted that the NUMA adaptation mode can be an adaptation mode proposed based on different strategies such as general / network guarantee / node guarantee / slot guarantee.

[0045] Through the above steps S202~S206, the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture are obtained; the available target configuration is determined according to the static configuration and the dynamic configuration; according to the target mode selected by the user, the specified resources are determined for the target application in the target configuration, the target application is encapsulated and the encapsulated application is started under the specified resources, wherein the target mode is one or more modes in the NUMA adaptation mode. That is, the present application proposes a universal NUMA adaptation solution, and different applications can avoid independent implementation of NUMA optimization. Specifically, according to the target mode selected by the user, the specified resources can be determined for the target application in the target configuration, the target application can be encapsulated and the encapsulated application can be started under the specified resources, and the application of the OS layer can be adapted non-invasively, which is independent of the language c++ / java / scripting language implemented by the application, thereby solving the technical problem in the related technology that the traditional solution is time-consuming, labor-intensive and unreasonable for each product, each tool and each script to perform NUMA adaptation, and achieves the technical effect of improving adaptation efficiency and performance.

[0046] The user selection of the target mode is mentioned above. Based on this, the embodiment of the present application further proposes: S11, providing the NUMA adaptation mode to the user, and the NUMA adaptation mode is used for the user to select the target mode. Optionally, the NUMA adaptation mode includes a first adaptation mode and / or a second adaptation mode, wherein the first adaptation mode is a mode for starting the application in the socket range, and the second adaptation mode is a mode for starting the application in the NUMA node range, wherein the first adaptation mode includes but is not limited to at least one of the following:

[0047] Mode 1: Without distinguishing NUMA nodes, try to start the application on a certain socket. If the resources of the socket are insufficient, start the application across sockets. This mode can be the default mode. In this mode, you can use the membind and cpunodebind options of numactl to bind memory and CPU, which can ensure the maximum resource distribution.

[0048] Mode 2: Without distinguishing NUMA nodes, ensure that the application is started on a certain socket, and return an error if the socket has insufficient resources. This mode is suitable for scenarios with extremely high performance requirements and the desire to avoid cross-socket communication overhead.

[0049] Mode 3: Select an optimal NUMA node for the application from the NUMA configuration. If this is not possible, fall back to launching the application in the socket range. In this mode, an optimal NUMA node can be selected for the application in a "best effort" manner, considering how to minimize memory access latency and maximize data throughput.

[0050] The second adaptation mode includes but is not limited to at least one of the following:

[0051] Mode 4: Ensure that the application is started on a NUMA node. If the NUMA node has insufficient resources, an error is returned. Several tools and commands in Linux can be used for control and management. These tools allow the specified application and its memory access to be restricted to a specific NUMA node. This mode is suitable for applications that require high performance and low latency, improving overall system efficiency and user experience.

[0052] Mode 5: Automatically start the application on the NUMA node closest to the network card. In the Linux system, you can use the lstopo command to visualize and find the NUMA node bound to each device (including the network card). After determining the NUMA node of the network card, use numactl to bind the application to the node and start it. This mode can significantly improve the performance of latency-sensitive applications.

[0053] Mode 6: User-defined Start on a certain NUMA node. If the NUMA node is insufficient, an error message is returned. That is, if the user has a deep understanding of the hardware and OS, the user can customize the adaptation mode.

[0054] In a possible implementation, encapsulating the target application and starting the encapsulated application under the specified resource may include: S21, encapsulating the startup logic of the target application using a NUMA native command; S22, starting the encapsulated application under the specified resource. It should be noted that NUMA native commands generally include: numactl command, numastat command, lstopo command, taskset command, numa_maps command, numad command, numactl-hardware command, numactl-interleave command. The numactl command is a major tool for managing NUMA policies, which can control the NUMA policies of processes, including memory allocation and CPU binding, etc. The numastat command can be used to display memory consumption statistics about NUMA nodes, which is suitable for monitoring the NUMA behavior of the system. The lstopo command (from the hwloc toolkit) provides a hardware topology map of a system, including views of NUMA nodes, CPUs, memory, etc. The taskset command is not a dedicated NUMA command, but it is often used with numactl to set CPU affinity (i.e., the CPU core on which the process can run). This is important in NUMA optimization to ensure that processes have close access to required resources. The numa_maps command is used to display NUMA memory mapping information for a specific process to help advanced users analyze memory usage. The numad command is a daemon that automatically manages NUMA policies to improve system performance. It dynamically monitors load and resources to determine the best deployment on the NUMA architecture. The numactl—hardware command can display the detailed configuration of all NUMA nodes, including which CPUs and memory each node has. The numactl–interleave command can evenly distribute memory allocation among all NUMA nodes, which helps certain application scenarios, such as when high-throughput memory access is required. Through the above S21~S22, different applications, especially OS and hardware-insensitive applications, can avoid independent implementation of NUMA optimization, and the adaptation cost is reduced from months to days. The corresponding testing cost is also changed from testing all applications separately to testing one application completely and testing the startup logic of other applications separately, which reduces the adaptation complexity by orders of magnitude.

[0055] The above-mentioned acquisition of the dynamic configuration of the operating system in the NUMA architecture may include: S31, analyzing the real-time information of the current operation of the operating system; S32, acquiring the dynamic configuration according to the real-time information. Optionally, S32 may include S321, using a specified command in the operating system to acquire first information, wherein the first information includes at least one of the following: the CPU usage of the application process running in the operating system, the memory usage of the application process running in the operating system; S322, acquiring second information from the running state statistics of the control group of the application process, wherein the second information includes the CPU, memory, input / output I / O and network constraints of the application process running in the operating system; S323, acquiring third information, wherein the third information includes the specific location of the CPU and memory used by the application process in the operating system; S324, generating a heat map of resource distribution used by a single machine process according to the first information, the second information and the third information; S325, determining the dynamic configuration according to the resource usage reflected by the heat map of resource distribution used by the single machine process. Optionally, the generation method of the above-mentioned single-machine process resource distribution heat map can be generated through a visualization library. Through the above steps, the real-time information of the current operation of the operating system is obtained, such as CPU usage, memory usage, CPU, memory, input / output I / O and network constraints, CPU specific location, memory specific location, and combined with static configuration, a single-machine process resource distribution heat map can be generated. The single-machine process resource distribution heat map provides an intuitive resource usage status, helps identify performance bottlenecks and resource hotspots, and the dynamic configuration is based on these feedback information to adjust the system resource allocation strategy in real time, improve resource utilization and system performance, and prepare for the resource selection of new processes later.

[0056] For the scenario of large page memory (a memory management technology that uses memory pages larger than regular pages to improve memory access efficiency and reduce memory management overhead. By default, the operating system usually uses a 4KB memory page, while the size of the large page memory page can be 2MB or 1GB, etc.), the embodiment of the present application also proposes: after determining the designated resources for the target application in the target configuration according to the target mode selected by the user, it also includes: S41, obtaining the operating system kernel parameters, wherein the kernel parameters include at least one of the following: network card queue length, interrupt binding core strategy, memory switching strategy; S42, adjusting the designated resources according to the operating system kernel parameters. Optionally, S42 may include S421, determining the reserved resources through the operating system kernel parameters; S422, adjusting the designated resources according to the reserved resources. The above steps also take into account the resources reserved by the operating system for large page memory. After determining the above designated resources, the reserved resources can also be removed from the designated resources to ensure that the resources allocated to the target application are more reasonable, thereby ensuring that the application can be started normally.

[0057] If there are several available resources, the optimal shortest path can be selected according to the built-in strategy. For example, if an application is not network sensitive, it will give priority to a place far away from the network card to reserve space for other potential network applications. If it is determined that no available resource configuration is obtained, the embodiment of the present application also proposes: S51, hot migration of existing process resources to the target location to obtain the target resources; S52, redetermining the available resource configuration. Optionally, in the embodiment of the present application, the specific implementation method of step S52 can be to re-execute the above-mentioned determination process of the specified resources. That is, when there are no available resources but they can be vacated, choose to hot migrate other existing process resources to other places, save resources, and then retry the resource selection process.

[0058] In summary, the NUMA adaptation solution provided by this application is compatible with upper-layer applications, reduces the adaptation cost of applications accessing NUMA, including the cost of development and testing, and ultimately improves the performance and reliability of the overall software. By pre-judging the available target resources, and then using NUMA native commands to encapsulate the application startup logic, the OS layer application is adapted non-invasively, regardless of the language c++ / java / scripting language used to implement it. After using the adaptation solution provided by this application, all applications are uniformly connected once, and are permanently available by modifying the parameters of the startup application, including different x86 / arm / sw and other chip architectures, including existing / newly added hardware, similar to the java JVM, which achieves the effect of adapting once and running everywhere. At the same time, it can be updated according to the chip upgrade and the adaptation solution version, and the best performance experience can be obtained all the time.

[0059] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0060] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The several specific embodiments listed can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0061] Corresponding to the application scenario and method of the method provided in the embodiment of the present application, the embodiment of the present application also provides a NUMA optimizer. Figure 3 The figure shows a structural block diagram of a NUMA optimizer according to an embodiment of the present application. The NUMA optimizer may include:

[0062] A first acquisition module 32, used to acquire the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture;

[0063] A first determination module 34, configured to determine an available target configuration according to the static configuration and the dynamic configuration;

[0064] The processing module 36 is used to determine designated resources for the target application in the target configuration according to the target mode selected by the user, encapsulate the target application and start the encapsulated application under the designated resources, wherein the target mode is one or more modes of the NUMA adaptation mode.

[0065] pass Figure 3The device shown obtains the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture; determines the available target configuration according to the static configuration and the dynamic configuration; determines the specified resources for the target application in the target configuration according to the target mode selected by the user, encapsulates the target application and starts the encapsulated application under the specified resources, wherein the target mode is one or more modes in the NUMA adaptation mode. That is, the present application proposes a universal NUMA adaptation solution, and different applications can avoid independent implementation of NUMA optimization. Specifically, according to the target mode selected by the user, the specified resources can be determined for the target application in the target configuration, the target application can be encapsulated and the encapsulated application can be started under the specified resources, and the application of the OS layer can be adapted non-invasively, which is independent of the language c++ / java / scripting language implemented by the application, thereby solving the technical problem in the related art that the traditional solution is time-consuming, labor-intensive and unreasonable for each product, each tool and each script to perform NUMA adaptation, and achieves the technical effect of improving adaptation efficiency and performance.

[0066] In a possible implementation, the NUMA adaptation mode includes a first adaptation mode and / or a second adaptation mode, wherein the first adaptation mode is a mode for starting an application in a slot range, and the second adaptation mode is a mode for starting an application in a NUMA node range. The first adaptation mode shown includes at least one of the following: without distinguishing NUMA nodes, try to start the application on a certain slot, and if the slot resources are insufficient, start the application across slots; without distinguishing NUMA nodes, ensure that the application is started on a certain slot, and return an error if the slot resources are insufficient; select an optimal NUMA node for the application from the NUMA configuration, and if it cannot be achieved, return to start the application in the slot range; the second adaptation mode includes at least one of the following: ensure that the application is started on a NUMA node, and return an error if the NUMA node resources are insufficient; automatically start the application on the NUMA node closest to the network card; user-defined start on a certain NUMA node, and return an error if the NUMA node resources are insufficient.

[0067] The processing module 36 includes: an encapsulation unit, which is used to encapsulate the startup logic of the target application using NUMA native commands; and a startup unit, which is used to start the encapsulated application under the specified resources.

[0068] The first acquisition module 32 includes: an analysis unit for analyzing the real-time information of the current operation of the operating system; an acquisition unit for acquiring the dynamic configuration according to the real-time information. Optionally, the acquisition unit includes: a first acquisition subunit for acquiring first information using a specified command in the operating system, wherein the first information includes at least one of the following: the CPU usage of the application process running in the operating system, the memory usage of the application process running in the operating system; a second acquisition subunit for acquiring second information from the control group running state statistics of the application process, wherein the second information includes the CPU, memory, input / output I / O and network constraints of the application process running in the operating system; a third acquisition subunit for acquiring third information, wherein the third information includes the specific location of the CPU and memory used by the application process in the operating system; a generation subunit for generating a heat map of resource distribution used by a single machine process according to the first information, the second information and the third information; a determination subunit for determining the dynamic configuration according to the resource usage reflected by the heat map of resource distribution used by the single machine process.

[0069] Optionally, the above device further includes: a second acquisition module, which is used to acquire the operating system kernel parameters after determining the designated resources for the target application in the target configuration according to the target mode selected by the user, wherein the kernel parameters include at least one of the following: network card queue length, interrupt binding core policy, memory switching policy; an adjustment module, which is used to adjust the designated resources according to the operating system kernel parameters. The adjustment module also includes a determination unit, which is used to determine the reserved resources through the operating system kernel parameters; and an adjustment unit, which is used to adjust the designated resources according to the reserved resources.

[0070] If it is determined that no available resource configuration is obtained, the above-mentioned device also includes: a migration module, which is used to hot migrate the existing process resources to the target location to obtain the target resources; and a second determination module, which is used to redetermine the available resource configuration.

[0071] Optionally, in the embodiment of the present application, the above-mentioned designated resources include at least one of the following: CPU, memory. Static configuration includes predefined NUMA configuration and / or hardware configuration, and dynamic configuration includes resource usage in the operating system running state.

[0072] The embodiments of the present application are described below with reference to specific examples.

[0073] like Figure 4As shown, the example includes the following steps: S401, the NUMA optimizer obtains the NUMA configuration on the server, including whether NUMA is turned on, the number of sockets and NUMA nodes, the latency difference across sockets and nodes, the memory access frequency across nodes in the current system, and other information. S402, the NUMA optimizer obtains the configuration related to NUMA optimization in the kernel parameters, such as numa balance, sched scheduling related parameters, memory recycling mechanism, etc. S403, the NUMA optimizer analyzes the hardware configuration, including the location and configuration of the hardware driver information, the node information where the network card is located, the memory rate, the mapping relationship between the memory and the NUMA node, the location of the disk and peripherals, and other information. S404: Analyze the current real-time status of the operating system, including the busyness of CPU resources on different nodes, memory allocation and cross-path access, etc., and establish a topological diagram of the actual use of current resources. Specifically, it can be: using the OS system command to obtain the actual CPU and memory usage of the processes running in the current system, and from the running state statistics such as the process control group (cgroup), obtain the various constraints of the CPU, memory, I / O, and network of the processes running in the system; using open source and internal tools to collect the specific locations of the CPU and memory used by the processes in the system; based on the information collected in the previous three steps, generate a heat map of the resource distribution of the single-machine process, and prepare for the resource selection of the new process to be pulled up later. S405: Based on the input parameters, help the application find the best configuration and encapsulate the native naming of the application to start the application. Specifically, according to the specific mode selected by the user, first select relatively idle and available resources as alternatives based on the current heat map obtained in the previous steps. If there are no available resources but they can be vacated, choose to hot migrate other existing process resources to other places, save resources and retry the resource selection process. If there are several available resources, the optimal shortest path will be selected according to the built-in strategy. For example, if an application is not network sensitive, it will give priority to places far away from the network card to reserve space for potential other network applications. Analyze system kernel parameters, such as network card queue length, interrupt binding core strategy, memory switching strategy and other details, and then choose to reuse or adjust the strategy to a more reasonable configuration. After determining the details such as resources and parameters used by the process, the application process will be finally pulled up.

[0074] Corresponding to the application scenario and method of the method provided in the embodiment of the present application, the embodiment of the present application also provides a chip, such as Figure 5As shown, the chip uses a multi-NUMA architecture, and the above-mentioned NUMA adaptation method is used when adapting to NUMA. In the method of using the above-mentioned NUMA adaptation, the static configuration of the server in the non-uniform memory access NUMA architecture and the dynamic configuration of the operating system are obtained; the available target configuration is determined according to the static configuration and the dynamic configuration; according to the target mode selected by the user, the specified resources are determined for the target application in the target configuration, the target application is encapsulated, and the encapsulated application is started under the specified resources, wherein the target mode is one or more modes in the NUMA adaptation mode. That is, the present application proposes a universal NUMA adaptation solution, and different applications can avoid independent implementation of NUMA optimization. Specifically, according to the target mode selected by the user, the specified resources can be determined for the target application in the target configuration, the target application can be encapsulated, and the encapsulated application can be started under the specified resources, and the application of the OS layer can be adapted non-invasively, which is independent of the language c++ / java / script language implemented by the application, thereby solving the technical problem in the related art that the traditional solution is time-consuming, labor-intensive and unreasonable for each product, each tool and each script to perform NUMA adaptation, and achieves the technical effect of improving adaptation efficiency and performance. The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0075] Figure 6 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Figure 6 As shown, the electronic device includes: a memory 601 and a processor 602. The memory 601 stores a computer program that can be run on the processor 602. When the processor 602 executes the computer program, the method in the above embodiment is implemented. The number of the memory 601 and the processor 602 can be one or more.

[0076] The electronic device also includes:

[0077] The communication interface 603 is used to communicate with external devices and perform data exchange transmission.

[0078] If the memory 601, the processor 602 and the communication interface 603 are implemented independently, the memory 601, the processor 602 and the communication interface 603 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0079] Optionally, in a specific implementation, if the memory 601, the processor 602 and the communication interface 603 are integrated on a chip, the memory 601, the processor 602 and the communication interface 603 can communicate with each other through an internal interface.

[0080] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present application when the program is executed by a processor.

[0081] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.

[0082] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.

[0083] It should be understood that the above processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor that supports the Advanced RISC Machines (ARM) architecture.

[0084] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting description, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).

[0085] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.

[0086] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0087] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0088] Any process or method described in the flow chart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.

[0089] The logic and / or steps described in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.

[0090] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.

[0091] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.

[0092] The above is only an exemplary embodiment of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope recorded in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A NUMA adaptation method, characterized in that: include: Get the static configuration of the server and the dynamic configuration of the operating system in the non-uniform memory access NUMA architecture; Determine an available target configuration according to the static configuration and the dynamic configuration; According to the target mode selected by the user, designated resources are determined for the target application in the target configuration, the startup logic of the target application is encapsulated using NUMA native commands, and the encapsulated application is started under the designated resources, wherein the target mode is one or more modes in the NUMA adaptation mode, and the NUMA adaptation mode includes a first adaptation mode, the first adaptation mode is a mode for starting the application in a slot range, and the first adaptation mode includes at least one of the following: without distinguishing NUMA nodes, try to start the application on a certain slot socket, if the slot resources are insufficient, start the application across slots; without distinguishing NUMA nodes, ensure that the application is started on a certain slot, if the slot resources are insufficient, return an error; select an optimal NUMA node for the application from the NUMA configuration, if this cannot be achieved, return to starting the application in the slot range.

2. The method according to claim 1, characterized in that The NUMA adaptation mode also includes a second adaptation mode, which is a mode for starting an application within a NUMA node range. The second adaptation mode includes at least one of the following: ensuring that the application is started on a NUMA node, and returning an error if the NUMA node has insufficient resources; automatically starting the application on the NUMA node closest to the network card; and user-defined starting on a certain NUMA node, and returning an error if the NUMA node has insufficient resources.

3. The method according to claim 1, characterized in that Get the dynamic configuration of the operating system in the NUMA architecture, including: Analyzing real-time information of the current operation of the operating system; The dynamic configuration is acquired according to the real-time information.

4. The method according to claim 3, characterized in that Acquiring the dynamic configuration according to the real-time information includes: Using a specified command in the operating system, obtaining first information, wherein the first information includes at least one of the following: a CPU usage of an application process running in the operating system, and a memory usage of an application process running in the operating system; Acquire second information from the control group running state statistics of the application process, wherein the second information includes CPU, memory, input / output I / O, and network constraints of the application process running in the operating system; Acquire third information, wherein the third information includes specific locations of a CPU and a memory used by the application process in the operating system; Generate a heat map of resource distribution used by a single-machine process according to the first information, the second information, and the third information; The dynamic configuration is determined according to the resource usage reflected by the resource distribution heat map of the stand-alone process.

5. The method according to claim 1, characterized in that After determining the designated resources for the target application in the target configuration according to the target mode selected by the user, the method further includes: Obtaining the operating system kernel parameters, wherein the kernel parameters include at least one of the following: network card queue length, interrupt binding core strategy, and memory switching strategy; The designated resource is adjusted according to the operating system kernel parameter.

6. The method according to claim 5, characterized in that Adjusting the specified resource according to the operating system kernel parameter includes: Determining reserved resources through the operating system kernel parameters; The designated resources are adjusted according to the reserved resources.

7. The method according to claim 1, characterized in that The method further comprises: If it is determined that no available resource configuration is obtained, the existing process resources are hot migrated to the target location to obtain the target resources; Re-determine the available resource configuration.

8. The method according to any one of claims 1 to 7, characterized in that: The static configuration includes a predefined NUMA configuration and / or hardware configuration, and the dynamic configuration includes resource usage in a running state of an operating system.

9. A NUMA optimizer, arranged between an application and an operating system OS, characterized in that: include: An acquisition module, used to acquire static configuration of a server and dynamic configuration of an operating system in a non-uniform memory access NUMA architecture; A determination module, configured to determine an available target configuration according to the static configuration and the dynamic configuration; A processing module is used to determine designated resources for a target application in the target configuration according to a target mode selected by a user, encapsulate the startup logic of the target application using NUMA native commands, and start the encapsulated application under the designated resources, wherein the target mode is one or more modes in the NUMA adaptation mode, and the NUMA adaptation mode includes a first adaptation mode, the first adaptation mode is a mode for starting an application in a slot range, and the first adaptation mode includes at least one of the following: without distinguishing NUMA nodes, try to start the application on a certain slot socket, and if the slot resources are insufficient, start the application across slots; without distinguishing NUMA nodes, ensure that the application is started on a certain slot, and if the slot resources are insufficient, return an error; select an optimal NUMA node for the application from the NUMA configuration, and if this cannot be achieved, return to starting the application in the slot range.

10. A chip, characterized in that: Using a multi-NUMA architecture, when adapting to NUMA, the method described in any one of claims 1 to 8 is used.

11. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 8 when executing the computer program.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

13. A computer program product, characterized in that The method comprises computer instructions, which implement the method according to any one of claims 1 to 8 when executed by a processor.