Memory performance degradation testing methods and apparatus

By monitoring user process load and setting environment variables and control groups, the problem of inconsistent resources between cloud hosts and host machines was solved, and the reliability and accuracy of memory performance degradation testing were achieved.

CN116302815BActive Publication Date: 2026-05-26CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2023-03-09
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies, when assessing memory virtualization overhead, suffer from inconsistent resource usage between cloud hosts and host machines during testing, leading to inaccurate test results.

Method used

By monitoring user process load, setting environment variables and control groups to limit resource consistency, and using binary search combined with differential judgment to calculate optimal parameters, resource consistency between cloud hosts and host machines is ensured during memory performance testing.

Benefits of technology

This improves the reliability and accuracy of memory performance degradation testing, ensuring that test results more objectively reflect memory performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302815B_ABST
    Figure CN116302815B_ABST
Patent Text Reader

Abstract

This application relates to a method and apparatus for testing memory performance degradation. The method includes: monitoring user processes of a cloud host and a host machine, and terminating user processes when the user process load exceeds a first threshold, so that the cloud host and the host machine are in an idle state; repeatedly executing a first file, and sequentially executing a synchronization command and a cache clearing command after each execution of the first file to release slab objects and page caches of the cloud host; obtaining environment variables to limit the number of parallel threads and CPU affinity of the host machine; obtaining a control group to limit the memory usage of user processes on the host machine; repeatedly executing a first command, and sequentially executing a synchronization command and a cache clearing command after each execution of the first command to release slab objects and page caches of the host machine; statistically analyzing the execution results of the first file and the first command, and calculating the average memory bandwidth of the cloud host and the host machine; and calculating the memory performance degradation ratio of the cloud host based on the average memory bandwidth of the cloud host and the host machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing testing, and in particular to a method and apparatus for testing memory performance degradation. Background Technology

[0002] More than a decade has passed since the concept of "cloud computing" was first proposed. Cloud computing technology has advanced by leaps and bounds and is playing an increasingly important role in many fields.

[0003] Virtualization is a core foundational technology in the field of cloud computing. It effectively and dynamically allocates and shares various physical resources in a computer, such as CPU, memory, storage, and network, across regions. It solves problems in scheduling, allocation, and isolation of computer resources, and greatly improves resource utilization.

[0004] Memory virtualization is a key virtualization technology. It refers to the VMM (Virtual Machine Manager) providing the cloud host operating system with a contiguous block of physical memory starting from address 0, making the cloud host believe it has exclusive access to the entire physical address space. Thus, both the cloud host and the physical machine have the concepts of VA and PA: Guest Virtual Address (GVA) and Guest Physical Address (GPA), and Host Virtual Address (HVA) and Host Physical Address (HPA). Accessing memory by the cloud host requires a conversion process of GVA->GPA->HVA->HPA. In summary, this conversion path is long and complex, increasing the burden on memory read / write performance.

[0005] Early GVA to HPA address translation was achieved using shadow page table (sPT) technology. However, sPT maintenance was extremely complex and costly, sometimes accounting for up to 75% of the entire VMM software load. To address this, major CPU manufacturers introduced hardware-assisted memory virtualization technologies, such as Intel's EPT (Extended Page Table) and AMD's NPT (Nested Page Table), both of which could support GVA to GPA and GPA to HPA address translation simultaneously in hardware. However, while EPT improved address translation speed, when both page tables were level 4, the translation process was still quite slow. Figure 1As shown, since the contents of each level of page table (gL4, gL3, gL2, gL1) in the virtual machine are only GPA, when querying the next level, the extended page table (nL4, nL3, nL2, nL1) must first be converted to HPA, making the entire conversion path very long. In the worst case, it may even require 24 hardware table lookups and conversions. Therefore, the overhead of memory virtualization is an important factor that must be considered.

