Test method, device and electronic equipment for server component
By allocating different test resources to server components through parallel testing, the problem of low efficiency in serial testing is solved, achieving efficient resource utilization and improved fault detection rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, serial testing of server components increases time costs, reduces testing efficiency, and fails to fully utilize system resources, resulting in resource waste.
Parallel testing is adopted, which involves allocating different test resources to different component categories and calling the corresponding threads for each component category to perform stress performance tests, thereby avoiding resource conflicts and making full use of system resources.
It improves the testing efficiency of server components, avoids resource waste, and can simulate the high-pressure load conditions when various components are tested concurrently, thereby improving the fault detection rate.
Smart Images

Figure CN119829344B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of testing, in particular to a test method and device for server components and an electronic device. BACKGROUND
[0002] For a server, memory, a network card, a central processing unit (CPU), a hard disk, and a graphics processing unit (GPU) are five major components of the server. The quality reliability of the five major components in the server can affect the overall quality reliability of the server. Therefore, to ensure the quality reliability of the server, at least the five major components in the server need to be subjected to corresponding stress performance tests before the server is shipped. Currently, in actual applications, the stress performance tests are usually performed on the five major components in the server in sequence through a serial test mode. However, the serial test mode increases the time cost and reduces the test efficiency. SUMMARY
[0003] Therefore, the present application provides a test method and device for server components and an electronic device to improve the test efficiency.
[0004] The present application provides a test method for server components, which is applied to a server. The method comprises the following steps.
[0005] When a performance test instruction is received, test resources for performance tests are respectively allocated to at least N component categories in the server based on the performance test instruction, wherein N is greater than 1, and different component categories are allocated different test resources.
[0006] For each component category, a thread corresponding to the component category is called to enable the thread to perform stress performance tests on each component in the component category by using the test resources allocated to the component category for performance tests, wherein different component categories correspond to different threads, and the threads corresponding to the N component categories perform the stress performance tests in parallel.
[0007] The present application also provides a test device for server components, which is applied to a server. The device comprises the following modules.
[0008] The allocation module is configured to, when a performance test instruction is received, allocate test resources for performance tests to at least N component categories in the server based on the performance test instruction, wherein N is greater than 1, and different component categories are allocated different test resources.
[0009] The testing module is used to call the thread corresponding to each component category that has been started for each component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category; wherein, at least two different component categories correspond to different threads; the threads corresponding to N component categories execute the stress performance test in parallel.
[0010] This application also provides an electronic device, which includes:
[0011] Processor; and
[0012] A computer-readable storage medium storing computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method described above.
[0013] This application also provides a computer-readable storage medium storing computer program instructions that, when executed by a processor, cause the processor to perform the steps in the above method.
[0014] As can be seen from the above technical solutions, in this embodiment, when a performance test instruction is received, test resources for performance testing are first allocated to at least N component categories in the server. Different component categories are allocated different test resources, which avoids resource usage conflicts, fully utilizes system resources, improves system resource utilization, and avoids resource waste. Based on this, threads corresponding to each component category can be invoked, utilizing the test resources allocated to each component category to perform stress performance tests on the components in each component category in parallel. This parallel testing method in this embodiment not only effectively improves the testing efficiency of server components, avoiding the high time cost and low testing efficiency problems caused by serial testing, but also simulates the high-pressure load generated during concurrent testing of various components, thus effectively improving the fault detection rate of server components. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this application, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0016] Figure 1 This is a schematic diagram of the method flow provided in the embodiments of this application.
[0017] Figure 2 This is a schematic diagram of another method flow provided for an embodiment of this application.
[0018] Figure 3 This is a schematic diagram of another method flow provided in an embodiment of this application.
[0019] Figure 4 This is a schematic diagram of the device structure provided in the embodiments of this application.
[0020] Figure 5 This is a schematic diagram of the electronic device structure provided in an embodiment of this application. Detailed Implementation
[0021] As described above, related technologies employ a serial testing approach to sequentially perform stress performance tests on server components (such as network cards, hard drives, GPUs, CPUs, and memory). Specifically, this involves using the same thread to perform stress performance tests on each component of the server sequentially. However, this serial testing approach not only increases testing costs, such as time costs, and reduces testing efficiency, but also leads to resource waste because each component is stress-tested individually, resulting in underutilization of system resources. Therefore, to address this technical problem, this embodiment provides a server component testing method. By calling the threads corresponding to each component category, and utilizing the test resources allocated to each component category for performance testing, stress performance tests are performed on the components in each component category in parallel, thereby achieving stress performance testing of each component in the server. This not only effectively improves the testing efficiency of server components, avoiding the high time costs and low testing efficiency problems caused by the serial testing approach, but also fully utilizes system resources for testing, improving system resource utilization and avoiding resource waste. Furthermore, this parallel testing method can simulate the high-pressure load generated when each component is tested concurrently, thus improving the fault detection rate of server components.
[0022] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.
[0023] See Figure 1 , Figure 1 This is a flowchart illustrating a method provided in an embodiment of this application. As one embodiment, the method is applied to a server; this method can be used to perform stress performance tests on components in the server, such as network interface cards, hard drives, GPUs, CPUs, and memory.
[0024] like Figure 1 As shown, the process may include the following steps:
[0025] Step 101: When a performance test instruction is received, test resources for performance testing are allocated to at least N component categories in the server based on the performance test instruction; where N is greater than 1.
[0026] In this embodiment, upon receiving a performance test instruction, test resources for performance testing are first allocated to at least N component categories in the server based on the performance test instruction. These resources are then used to perform parallel stress performance tests on each component category using the allocated test resources. To avoid resource usage conflicts, different component categories are allocated different test resources. The performance test instruction can be manually triggered, for example; this embodiment is not specifically limited to this.
[0027] In this embodiment, as one example, the aforementioned at least N component categories may be information obtained from the aforementioned performance test instructions. Alternatively, the component categories existing in the server may be obtained through instructions for obtaining component categories existing in the server, and then component categories matching the specified component categories may be selected from the obtained component categories as the aforementioned at least N component categories; wherein, the specified component categories may include, for example, network card categories, hard disk categories, GPU categories, CPU categories, and / or memory categories, etc., which are not specifically limited here.
[0028] As for how to allocate test resources for performance testing to at least N component categories in the server based on the performance test instructions in this step, examples will be given below, and will not be elaborated here.
[0029] Step 102: For each component category, call the thread corresponding to that component category that has been started, so that the thread corresponding to that component category can use the test resources allocated for performance testing of that component category to perform stress performance testing on each component in that component category; wherein, at least two different component categories correspond to different threads; the threads corresponding to N component categories execute the stress performance test in parallel.
[0030] In this embodiment, each component in any component category can be understood as each component in the server that belongs to that component category; for example, for the network card category, each component in the network card category can refer to each network card in the server; for another example, for the hard disk category, each component in the hard disk category can refer to each hard disk in the server; and so on.
[0031] In this embodiment, at least two different component categories correspond to different threads. As one example, assuming multiple different component categories correspond to the same thread, the thread corresponding to multiple different component categories can sequentially utilize the test resources allocated to each component category to perform stress performance tests on each component within that category. Conversely, a thread corresponding to one component category can utilize the test resources allocated to that component category to perform stress performance tests on each component within that category. The threads corresponding to the aforementioned N component categories execute stress performance tests in parallel; that is, different threads execute stress performance tests in parallel.
[0032] For example, suppose the above N component categories are network interface card (NIC) category, hard drive category, GPU category, CPU category, and memory category; wherein the NIC category and hard drive category correspond to the same thread (denoted as thread 1), and the GPU category, CPU category, and memory category each correspond to a thread (denoted as thread 2, thread 3, and thread 4, respectively); then for the NIC category and hard drive category, the stress performance tests of each component in these two component categories can be performed sequentially through thread 1; for example, thread 1 can first use the test resources allocated to the NIC category to perform stress performance tests on each component in the NIC category, and then thread 1 can use the test resources allocated to the hard drive category to perform stress performance tests on each component in the hard drive category. Of course, this example is only for illustrative purposes, and the stress performance tests of each component in the hard drive category can also be performed first, and then the stress performance tests of each component in the NIC category can be performed. This embodiment is not specifically limited.
[0033] For the GPU category, thread 2 corresponding to the GPU category can be used to perform performance stress tests on each component within the GPU category using the test resources allocated to that category. The CPU and memory categories are similar to the GPU category and will not be elaborated upon here.
[0034] Among them, threads 1, 2, 3 and 4 are executed in parallel for stress performance testing.
[0035] As for how to specifically call the thread corresponding to each component category for each component category in this step, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, examples will be given below, and will not be elaborated here.
[0036] This concludes the process. Figure 1 The process is shown below.
[0037] pass Figure 1As shown in the flowchart, in this embodiment, when a performance test instruction is received, test resources for performance testing are first allocated to at least N component categories in the server. Different component categories are allocated different test resources, which avoids resource usage conflicts, fully utilizes system resources, improves system resource utilization, and avoids resource waste. Based on this, threads corresponding to each component category can be invoked to perform stress performance tests on the components in each component category in parallel using the allocated test resources. This parallel testing method in this embodiment not only effectively improves the testing efficiency of server components, avoiding the high time cost and low testing efficiency problems caused by serial testing, but also simulates the high-pressure load generated during concurrent testing of various components, thus effectively improving the fault detection rate of server components.
[0038] The following is a further description of step 101 above:
[0039] First, let's describe the test resources:
[0040] In this embodiment, test resources for performance testing can be allocated from the server's system resources for each component category. For example, as an embodiment, test resources can be allocated from the logical cores and memory resources of the CPU in the server for each component category. Here, a logical core refers to a core virtualized by each physical core of the CPU based on hyper-threading technology, where each physical core can correspond to multiple virtual logical cores. Memory resources refer to the available memory resources provided by memory components in the server, such as memory modules.
[0041] As for the hard drive, GPU, and network card resources in the server, they are typically only provided to the corresponding components for testing, and other components do not actively consume them. For example, hard drive resources are only provided to the hard drive for testing, and other components generally do not actively consume them. Even if the server's memory resources are insufficient, the server's operating system will perform virtual memory (i.e., swap) processing to obtain virtual memory for other components to use for testing. Furthermore, this embodiment also pre-calculates and allocates the test resources needed by each component; therefore, the situation of insufficient server-provided memory resources is unlikely to occur. Similar to hard drive resources, GPU resources are only provided to the GPU for testing, and network card resources are only provided to the network card for testing.
[0042] Based on the above description, as an example, the test resources allocated to each component category include at least the CPU's logical cores and memory resources. To avoid resource usage conflicts, different component categories are allocated different test resources; that is, different component categories are allocated different logical cores and different memory resources.
[0043] The following describes how to allocate test resources for performance testing for at least N component categories in a server:
[0044] First, the test resource allocation for network card type, hard drive type, and GPU type is described:
[0045] As an example, if a component category is any one of a network card category, a hard disk category, and a GPU category, then the logical kernel allocated to that component category is determined from all logical kernels of the server; and the memory resources allocated to that component category are determined from all memory resources of the server based on the logical kernel allocated to that component category.
[0046] In this embodiment, assuming that at least N component categories include network card category, hard disk category, and / or GPU category, test resources are allocated to network card category, hard disk category, and / or GPU category in sequence; as for the allocation order of test resources for network card category, hard disk category, and / or GPU category, this embodiment does not specifically limit it.
[0047] For example, assuming that at least N component categories include network interface card (NIC) categories, hard drive categories, and GPU categories, test resources can be allocated to NIC categories, hard drive categories, and GPU categories in sequence. Specifically, for example, the NIC, hard drive, and GPU categories are traversed sequentially, and the traversed component category is taken as the current component category; then, a logical kernel is allocated to the current component category from the server's currently unallocated logical kernels; and based on the logical kernel allocated to the current component category, memory resources are allocated to the current component category from the server's currently unallocated memory resources.
[0048] In this embodiment, there are many specific implementation methods for determining the logical kernel assigned to the component category from all logical kernels of the server. For example, as an embodiment, the logical kernel assigned to the component category is determined from all logical kernels of the server based on the kernel allocation information configured for that component category. The specific content of the kernel allocation information is not specifically limited here; for example, the kernel allocation information may include a kernel allocation ratio such as 10% or 15%.
[0049] For example, as another embodiment, based on the application requirements of the component category, the logical cores allocated to the component category are determined from all logical cores of the server; wherein, the application requirements of the component category may refer to, for example, if the component category is a network card category, then the number of logical cores allocated to the component category is 1, and if the component category is a hard disk category or a GPU category, then the number of logical cores allocated to the component category is related to the number of components in the component category.
[0050] Here, the number of logical cores assigned to the component category is related to the number of components in the component category. For example, it can mean that the number of logical cores assigned to the component category is the same as the number of components in the component category. This embodiment does not specifically limit this.
[0051] In this embodiment, as one example, the above-mentioned logical kernel based on the allocation of the component category determines the memory resources allocated to the component category from all memory resources of the server. In a specific implementation, for example, if the component category is a network card category, then according to the configured memory allocation information of the network card category, memory resources are allocated to the network card category from all memory resources of the server.
[0052] If the component category is a hard disk, then L test processes are called through the thread corresponding to the hard disk category, and memory resources are allocated to the L test processes respectively based on the configured system memory allocation mechanism. Here, the memory resources allocated to the L test processes can be regarded as the memory resources allocated to the hard disk category; where L is greater than or equal to 1, and L is related to the number of hard disks in the hard disk category.
[0053] If the component category is GPU, then P test processes are invoked through the thread corresponding to the GPU category, and memory resources are allocated to each of the P test processes based on the configured system memory allocation mechanism. Here, the memory resources allocated to the P test processes can be considered as the memory resources allocated to the GPU category; where P is greater than or equal to 1, and P is related to the number of GPUs in the GPU category.
[0054] In this embodiment, L is related to the number of hard drives in that hard drive category, for example, L being the same as the number of hard drives in that category; this embodiment is not specifically limited. Similarly, P is related to the number of GPUs in that GPU category, and will not be elaborated further here.
[0055] The following describes the test resource allocation for CPU and memory categories:
[0056] As an example, if a component category is a CPU category or a memory category, the logical kernel allocated to that component category is determined from the first kernel resources; and the memory resources allocated to that component category are determined from the first memory resources. Here, the first kernel resources and the first memory resources refer to the unallocated logical kernels and memory resources remaining after all test resources have been allocated to each of the N component categories other than the CPU and memory categories.
[0057] In this embodiment, the specific implementation of determining the logical kernel allocated to the component category from the first kernel resources may include: firstly, determining the second kernel resource based on the difference between the first kernel resource and the reserved kernel resource, such as using the difference between the first kernel resource and the reserved kernel resource as the second kernel resource; then, determining the logical kernel allocated to the component category from the second kernel resource based on the kernel allocation information configured for that component category. The reserved kernel resource is used by the server's operating system; the reserved kernel resource is less than the first kernel resource.
[0058] In this embodiment, the reserved kernel resources can be determined based on the second kernel resources. This embodiment does not specifically limit how the reserved kernel resources are determined based on the first kernel resources; for example, a specified number of logical kernels can be selected from the first kernel resources as reserved kernel resources; this specified number could be 2 or 3, etc., and this embodiment is not limited to this. Alternatively, the reserved kernel resources can be dynamically determined; specifically, multiple reference kernel ranges can be pre-configured, each reference kernel range corresponding to a quantity; based on this, it can be determined which reference kernel range the number of logical kernels of the first kernel resources falls within, and the quantity corresponding to the reference kernel range where the number of logical kernels of the first kernel resources falls can be used as a reference quantity to select a reference quantity of logical kernels from the first kernel resources as reserved kernel resources; and so on.
[0059] In this embodiment, determining the memory resources allocated to the component category from the first memory resources may, for example, include: first determining the second memory resources based on the difference between the first memory resources and the reserved memory resources, such as using the difference between the first memory resources and the reserved memory resources as the second memory resources; then, determining the memory resources allocated to the component category from the second memory resources based on the memory allocation information configured for that component category. The reserved memory resources are used by the server's operating system; the reserved memory resources are less than the first memory resources.
[0060] In this embodiment, the reserved memory resources are determined based on the first memory resources. This embodiment does not specifically limit how the reserved memory resources are determined based on the first memory resources; for example, a memory resource of a specified size can be selected from the first memory resources as the reserved memory resources; the specified memory size could be 5G or 10G, etc., and this embodiment is not limited to this. Alternatively, the reserved memory resources can be dynamically determined; specifically, multiple reference memory ranges can be pre-configured, each reference memory range corresponding to a memory size; based on this, it can be determined which reference memory range the memory size of the first memory resource falls within, and the memory size corresponding to the reference memory range containing the memory size of the first memory resource can be used as the reference memory size, so that a memory resource of the reference memory size can be selected from the first memory resources as the reserved memory resources; and so on.
[0061] This completes the further description of step 101 above. Step 102 above will now be described in further detail:
[0062] In this embodiment, the method of calling the thread corresponding to the already started component category for any component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, is different from the method for the other component categories among the N component categories.
[0063] As an example, if the component category is a network interface card (NIC) category, then the test resources allocated for performance testing for that NIC category include one logical core and the memory resources allocated for that NIC category. Based on this, see [link to relevant documentation]. Figure 2 As shown, if the component category is a network interface card (NIC) category, the above-mentioned call will activate the thread corresponding to that component category, so that the thread corresponding to that component category can use the test resources allocated for performance testing of that component category to perform stress performance testing on each component in that component category. In specific implementation, the following steps may be included:
[0064] Step 201: Traverse each network card in the network card category in order, and take the traversed network card as the current network card.
[0065] In this embodiment, the traversal order of each network card in the network card category is not specifically limited. For example, the traversal order of each network card can be determined by the order of the network card identifiers (such as network card 1, network card 2, network card 3, ..., etc.) from largest to smallest (or from smallest to largest); or, the traversal order of each network card can be configured in advance based on actual needs.
[0066] Step 202: Call M test processes through the thread corresponding to the network card category, where M is greater than or equal to 1 and M is related to the network interface of the current network card; so that the M test processes use the logical kernel and memory resources allocated to the network card category to perform stress performance tests on the M network interfaces of the current network card respectively.
[0067] In this embodiment, the thread corresponding to any component category does not occupy logical kernel and memory resources; it is equivalent to a test tool used to call the test process. This embodiment does not specifically limit the creation of threads corresponding to any component category.
[0068] The test process invoked by the thread corresponding to this network interface card (NIC) type can be, for example, the Internet performance evaluation (Iperf) process, etc., but this is not specifically limited. The Iperf process can simulate network data traffic for the NIC to transmit data, thereby verifying the NIC's network performance and performing stress performance testing.
[0069] In this embodiment, M is related to the number of network interface cards (NICs) of the current NIC. For example, M could mean that M is the same as the number of NICs of the current NIC, but this is not specifically limited here. The M test processes can be executed in parallel or serially, and this is also not specifically limited here.
[0070] In this embodiment, for any network card in this network card category, the test process of the previously tested network card can be reused for stress performance testing of that network card, without having to create or call it repeatedly, which can improve testing efficiency.
[0071] As an example, if the component category is a hard disk category, the test resources allocated to the hard disk category for performance testing include L logical cores and the memory resources allocated to the hard disk category; wherein, L is greater than or equal to 1; L is related to the number of hard disks in the hard disk category.
[0072] Based on this, the above-mentioned call to the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category, may include, for example, calling L test processes through the thread corresponding to the hard disk category, so that the L test processes can use the L logical kernels and memory resources allocated to the hard disk category to perform stress performance testing on the L hard disks in the hard disk category respectively.
[0073] In this embodiment, the aforementioned method of having L test processes use the L logical kernels and memory resources allocated to each of the L hard drives in that hard drive category to perform stress performance tests can be implemented as follows: First, allocate one logical kernel from the L logical kernels allocated to that hard drive category to each of the L test processes, with different logical kernels allocated to different test processes; and then allocate one hard drive from the L hard drives to each of the L test processes, with different hard drives allocated to different test processes; subsequently, have each of the L test processes use the logical kernel and memory resources allocated to it to perform stress performance tests on the hard drive to which it was assigned. Here, the L test processes are executed in parallel. As described above, the memory resources allocated to the test process can refer to those allocated to the test process based on the system memory allocation mechanism when allocating memory resources for the hard drive category.
[0074] In this embodiment, the test process called by the thread corresponding to this hard drive category could be, for example, a Flexible I / O tester (Fio) process, etc., but this is not specifically limited. Here, I / O is an abbreviation for Input / Output. The Fio process can verify the hard drive's data processing performance by simulating data read and write operations, thus achieving stress performance testing of the hard drive.
[0075] As an example, if the component category is a GPU category, the test resources allocated to the GPU category for performance testing include P logical cores and the memory resources allocated to the GPU category; wherein, P is greater than or equal to 1; P is related to the number of GPUs in the GPU category.
[0076] Based on this, the above-mentioned call to the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category, may include, for example, calling P test processes through the thread corresponding to the GPU category, so that the P test processes can use the P logical cores and memory resources allocated to the GPU category to perform stress performance testing on the P GPUs in the GPU category respectively.
[0077] In this embodiment, the test process invoked by the thread corresponding to this GPU category can be, for example, the Data Center GPU Manager (Dcgm) process, etc., and is not specifically limited here. The Dcgm process can verify the GPU's computing performance by simulating a large number of GPU-related data computation tasks, thus achieving stress performance testing of the GPU.
[0078] As for how to make P test processes use the P logical cores and memory resources allocated to the GPU category to perform stress performance tests on the P GPUs in that GPU category, it is similar to how to make L test processes use the L logical cores and memory resources allocated to the hard disk category to perform stress performance tests on the L hard disks in that hard disk category, and will not be repeated here.
[0079] In this embodiment, when the component category is CPU, the logical kernels in the test resources allocated to that CPU category are related to the CPUs within that CPU category; similarly, when the component category is memory, the memory resources in the test resources allocated to that memory category are related to the memory within that memory category. Therefore, for any component category, whether CPU or memory, calling the test process through the thread corresponding to that component category to run the test process using the logical kernels and memory resources allocated to that component category can be considered as implementing stress performance testing for the components within that component category.
[0080] Based on the above description, as an example, if the component category is a CPU category, then the test resources allocated to the CPU category for performance testing include X logical cores and the memory resources allocated to the CPU category; wherein, X is greater than or equal to 1.
[0081] The above-mentioned call activates the thread corresponding to the component category, enabling the thread corresponding to the component category to utilize the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category. In specific implementation, this may include: calling X test processes through the thread corresponding to the CPU category, using the X logical cores and memory resources allocated to the CPU category to run X test processes in parallel, thereby achieving stress performance testing on each CPU in the CPU category.
[0082] In this embodiment, the test process invoked by the thread corresponding to this CPU category can be, for example, the stress-ng process, etc., and is not specifically limited here. The stress-ng process can verify the CPU's computing performance by simulating a large number of CPU-related data computation tasks, thus achieving CPU stress performance testing.
[0083] As an example, if the component category is a memory category, then the test resources allocated for performance testing to the memory category include Y logical cores and the memory resources allocated to the memory category; wherein Y is greater than or equal to 1;
[0084] The above-mentioned call activates the thread corresponding to the component category, enabling the thread corresponding to the component category to utilize the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category. In specific implementation, this may include: calling Y test processes through the thread corresponding to the memory category, using the Y logical kernels and memory resources allocated to the memory category to run Y test processes in parallel, thereby achieving stress performance testing on each memory in the memory category.
[0085] In this embodiment, the test process invoked by the thread corresponding to the memory category can be, for example, a memory test (memtester) process, etc., which is not specifically limited here. The memtester process can verify the memory's data processing performance by simulating a large number of data read and write operations, thus achieving memory stress performance testing.
[0086] It should be noted that the test duration for pressure performance testing corresponding to each of the above component categories can be as indicated by the performance test instruction or it can be pre-configured; this embodiment does not specifically limit it.
[0087] In this embodiment, as one example, a test configuration file can be pre-configured. The specific content of the test configuration file is not specifically limited and can be flexibly set based on actual application requirements. For example, as one example, the test configuration file includes at least the number of test rounds and the test information corresponding to each round of testing; the test information corresponding to any round of testing includes at least one component category that needs to be tested in that round of testing and the test duration required for that round of testing.
[0088] Based on the above description, in this embodiment, when at least N component categories are the component categories that need to be tested in the current Z-th round; where Z is greater than or equal to 1; the thread runtime of the thread corresponding to each of the at least N component categories in the current Z-th round is less than or equal to the test duration required for the current Z-th round. This embodiment can effectively improve testing efficiency by running the threads corresponding to each component category to be tested in parallel in each round of testing.
[0089] In this embodiment, as one example, the component categories to be tested in different rounds of testing can be the same or different. Based on this, when each round of testing is triggered, test resources for performance testing need to be reallocated for each component category to be tested in that round of testing; and at the end of that round of testing, all test resources allocated for each component category to be tested in that round of testing are reclaimed.
[0090] This embodiment allows for the configuration of component categories and test durations for each round of testing based on actual application requirements through a test configuration file. This enables dynamic time-sharing control of the load on components within each component category being tested on the server, improving testing flexibility. For example, taking two rounds of testing as an example, one round tests CPU and memory components for 1 hour, while the other round tests network cards, hard drives, GPUs, CPUs, and memory components for 5 hours. In this case, the load on each component in each component category in the first round is significantly lower than the load on each component in each component category in the second round.
[0091] To facilitate understanding of the specific implementation process of the testing methods for the server components described above, the following examples illustrate this process:
[0092] This application proposes a hybrid stress testing tool for server components. This tool is used to perform parallel stress performance tests on server components such as memory, network cards, CPU, hard disk, and GPU, thereby improving testing efficiency and detection rate and reducing testing costs.
[0093] As an example, see Figure 3 The flowchart shown illustrates a test method applied to a server, which may include the following steps:
[0094] Step 301: When a performance test instruction is received, obtain the mode configuration parameters used to indicate the test execution mode of the stress test, and parse the parameters.
[0095] In this embodiment, the aforementioned mode configuration parameters can be those indicated by the performance test command or parameters pre-configured manually in the software program corresponding to the hybrid load testing tool. For example, the mode configuration parameter is "-t:time", where the -t field indicates that the test execution mode for this test is the first execution mode, i.e., the automatic execution mode, and the time field indicates the required test duration, such as 6 hours, 12 hours, or 24 hours. As another example, the mode configuration parameter is "-f:file", where the -f field indicates that the test execution mode for this test is the second execution mode, i.e., the mode that uses a test configuration file to perform the stress performance test, and the file field indicates the file storage location of the test configuration file.
[0096] If parameter parsing is abnormal, such as the time field in the mode configuration parameter "-t:time" being 0, or the file field in the mode configuration parameter "-f:file" being empty, etc., then an error message indicating an abnormal mode configuration parameter will be output to alert relevant technical personnel. If parameter parsing is normal, step 302 can be continued.
[0097] Step 302: Check if the installation packages related to the server components are installed correctly. If yes, proceed to step 303; otherwise, output an indication that the installation packages related to the server components are not installed correctly.
[0098] In this embodiment, five component categories—memory, network card, CPU, hard disk, and GPU—are used as examples. For each component category, the installation package related to that category may include, for example, the installation package of the corresponding testing tool and auxiliary plugins. This embodiment is not specifically limited to these categories. The testing tool corresponding to any component category can be understood as a testing tool used for stress performance testing of that component category. Here, the testing tool corresponding to any component category can be considered to refer to the testing tool described above for invoking the testing process.
[0099] Step 303: Check if the Irq service is enabled; if yes, proceed to step 304; otherwise, enable the Irq service and proceed to step 304.
[0100] In this embodiment, Irq is an abbreviation for Interrupt Request. Irq service refers to the mechanism by which the operating system interrupts the currently executing task when it receives an interrupt request sent by a hardware device, in order to respond to and process these interrupt requests.
[0101] Because stress tests for different network card types, hard drive types, and GPU types may trigger interrupt requests due to the use of peripherals, which could cause the server's operating system to freeze due to the inability to handle the interrupt requests, it is necessary to enable the IRQ service in advance.
[0102] Step 304: If the test execution mode is determined to be the first execution mode based on the above mode configuration parameters, then for each component category among the network card category, hard disk category, and GPU category, based on the application requirements of that component category, determine the logical kernel allocated to that component category from all logical kernels of the server; and based on the logical kernel allocated to that component category, determine the memory resources allocated to that component category from all memory resources of the server. Proceed to step 305.
[0103] As for how to determine the logical kernel allocated to this component category from all logical kernels of the server based on the application requirements of this component category, and how to determine the memory resources allocated to this component category from all memory resources of the server based on the logical kernel allocated to this component category, please refer to the relevant descriptions above, which will not be repeated here.
[0104] Step 305: For each component category within the CPU and memory categories, allocate a logical kernel from the first kernel resource and allocate memory resources from the first memory resource for that component category. Proceed to step 306.
[0105] As for how to allocate logical kernels from the first kernel resources and memory resources from the first memory resources for this component category, please refer to the relevant descriptions above, which will not be repeated here.
[0106] Step 306: For each component category that needs to be tested in this test, call the thread corresponding to that component category that has been started, so that the thread corresponding to that component category can use the test resources allocated for performance testing of that component category to perform stress performance testing on each component in that component category.
[0107] The component categories to be tested in this test refer to at least N of the above-mentioned component categories.
[0108] Step 307: If the test execution mode is determined to be the second execution mode based on the above mode configuration parameters, then obtain the test configuration file and verify it. If the test configuration file verification is successful, proceed to step 308.
[0109] In this embodiment, the test configuration file includes at least the number of test rounds and the test information corresponding to each round of testing; the test information corresponding to any round of testing includes at least one component category that needs to be tested in that round of testing, the test duration required for that round of testing, and the kernel allocation ratio and memory allocation ratio of at least one component category, etc.
[0110] In this embodiment, the verification test configuration file may include, for example, checking whether the test duration of each round of testing is abnormal, such as being 0 or negative; whether the sum of the kernel allocation ratios corresponding to each round of testing is abnormal, such as exceeding 100%; and whether the sum of the memory allocation ratios corresponding to each round of testing is abnormal, such as exceeding 100%. If none of the above checks are abnormal, the verification is successful; otherwise, the verification fails, and an indication that the test configuration file is abnormal is output.
[0111] Step 308: If the test configuration file verification is successful, for each component category among the network card category, hard disk category, and GPU category, allocate logical kernels to that component category from all logical kernels on the server based on the kernel allocation ratio for that component category in the test configuration file, and allocate memory resources to that component category from all memory resources on the server based on the allocated logical kernels. Proceed to step 309.
[0112] Step 309: For each component category within the CPU and memory categories, allocate a logical kernel from the first kernel resource and allocate memory resources from the first memory resource for that component category. Proceed to step 310.
[0113] Step 310: For each component category that needs to be tested in this test, call the thread corresponding to that component category that has been started, so that the thread corresponding to that component category can use the test resources allocated for performance testing of that component category to perform stress performance testing on each component in that component category.
[0114] In this embodiment, the stress performance testing process of each component category is monitored in real time and corresponding logs are recorded. If an abnormal termination occurs, or a faulty component is detected, the stress test results corresponding to each component category will be output, the test resources allocated to each component category will be reclaimed, and the test will be terminated. The specific content of the stress test results for each component category is not specifically limited in this embodiment.
[0115] The server component testing method provided in this embodiment improves testing efficiency by performing stress performance tests on each component in each component category in parallel. Compared to serial testing, which requires the same total test duration, the parallel testing method in this embodiment increases the test duration for each component category. For example, if the total test duration for serial testing is 24 hours, these 24 hours need to be allocated to each component category; however, in this embodiment, since the stress performance tests for each component category are executed in parallel, the test duration for each component category can be 24 hours. This effectively improves the detection rate of the tests.
[0116] Correspondingly, compared to the serial testing method, while maintaining roughly the same detection rate, the testing time required in this embodiment can be less than that required by the serial testing method, such as one-third of the testing time required by the serial testing method. This improves testing efficiency and reduces testing costs.
[0117] Furthermore, this embodiment allows for flexible configuration of the required component categories, test durations, and test rounds based on actual application needs through test configuration files. This enables flexible and dynamic control of the load pressure during testing of each component category, thereby better matching the user's actual usage environment and improving the flexibility and reliability of the test.
[0118] This concludes the description of the method provided in the embodiments of this application. The apparatus provided in the embodiments of this application will now be described:
[0119] See Figure 4 , Figure 4 This is a schematic diagram of a testing apparatus for a server component provided in an embodiment of this application. The apparatus is applied to a server. Figure 4 As shown, the device 400 includes:
[0120] The allocation module 401 is used to allocate test resources for performance testing to at least N component categories in the server based on the performance test instruction when a performance test instruction is received; wherein, N is greater than 1; different component categories are allocated different test resources;
[0121] Test module 402 is used to call the thread corresponding to the component category that has been started for each component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category; wherein, at least two different component categories correspond to different threads; the threads corresponding to N component categories execute the stress performance test in parallel.
[0122] As an example, the test resources allocated to each component category include at least the logical cores of the central processing unit (CPU) and memory resources; wherein, different component categories are allocated different logical cores; and different component categories are allocated different memory resources.
[0123] As an example, if the component category is a network interface card (NIC) category, then the test resources allocated for performance testing for that NIC category include one logical core and the memory resources allocated for that NIC category.
[0124] Invoke the thread corresponding to the currently running component category, so that the thread can utilize the test resources allocated for performance testing to perform stress performance tests on each component in that component category, including:
[0125] Iterate through each network interface card (NIC) in this category in order, and use the traversed NIC as the current NIC.
[0126] The system calls M test processes through the thread corresponding to the network card category, where M is greater than or equal to 1 and M is related to the network interface of the current network card. This allows the M test processes to use the logical kernel and memory resources allocated to the network card category to perform stress performance tests on the M network interfaces of the current network card.
[0127] As an example, if the component category is a hard disk category, then the test resources allocated to the hard disk category for performance testing include L logical cores and the memory resources allocated to the hard disk category; L is greater than or equal to 1; L is related to the number of hard disks in the hard disk category;
[0128] Calling the thread corresponding to the already started component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: calling L test processes through the thread corresponding to the hard disk category, so that the L test processes can use the L logical kernels and memory resources allocated to the hard disk category to perform stress performance testing on the L hard disks in the hard disk category respectively;
[0129] And / or,
[0130] If the component category is GPU, then the test resources allocated for performance testing to that GPU category include P logical cores and the memory resources allocated to that GPU category; P is greater than or equal to 1; P is related to the number of GPUs in that GPU category;
[0131] Calling the thread corresponding to the already started component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: calling P test processes through the thread corresponding to the GPU category, so that the P test processes can use the P logical cores and memory resources allocated to the GPU category to perform stress performance testing on the P GPUs in the GPU category respectively.
[0132] As an example, if the component category is a CPU category, then the test resources allocated for performance testing to the CPU category include X logical cores and the memory resources allocated to the CPU category; X is greater than or equal to 1.
[0133] Calling the thread corresponding to the already started component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: calling X test processes through the thread corresponding to the CPU category, so as to use the X logical cores and memory resources allocated to the CPU category to run X test processes in parallel, so as to achieve stress performance testing on each CPU in the CPU category;
[0134] And / or,
[0135] If the component category is a memory category, then the test resources allocated for performance testing for that memory category include Y logical cores and the memory resources allocated for that memory category; Y is greater than or equal to 1;
[0136] Calling the thread corresponding to the already started component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: calling Y test processes through the thread corresponding to the memory category, so as to use the Y logical kernels and memory resources allocated to the memory category to run Y test processes in parallel, so as to achieve stress performance testing on each memory in the memory category.
[0137] As an example, if a component category is any one of network card category, hard disk category, and GPU category, then the logical kernel allocated to that component category is determined from all logical kernels of the server; and the memory resources allocated to that component category are determined from all memory resources of the server based on the logical kernel allocated to that component category.
[0138] If a component category is a CPU category or a memory category, the logical kernel allocated to that component category is determined from the first kernel resource; and the memory resource allocated to that component category is determined from the first memory resource; wherein, the first kernel resource and the first memory resource refer to the unallocated logical kernel and memory resources remaining after all test resources have been allocated to each of the N component categories except for the CPU category and the memory category.
[0139] As an example, determining the logical kernel to which this component category is assigned from all logical kernels of the server includes:
[0140] Based on the kernel allocation information configured for this component category, determine the logical kernel assigned to this component category from all logical kernels of the server; or,
[0141] Based on the application requirements of this component category, the logical cores assigned to this component category are determined from all logical cores of the server. Specifically, if the component category is a network interface card (NIC) category, the number of logical cores assigned to this component category is 1. If the component category is a hard disk (HDD) category or a GPU category, the number of logical cores assigned to this component category is related to the number of components in this component category.
[0142] As one embodiment, determining the logical kernel allocated to the component category from the first kernel resources includes: determining a second kernel resource based on the difference between the first kernel resource and the reserved kernel resource; the reserved kernel resource is less than the first kernel resource; and determining the logical kernel allocated to the component category from the second kernel resource based on the kernel allocation information configured for the component category.
[0143] Determining the memory resources allocated to this component category from the first memory resources includes: determining the second memory resources based on the difference between the first memory resources and the reserved memory resources; determining the reserved memory resources based on the first memory resources; the reserved memory resources being less than the first memory resources; and determining the memory resources allocated to this component category from the second memory resources based on the memory allocation information configured for this component category.
[0144] As an example, at least N component categories are the component categories that need to be tested in the current Z-th round; Z is greater than or equal to 1;
[0145] In the current Z-th round, the thread runtime of the thread corresponding to at least N component categories is less than or equal to the test duration required for the current Z-th round.
[0146] This concludes the process. Figure 4 Structural description of the display device.
[0147] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0148] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0149] Please see Figure 5This is a schematic diagram of the hardware structure of an electronic device provided for an exemplary embodiment of this application. The electronic device may include a processor 501, a communication interface 502, a computer-readable storage medium 503, and a communication bus 504. The processor 501, communication interface 502, and computer-readable storage medium 503 communicate with each other via the communication bus 504. The computer-readable storage medium 503 stores computer program instructions; the processor 501 can execute the steps of the method described in the above embodiments by executing the computer program instructions stored on the computer-readable storage medium 503. Depending on the actual function of the electronic device, other hardware may also be included, which will not be elaborated further.
[0150] Correspondingly, embodiments of this application also provide a computer-readable storage medium storing a plurality of computer program instructions, which, when executed by a processor, can implement the methods disclosed in the above examples of this application.
[0151] For example, the aforementioned computer-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For instance, computer-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof. The processor and memory may be supplemented by or incorporated into dedicated logic circuitry.
[0152] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A testing method for a server component, characterized in that, This method is applied to a server, and the method includes: When a performance test instruction is received, test resources for performance testing are allocated to at least N component categories in the server based on the performance test instruction; where N is greater than 1; different component categories are allocated different test resources; if a component category is any one of network card category, hard disk category, and GPU category, then the logical kernel allocated to that component category is determined from all logical kernels of the server, and the memory resources allocated to that component category are determined from all memory resources of the server based on the logical kernel allocated to that component category; if a component category is CPU category or memory category, then the logical kernel and memory resources allocated to that component category are determined from first kernel resources and first memory resources, respectively, where the first kernel resources and first memory resources refer to the unallocated logical kernel and memory resources remaining after all component categories other than CPU category and memory category have been allocated test resources; For each component category, the thread corresponding to that component category that has been started is invoked, so that the thread corresponding to that component category uses the test resources allocated for performance testing of that component category to perform stress performance testing on each component in that component category; wherein, at least two different component categories correspond to different threads; the threads corresponding to the N component categories execute the stress performance testing in parallel.
2. The method according to claim 1, characterized in that, The test resources allocated to each component category include at least the logical cores of the central processing unit (CPU) and memory resources; different component categories are allocated different logical cores and different memory resources.
3. The method according to claim 1 or 2, characterized in that, If the component category is a network interface card (NIC) category, the test resources allocated for performance testing for that NIC category include one logical core and the memory resources allocated for that NIC category. The invocation of the thread corresponding to the already started component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: Iterate through each network interface card (NIC) in this category in order, and use the traversed NIC as the current NIC. M test processes are invoked through the thread corresponding to the network card category, where M is greater than or equal to 1 and M is related to the network interface of the current network card; so that the M test processes use the logical kernel and memory resources allocated to the network card category to perform stress performance tests on the M network interfaces of the current network card respectively.
4. The method according to claim 1 or 2, characterized in that, If the component category is a hard disk category, then the test resources allocated to this hard disk category for performance testing include L logical cores and the memory resources allocated to this hard disk category; L is greater than or equal to 1; and L is related to the number of hard disks in this hard disk category. The step of calling the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category, includes: calling L test processes through the thread corresponding to the hard disk category, so that the L test processes can use the L logical kernels and memory resources allocated to the hard disk category to perform stress performance testing on the L hard disks in the hard disk category respectively. And / or, If the component category is GPU, then the test resources allocated for performance testing to that GPU category include P logical cores and the memory resources allocated to that GPU category; P is greater than or equal to 1; and P is related to the number of GPUs in that GPU category. The step of calling the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category, includes: calling P test processes through the thread corresponding to the GPU category, so that the P test processes can use the P logical cores and memory resources allocated to the GPU category to perform stress performance testing on the P GPUs in the GPU category respectively.
5. The method according to claim 1 or 2, characterized in that, If the component category is CPU, then the test resources allocated for performance testing to this CPU category include X logical cores and the memory resources allocated to this CPU category; X is greater than or equal to 1. The invocation of the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated to the component category for performance testing to perform stress performance testing on each component in the component category, includes: calling X test processes through the thread corresponding to the CPU category, so as to use the X logical cores and memory resources allocated to the CPU category to run the X test processes in parallel, so as to achieve stress performance testing on each CPU in the CPU category. And / or, If the component category is a memory category, then the test resources allocated for performance testing for that memory category include Y logical cores and the memory resources allocated for that memory category; Y is greater than or equal to 1; The invocation of the thread corresponding to the component category that has been started, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category, includes: invoking Y test processes through the thread corresponding to the memory category, so as to use the Y logical kernels and memory resources allocated to the memory category to run the Y test processes in parallel, so as to achieve stress performance testing on each memory in the memory category.
6. The method according to claim 2, characterized in that, The logical kernels assigned to this component category from all logical kernels of the server include: Based on the kernel allocation information configured for this component category, determine the logical kernel assigned to this component category from all logical kernels of the server; or, Based on the application requirements of this component category, the logical cores assigned to this component category are determined from all logical cores of the server. If the component category is a network interface card (NIC) category, the number of logical cores assigned to this component category is 1. If the component category is a hard disk (HDD) category or a GPU category, the number of logical cores assigned to this component category is related to the number of components in this component category.
7. The method according to claim 2, characterized in that, Determining the logical kernel allocated to the component category from the first kernel resource includes: determining a second kernel resource based on the difference between the first kernel resource and the reserved kernel resource; the reserved kernel resource is determined based on the first kernel resource; the reserved kernel resource is less than the first kernel resource; and determining the logical kernel allocated to the component category from the second kernel resource based on the kernel allocation information configured for the component category. Determining the memory resources allocated to the component category from the first memory resources includes: determining a second memory resource based on the difference between the first memory resource and the reserved memory resource; the reserved memory resource is determined based on the first memory resource; the reserved memory resource is less than the first memory resource; and determining the memory resources allocated to the component category from the second memory resource based on the memory allocation information configured for the component category.
8. The method according to claim 1, characterized in that, The at least N component categories are the component categories that need to be tested in the current Z-th round; Z is greater than or equal to 1; In the current Z-th round, the thread runtime of the thread corresponding to each of the at least N component categories is less than or equal to the test duration required for the current Z-th round.
9. A testing apparatus for a server component, characterized in that, This device is used in servers and includes: The allocation module is configured to, upon receiving a performance test instruction, allocate test resources for performance testing to at least N component categories in the server based on the performance test instruction; wherein N is greater than 1; different component categories are allocated different test resources; if a component category is any one of network card, hard disk, and GPU, the logical kernel allocated to that component category is determined from all logical kernels of the server, and the memory resources allocated to that component category are determined from all memory resources of the server based on the logical kernel allocated to that component category; if a component category is CPU or memory, the logical kernel and memory resources allocated to that component category are determined from first kernel resources and first memory resources, respectively, wherein the first kernel resources and first memory resources refer to the unallocated logical kernels and memory resources remaining after all component categories other than CPU and memory have been allocated test resources; The testing module is used to call the thread corresponding to each component category that has been started for each component category, so that the thread corresponding to the component category can use the test resources allocated for performance testing of the component category to perform stress performance testing on each component in the component category; wherein, at least two different component categories correspond to different threads; the threads corresponding to the N component categories execute the stress performance test in parallel.
10. An electronic device, characterized in that, The electronic device includes: Processor; and A computer-readable storage medium storing computer program instructions that, when executed by the processor, cause the processor to perform the steps of the method of any one of claims 1 to 8.
Citation Information
Patent Citations
One-key hybrid pressure measurement method and device in server redistribution and expansion scenario
CN118260141A