[0006] To assess the overhead of memory virtualization, the mainstream approach is to conduct memory performance tests on both the cloud server and the host machine using memory performance testing tools like Stream, and then compare the results to determine the performance overhead ratio. However, ensuring the consistency of resources used on the host and cloud servers during testing—such as the number of CPU cores, CPU affinity, available memory, and NUMA access—is a crucial challenge to achieve more accurate results. Summary of the Invention

[0007] Therefore, it is necessary to provide a memory performance degradation testing method and apparatus to address the aforementioned technical issues. By setting environment variables and control groups, the resources and loads involved in the memory performance test between the cloud host and the host machine are consistent, resulting in more accurate test results.

[0008] Firstly, this application provides a method for testing memory performance degradation, the method comprising:

[0009] Monitor the user processes of the cloud host and the host machine, and terminate the user processes when the load of the user processes exceeds a first threshold, so that the cloud host and the host machine are in an idle state.

[0010] Repeatedly execute the first file, and after each execution of the first file, execute the synchronization command and the clear cache command in sequence to release the slab objects and page cache of the cloud host;

[0011] Environment variables are used to limit the number of concurrent threads on the host machine and CPU affinity;

[0012] The acquisition control group is used to limit the memory usage of host user processes;

[0013] Repeat the first command, and after each execution of the first command, execute the synchronization command and the clear cache command in sequence to release the host machine's slab objects and page cache;

[0014] The execution results of the first file and the first command are statistically analyzed, and the average memory bandwidth of the cloud host and the host machine is calculated.

[0015] The memory performance loss ratio of the cloud server is calculated by combining the average memory bandwidth of the cloud server and the host machine.

[0016] In one embodiment, the acquisition of environment variables to limit the number of concurrent threads and CPU affinity on the host machine includes:

[0017] Obtain the first environment variable and adjust the first environment variable to make it consistent with the number of threads running in parallel on the host machine;

[0018] Obtain the second environment variable and adjust it to make it consistent with the host CPU affinity.

[0019] In one embodiment, the acquisition control group is used to limit the memory usage of host user processes, including:

[0020] Obtain a control group for memory limits;

[0021] Adjust the available memory quota of the control group to match the available memory size of the cloud host.

[0022] In one embodiment, the step of terminating the user process when the user process load exceeds a first threshold further includes:

[0023] The optimal value of the first parameter is calculated by combining binary search with difference judgment. The first parameter is a parameter of the memory testing tool, and the smaller the value of the first parameter, the less memory is required for the test.

[0024] Compile the optimal value of the first parameter into the first file.

[0025] In one embodiment, the optimal value of the first parameter is less than four times the server cache and greater than the ratio of the server cache to the number of non-consistent memory access nodes.

[0026] In one embodiment, the step of calculating the optimal value of the first parameter based on binary search combined with difference judgment includes:

[0027] The first test value of the first parameter is obtained by calculating using binary search;

[0028] Two second test values ​​with a predetermined difference from the first test value are imported into a memory testing tool and tested. The test is performed to determine whether an error occurs, thereby determining the execution range of the subsequent binary search. The binary search is stopped when the number of iterations of the binary search reaches the upper limit or the length of the test value range reaches the lower limit.

[0029] Secondly, this application provides a memory performance degradation testing device, the device comprising:

[0030] The monitoring module is used to monitor the user processes of the cloud host and the host machine, and terminate the user process when the load of the user process exceeds a first threshold, so that the cloud host and the host machine are in an idle state.

[0031] The first execution module is used to repeatedly execute the first file, and after each execution of the first file, it executes the synchronization command and the cache clearing command in sequence to release the slab objects and page cache of the cloud host;

[0032] The first restriction module is used to obtain environment variables to limit the number of concurrent threads on the host machine and CPU affinity;

[0033] The second restriction module is used to obtain the amount of memory used by the control group to restrict the memory usage of host user processes;

[0034] The second execution module is used to repeatedly execute the first command, and after each execution of the first command, it executes the synchronization command and the clear cache command in sequence to release the host machine's slab objects and page cache;

[0035] The statistics module is used to collect statistics on the execution results of the first file and the first command, and to calculate the average memory bandwidth of the cloud host and the host machine.

[0036] The comparison module is used to calculate the memory performance loss ratio of the cloud host by combining the average memory bandwidth of the cloud host and the host machine.

[0037] Thirdly, this application proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the above-mentioned memory performance loss testing methods.

[0038] Fourthly, this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the above-mentioned memory performance degradation testing methods.

[0039] Fifthly, this application proposes a computer program product, including a computer program that, when executed by a processor, implements any of the above-mentioned memory performance degradation testing methods.

[0040] The aforementioned memory performance testing method and apparatus monitor user processes on both the cloud host and the host machine to keep them both in an idle state. By limiting the number of CPU cores and CPU affinity on the host machine through environment variables and by limiting the memory usage of the host machine during memory performance testing through control groups, the resources involved in memory performance testing on both the cloud host and the host machine are consistent. This ensures the reliability of memory performance degradation testing on both the cloud host and the host machine and provides a more objective and realistic reflection of memory performance degradation. Attached Figure Description

[0041] Figure 1 This is a schematic diagram of the EPT address translation in this application;

[0042] Figure 2 This is one of the graphs showing the impact of STREAM_ARRAY_SIZE on memory bandwidth testing in this application;

[0043] Figure 3 This is the second figure showing the impact of STREAM_ARRAY_SIZE on memory bandwidth testing in this application;

[0044] Figure 4 This is one of the flowcharts for the memory performance loss test method in this application;

[0045] Figure 5 This is the second flowchart of the memory performance loss test method in this application;

[0046] Figure 6 This is the third flowchart of the memory performance loss test method in this application;

[0047] Figure 7 This is the fourth flowchart of the memory performance loss test method in this application;

[0048] Figure 8 This is the fifth flowchart of the memory performance loss test method in this application;

[0049] Figure 9 This is a block diagram of the memory performance loss testing method of this application;

[0050] Figure 10 This is an internal structural diagram of a computer device according to one embodiment. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] like Figure 4 As shown, in one embodiment, a memory performance degradation testing method includes the following steps:

[0053] Step S410: Monitor the user processes of the cloud host and the host machine, and terminate the user processes when the user process load exceeds the first threshold, so that the cloud host and the host machine are in an idle state.

[0054] Specifically, users can use the `top` command to check CPU load. If any user process is found to be using more than 1% of the CPU, it should be killed to ensure the cloud server is operating in an idle state. The available memory of the cloud server should be recorded as M. The number of CPU cores and affinity list of the target cloud server can also be viewed and recorded as C and A respectively using `virshdumpxml`; or the CPU load can be checked using the `top` command, and if any user process is found to be heavily loaded, it should be killed to ensure the host machine is operating in an idle state.

[0055] Step S420: Repeat the execution of the first file, and after each execution of the first file, execute the synchronization command and the clear cache command in sequence to release the slab objects and page cache of the cloud host.

[0056] Specifically, the first file (stream.o file) is executed K times, and after each execution of the first file, `sync` and `echo 3> / proc / sys / vm / drop_caches` are executed sequentially to release the slab objects and page caches of the cloud host. After execution, the results of K times are statistically analyzed, including the Best Rate, Avg time, Min time, and Max time (optimal price, average time, minimum time, and maximum time) metrics for Copy, Scale, Add, and Triad.

[0057] Step S430: Obtain environment variables to limit the number of concurrent threads on the host machine and CPU affinity.

[0058] Step S440: Obtain the control group's settings for limiting the memory usage of host user processes.

[0059] Step S450: Repeat the execution of the first command, and after each execution of the first command, execute the synchronization command and the clear cache command in sequence to release the host machine's slab objects and page cache.

[0060] Specifically, the first command (e.g., `cgexec -g memory:memlimited. / stream.o`) is executed K times. After each execution of the first command, `sync` and `echo 3> / proc / sys / vm / drop_caches` are executed sequentially to release the host machine's slab objects and page cache. After execution, the results of K times are statistically analyzed, including the Best Rate, Avgtime, Min time, and Max time metrics for Copy, Scale, Add, and Triad.

[0061] Step S460: Statistically analyze the execution results of the first file and the first command, and calculate the average memory bandwidth of the cloud host and the host machine.

[0062] Specifically, based on K statistical results, the average memory bandwidth for the four operations (Copy, Scale, Add, Triad) measured on the cloud server was V. copy V scale V add V triad The memory bandwidth of the four operations (Copy, Scale, Add, and Triad) was measured in H on the host machine. copy H scale H add H triad .

[0063] Step S470: Calculate the memory performance loss ratio of the cloud host by combining the average memory bandwidth of the cloud host and the host machine.

[0064] Specifically, cloud server memory performance loss η vopy η scale η add η triad It can be determined by equation (1):

[0065]

[0066] The aforementioned memory performance testing method and apparatus monitor user processes on both the cloud host and the host machine to keep them both in an idle state. By limiting the number of CPU cores and CPU affinity on the host machine through environment variables and by limiting the memory usage of the host machine during memory performance testing through control groups, the resources involved in memory performance testing on both the cloud host and the host machine are consistent. This ensures the reliability of memory performance degradation testing on both the cloud host and the host machine and provides a more objective and realistic reflection of memory performance degradation.

[0067] like Figure 5 As shown, in one embodiment, obtaining environment variables to limit the number of concurrent threads on the host machine and CPU affinity includes the following steps:

[0068] Step S431: Obtain the first environment variable and adjust the first environment variable to make it consistent with the number of threads running in parallel on the host machine.

[0069] Specifically, set the environment variable OMP_NUM_THREADS to limit the number of concurrent threads, i.e., export OMP_NUM_THREADS = C.

[0070] Step S432: Obtain the second environment variable and adjust the second environment variable to make the second environment variable consistent with the host CPU affinity.

[0071] Specifically, set the environment variable GOMP_CPU_AFFINITY to limit CPU affinity, i.e., export GOMP_CPU_AFFINITY = A.

[0072] like Figure 6 As shown, in one embodiment, obtaining a control group to limit the memory usage of host user processes includes the following steps:

[0073] Step S441: Obtain a control group for memory limits.

[0074] Specifically, create a control group for memory limits: `cgcreate -g memory: / memlimited`.

[0075] Step S442: Adjust the available memory quota of the control group to make the available memory quota of the control group consistent with the available memory size of the cloud host.

[0076] Specifically, set the available memory limit in the memlimited control group to be the same as the available memory size of the cloud server.

[0077] It's important to note that there's a crucial parameter in `stream` called `STREAM_ARRAY_SIZE`. The smaller this parameter, the less memory is required for the test. According to the `INSTRUCTIONS` in `stream.c`, the `stream` tool recommends that the array size `STREAM_ARRAY_SIZE` be at least four times the size of the L3 cache (high-speed cache memory); otherwise, the actual test results will reflect cache bandwidth rather than memory bandwidth.

[0078] However, since server caches are generally quite large nowadays, with L3 caches typically exceeding 96MB, smaller cloud servers, such as those with 1 core and 1GB or 1 core and 2GB of RAM, have less than 1GB and 2GB of available memory. If the STREAM_ARRAY_SIZE is set to 4 times the L3 cache size, approaching 100 million, a total of about 2.2GB of memory would be required. This clearly exceeds the cloud server's memory, and a Segmentation fault error will be reported when executing stream tests.

[0079] like Figure 2 and Figure 3As shown, through practical experience in real-world tasks and repeated experiments, it can be seen that a value of STREAM_ARRAY_SIZE less than L3 cache * 4 (right vertical line in the figure) is sufficient to reliably calculate memory bandwidth. Furthermore, when STREAM_ARRAY_SIZE is less than L3 cache divided by the number of numa (left vertical line in the figure), memory bandwidth decreases sharply as STREAM_ARRAY_SIZE increases. This is because the larger the array, the less likely it is to be cached by the system.

[0080] This discovery provides a direction for both avoiding segmentation faults and stably measuring memory bandwidth. However, finding a parameter that can both avoid segmentation faults and stably measure memory bandwidth is not easy, as it often requires searching within a range of several million to hundreds of millions of values. If done by trial and error, it would consume a great deal of time and effort.

[0081] Assuming the host machine has n NUMA nodes, and using binary search combined with execution requirements for automatic searching, the goal is to find a `STREAM_ARRAY_SIZE` between L3 cache / n and 4 * L3 cache as quickly as possible to stabilize memory bandwidth. This value should be as close as possible to L3 cache / n, meaning the parameter should be as small as possible. This allows even small-scale cloud servers with limited memory to perform memory performance tests using stream. By finding the optimal value for `STREAM_ARRAY_SIZE`, the issue of `segmentation fault` errors during stream testing can be overcome, enabling even small-scale cloud servers with limited memory to perform memory performance tests using stream.

[0082] like Figure 7 As shown, in one embodiment, the user process is terminated when the user process load exceeds a first threshold, followed by the following steps:

[0083] Step S710: Calculate the optimal value of the first parameter based on binary search combined with difference judgment. The first parameter is a parameter of the memory testing tool, and the smaller the value of the first parameter, the less memory is required for the test.

[0084] Specifically, since there is an optimal value for STREAM_ARRAY_SIZE (the first parameter), and this optimal value is less than 4 * L3 cache (i.e., four times the server cache) and greater than the ratio of L3 cache to the number of NUMA nodes (i.e., the ratio of server cache to the number of nodes with inconsistent memory access), and the closer this optimal value is to the ratio of L3 cache to the number of NUMA nodes, the better. Using this as a judgment interval and the test results as the basis for judgment, the optimal value of STREAM_ARRAY_SIZE can be found.

[0085] Step S720: Compile the optimal value of the first parameter into the first file.

[0086] Specifically, the optimal value of STREAM_ARRAY_SIZE is compiled into the executable file stream.o by compiling the source code stream.c using the gcc command.

[0087] like Figure 8 As shown, in one embodiment, calculating the optimal value of the first parameter based on binary search combined with difference judgment includes the following steps:

[0088] Step S711: Calculate the first test value of the first parameter using binary search.

[0089] Step S712: Import two second test values ​​with a predetermined difference from the first test value into the memory testing tool and perform the test to determine whether an error (Segmentation fault) occurs, thereby determining the execution range of the subsequent binary search, and stopping the binary search when the number of iterations of the binary search reaches the upper limit or the length of the test value range reaches the lower limit.

[0090] Specifically, assuming the x-coordinate corresponding to L3 cache / n is l0, and the x-coordinate corresponding to 4*L3 cache is r0, in real-world scenarios, both the L3 cache and the number of numeric values ​​n are fixed, therefore l0 and r0 are also deterministic. Assuming the STREAM_ARRAY_SIZE obtained through binary search combined with difference judgment (or the BD algorithm) is N, then N∈(l0,r0]. To quickly find N, the idea of ​​binary search is used to continuously narrow down the range of N.

[0091] Assume that during the k-th binary split, the left and right boundaries are l and l respectively. k r k Then N∈l k ,r k [, k≥0. Intermediate value m] k The calculation is as follows:

[0092] m k =lk +(r k -l k ) / twenty two)

[0093] In the kth time, the setting is... If a Segmentation fault error is reported when the test is executed via stream, then l is updated according to equation (5). k r k Then perform the binary split again; otherwise, record the measured bandwidth of the Copy, Scale, Add, and Triad operations. To measure m k The stability of memory bandwidth at m k near m k Memory bandwidth tests were performed on ±α respectively, and 2α is the interval length; α should satisfy the following condition:

[0094] α≤r k -m k =m k -l k =lg(4n) / 2 k+1 (3)

[0095] For m k The test results at ±α are differentially processed to measure the stability of the memory bandwidth test.

[0096]

[0097] in, These represent the stability of the k-th Copy, Scale, Add, and Triad operations, respectively. The smaller the value, the better the stability.

[0098] Assuming ε is the stability threshold, then the left and right boundaries l in the (k+1)th iteration... k+1 r k+1 The following is confirmed:

[0099]

[0100] Assuming the upper limit of the number of binary search iterations is L, and the lower limit of the lengths of the left and right boundaries is θ, the binary search ends when the following condition is met; otherwise, the iteration continues:

[0101] k≥L or r k -l k ≤θ (6)

[0102] When equation (6) above is satisfied, then m k That is, the optimized parameters, i.e., STREAM_ARRAY_SIZE can be determined as follows:

[0103] The above memory performance testing method, based on full consideration of CPU core count, CPU affinity, memory usage quota, NUMA resource consistency, etc., proposes a STREAM_ARRAY_SIZE adaptive optimization algorithm (hereinafter referred to as BD algorithm) that combines binary search and differential judgment. It effectively avoids the shortcomings of the stream tool and the inefficient method of manual trial and error, improves the efficiency and reliability of memory performance loss testing, and provides an important indicator for cloud host performance loss testing, performance tuning, VMM evaluation, etc.

[0104] like Figure 9 As shown, in one embodiment, a memory performance degradation testing device includes a monitoring module 910, a first execution module 920, a first limiting module 930, a second limiting module 940, a second execution module 950, a statistics module 960, and a comparison module 970.

[0105] The monitoring module 910 is used to monitor the user processes of the cloud host and the host machine, and terminate the user processes when the user process load exceeds the first threshold, so that the cloud host and the host machine are in an idle state.

[0106] The first execution module 920 is used to repeatedly execute the first file, and after each execution of the first file, it sequentially executes the synchronization command and the clear cache command to release the slab objects and page cache of the cloud host.

[0107] The first restriction module 930 is used to obtain environment variables to limit the number of concurrent threads on the host machine and CPU affinity.

[0108] The second restriction module 940 is used to obtain the amount of memory used by the control group to limit the memory usage of host user processes.

[0109] The second execution module 950 is used to repeatedly execute the first command, and after each execution of the first command, it sequentially executes the synchronization command and the clear cache command to release the host machine's slab objects and page cache.

[0110] The statistics module 960 is used to collect statistics on the execution results of the first file and the first command, and to calculate the average memory bandwidth of the cloud host and the host machine.

[0111] Comparison module 970 is used to calculate the memory performance loss ratio of the cloud host by combining the average memory bandwidth of the cloud host and the host machine.

[0112] In one embodiment, the first limiting module 930 is specifically used to obtain a first environment variable and adjust the first environment variable to make the first environment variable consistent with the number of parallel threads on the host machine; obtain a second environment variable and adjust the second environment variable to make the second environment variable consistent with the CPU affinity of the host machine.

[0113] In one embodiment, the second limiting module 940 is specifically used to obtain a control group for memory limiting; and adjust the available memory quota of the control group to make the available memory quota of the control group consistent with the available memory size of the cloud host.

[0114] In one embodiment, the memory performance loss testing device further includes a search module, which is used to calculate the optimal value of the first parameter based on binary search combined with difference judgment. The first parameter is a parameter of the memory testing tool, and the smaller the value of the first parameter, the less memory is required for the test; and compiles the optimal value of the first parameter into the first file.

[0115] In one embodiment, the search module is specifically used to calculate the first test value of the first parameter based on the binary search; import two second test values ​​with a predetermined difference from the first test value into a memory test tool and perform the test, determine whether an error occurs, thereby determining the execution range of the subsequent binary search, and stop the binary search when the number of iterations of the binary search reaches the upper limit or the length of the test value range reaches the lower limit.

[0116] In one embodiment, a computer device is provided, which may be a smart terminal, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a memory performance degradation testing method.

[0117] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0118] In one embodiment, a computer device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above-described method embodiments. In another embodiment, a computer storage medium stores a computer program, the computer program being executed by a processor to implement the steps in the above-described method embodiments.

[0119] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0120] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0121] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0122] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for testing memory performance degradation, characterized in that, The method includes: Monitor the user processes of the cloud host and the host machine, and terminate the user processes when the load of the user processes exceeds a first threshold, so that the cloud host and the host machine are in an idle state. Repeatedly execute the first file, and after each execution of the first file, execute the synchronization command and the clear cache command in sequence to release the slab objects and page cache of the cloud host; Obtain environment variables to limit the number of concurrent threads on the host machine and CPU affinity; The acquisition control group is used to limit the memory usage of host user processes, specifically including: Obtain a control group for memory limits; adjust the available memory quota of the control group to match the available memory size of the cloud host; Repeat the first command, and after each execution of the first command, execute the synchronization command and the clear cache command in sequence to release the host machine's slab objects and page cache; The execution results of the first file and the first command are statistically analyzed, and the average memory bandwidth of the cloud host and the host machine is calculated. The memory performance loss ratio of the cloud server is calculated by combining the average memory bandwidth of the cloud server and the host machine.

2. The memory performance degradation testing method according to claim 1, characterized in that, The acquisition of environment variables used to limit the number of concurrent threads on the host machine and CPU affinity includes: Obtain the first environment variable and adjust the first environment variable to make it consistent with the number of threads running in parallel on the host machine; Obtain the second environment variable and adjust it to make it consistent with the host CPU affinity.

3. The memory performance degradation test method according to claim 2, characterized in that, The step of terminating the user process when the user process load exceeds a first threshold further includes: The optimal value of the first parameter is calculated by combining binary search with difference judgment. The first parameter is a parameter of the memory testing tool, and the smaller the value of the first parameter, the less memory is required for the test. Compile the optimal value of the first parameter into the first file.

4. The memory performance degradation test method according to claim 3, characterized in that, The optimal value of the first parameter is less than four times the server cache and greater than the ratio of the server cache to the number of nodes with inconsistent memory access.

5. The memory performance degradation test method according to claim 4, characterized in that, The step of calculating the optimal value of the first parameter based on binary search combined with difference judgment includes: The first test value of the first parameter is obtained by calculating using binary search. Two second test values ​​with a predetermined difference from the first test value are imported into a memory testing tool and tested. The test is performed to determine whether an error occurs, thereby determining the execution range of the subsequent binary search. The binary search is stopped when the number of iterations of the binary search reaches the upper limit or the length of the test value range reaches the lower limit.

6. A memory performance degradation testing device, characterized in that, The device includes: The monitoring module is used to monitor the user processes of the cloud host and the host machine, and terminate the user process when the load of the user process exceeds a first threshold, so that the cloud host and the host machine are in an idle state. The first execution module is used to repeatedly execute the first file, and after each execution of the first file, it executes the synchronization command and the cache clearing command in sequence to release the slab objects and page cache of the cloud host; The first restriction module is used to obtain environment variables to limit the number of concurrent threads on the host machine and CPU affinity; The second restriction module is used to obtain a control group for limiting the memory usage of host machine user processes. Specifically, it includes: obtaining a control group for memory restriction; and adjusting the available memory quota of the control group to make the available memory quota of the control group consistent with the available memory size of the cloud host. The second execution module is used to repeatedly execute the first command, and after each execution of the first command, it executes the synchronization command and the clear cache command in sequence to release the host machine's slab objects and page cache; The statistics module is used to collect statistics on the execution results of the first file and the first command, and to calculate the average memory bandwidth of the cloud host and the host machine. The comparison module is used to calculate the memory performance loss ratio of the cloud host by combining the average memory bandwidth of the cloud host and the host machine.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.