Cloud host performance test method and device, storage medium and electronic equipment
By receiving test instructions to obtain the cloud host identification and load type, automatically creating and installing load scripts, and generating test scripts, the problem of low efficiency in cloud host performance testing is solved, and automated and efficient performance testing is achieved.
Patent Information
- Application Number
- CN202410309951.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2025-09-19
AI Technical Summary
In the existing technology, cloud host performance testing is inefficient and requires testers to participate multiple times or for a long time.
A cloud host performance testing method is provided. By receiving test instructions to obtain the cloud host identification, test type and load type, a cloud host is created, a load script is uploaded and a test script is generated, and performance testing is performed automatically.
The automation and efficiency of cloud host performance testing are realized. Users only need to provide test information to perform automated testing, which improves testing efficiency.
Smart Images

Figure CN120670256A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud host testing, and in particular to a cloud host performance testing method, device, storage medium, and electronic device. Background Art
[0002] In the prior art, cloud host testing is categorized into various types, including performance testing. Performance testing refers to testing the operational performance of a cloud host, specifically including testing of the cloud host's CPU performance, memory performance, and disk performance.
[0003] In the prior art, the performance testing of cloud hosts is mostly manual testing or semi-automatic testing, which requires multiple or long-term participation of testers to complete, resulting in low efficiency in testing the performance of cloud hosts. Summary of the Invention
[0004] The present application provides a cloud host performance testing method, device, storage medium and electronic device to solve the technical problem of low efficiency of cloud host performance testing.
[0005] In a first aspect, the present application provides a cloud host performance testing method, comprising: upon receiving a test instruction, obtaining a cloud host identifier, a test type, and a load type from the test instruction, wherein the cloud host identifier is used to mark the cloud host to be tested, the test type is used to indicate the virtual components of the cloud host to be tested, the virtual components being at least one of the central processing unit, memory, and disk of the cloud host, and the load type is used to indicate the load size of the virtual components of the cloud host when testing the cloud host; creating a cloud host according to the cloud host identifier; uploading and installing a load script to the cloud host; generating a test script from the load script according to the test type and the load type; and testing the cloud host using the test script.
[0006] In the second aspect, the present application provides a cloud host performance testing device, including: an acquisition module, which is used to obtain a cloud host identifier, a test type and a load type from the above test instruction when a test instruction is received, wherein the above cloud host identifier is used to mark the cloud host to be tested, and the above test type is used to indicate the virtual component of the above cloud host to be tested, and the above virtual component is at least one of the central processing unit, memory and disk of the above cloud host, and the above load type is used to indicate the load size of the virtual component of the above cloud host when testing the above cloud host; a creation module, which is used to create a cloud host according to the above cloud host identifier; an installation module, which is used to upload and install the load script to the above cloud host; a generation module, which is used to generate a test script from the above load script according to the above test type and the above load type; and a testing module, which is used to test the above cloud host using the above test script.
[0007] As an optional example, the generation module includes: a generation unit, configured to determine the virtual components indicated by the test type; and generate the test script for each of the virtual components according to the load type.
[0008] As an optional example, the generation unit includes: a first generation subunit, configured to generate an empty script for the virtual component indicated by the test type when the load type indicates no load, wherein the empty script does not include any tasks.
[0009] As an optional example, the above-mentioned generation unit includes: a second generation sub-unit, used to generate an adjustment script for the virtual component indicated by the above-mentioned test type when the above-mentioned load type indicates full load, wherein the above-mentioned adjustment script is used to adjust the value of any system parameter of the above-mentioned virtual component; after adjusting the above-mentioned system parameters, if the load of the above-mentioned virtual component is not full, continue to adjust the values of other system parameters of the above-mentioned virtual component until the load of the above-mentioned virtual component is full load.
[0010] As an optional example, the above-mentioned generation unit includes: a third generation sub-unit, used to generate a first task script for the virtual component indicated by the above-mentioned test type when the above-mentioned load type indication is a jump load, wherein the above-mentioned first task script includes multiple tasks, and each of the above-mentioned multiple tasks occupies at least m% of the load of the above-mentioned virtual component when being executed, wherein the above-mentioned m is a positive number greater than 1; the above-mentioned first task script is used to select one or more tasks from the above-mentioned first task script as target tasks during testing; each of the above-mentioned target tasks is executed simultaneously by the above-mentioned virtual component to keep the load of the above-mentioned virtual component at the first load, wherein each of the above-mentioned target tasks is repeatedly executed after being executed; when the load of the above-mentioned virtual component remains at the above-mentioned first load and is stable, the number of the above-mentioned target tasks is increased to keep the load of the above-mentioned virtual component at the second load, and the above-mentioned second load is different from the above-mentioned first load.
[0011] As an optional example, the above-mentioned generation unit includes: a fourth generation sub-unit, used to generate a second task script for the virtual component indicated by the above-mentioned test type when the above-mentioned load type indication is a gradient load, wherein the above-mentioned second task script includes multiple tasks, and each of the above-mentioned multiple tasks occupies at most n% of the load of the above-mentioned virtual component when executed, wherein the above-mentioned n is a positive number less than 1; wherein the above-mentioned second task script is used to select one or more tasks from the above-mentioned second task script as target tasks during testing; each of the above-mentioned target tasks is executed simultaneously by the above-mentioned virtual component to keep the load of the above-mentioned virtual component at a third load, wherein each of the above-mentioned target tasks is repeatedly executed after being executed; when the load of the above-mentioned virtual component is maintained at the above-mentioned third load and is stable, the number of the above-mentioned target tasks is increased to keep the load of the above-mentioned virtual component at a fourth load, wherein the above-mentioned third load is different from the above-mentioned fourth load.
[0012] As an optional example, the above-mentioned generation unit includes: a fifth generation sub-unit, which is used to generate an input and output task script for the virtual component indicated by the above-mentioned test type when the above-mentioned load type indication is an input and output load, wherein the above-mentioned input and output task script is used to execute a predetermined number of input and output tasks through the above-mentioned virtual component within a predetermined time period.
[0013] In a third aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor is configured to implement any one of the above-mentioned cloud host performance testing methods when executing the computer program.
[0014] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute any of the above-mentioned cloud host performance testing methods of the present application.
[0015] The above-mentioned technical solution provided by the embodiment of the present application has the following advantages over the prior art: the solution provided by the embodiment of the present application, when receiving a test instruction, obtains the cloud host identifier, test type and load type from the above-mentioned test instruction, wherein the above-mentioned cloud host identifier is used to mark the cloud host to be tested, the above-mentioned test type is used to indicate the virtual component of the above-mentioned cloud host to be tested, the above-mentioned virtual component is at least one of the central processing unit, memory and disk of the above-mentioned cloud host, and the above-mentioned load type is used to indicate the load size of the virtual component of the above-mentioned cloud host when testing the above-mentioned cloud host; according to the above-mentioned cloud host identifier, create a cloud host; upload and install the load script to the above-mentioned cloud host; according to the above-mentioned test type and the above-mentioned load type, generate a test script from the above-mentioned load script; use the above-mentioned test script to test the above-mentioned cloud host, so that specific load tests can be automatically performed on specific virtual components of the cloud host according to the user's test instructions, thereby achieving the effect of improving the test efficiency of testing the performance of the cloud host. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0018] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0019] Figure 1 A flowchart of a cloud host performance testing method provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0021] Figure 3 A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0022] Figure 4 A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0023] Figure 5A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0024] Figure 6 A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0025] Figure 7 A flowchart of another cloud host performance testing method provided in an embodiment of the present application;
[0026] Figure 8 A schematic diagram of the structure of a cloud host performance testing device provided in an embodiment of the present application;
[0027] Figure 9 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0029] The disclosure below provides many different embodiments or examples for implementing different configurations of the present invention. To simplify the disclosure of the present invention, the components and configurations of specific examples are described below. Of course, these are merely examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. Such repetition is for the purpose of simplicity and clarity and does not in itself indicate the relationship between the various embodiments and / or configurations discussed.
[0030] In order to solve the technical problem of low efficiency in performance testing of cloud hosts in the prior art, the present application provides a cloud host performance testing method, which achieves the effect of improving the testing efficiency of testing the performance of the cloud host.
[0031] Figure 1 A flowchart of a cloud host performance testing method provided in an embodiment of the present application.
[0032] like Figure 1 As shown, the above cloud host performance testing method includes:
[0033] S102, upon receiving a test instruction, obtaining a cloud host identifier, a test type, and a load type from the test instruction, wherein the cloud host identifier is used to identify the cloud host to be tested, the test type is used to indicate a virtual component of the cloud host to be tested, the virtual component being at least one of a central processing unit, a memory, and a disk of the cloud host, and the load type is used to indicate a load size of the virtual component of the cloud host when testing the cloud host;
[0034] S104, creating a cloud host according to the cloud host identifier;
[0035] S106, uploading and installing the load script to the cloud host;
[0036] S108, generating a test script from the load script according to the test type and the load type;
[0037] S110, use the test script to test the cloud host.
[0038] The above-mentioned cloud host performance testing method is applied in the process of automated testing of cloud hosts. The effect achieved is that the user only needs to provide the test information, such as the content of the test instructions, and the system can generate the test instructions based on the user-provided information and automatically test according to the user-provided information.
[0039] The above-mentioned test instructions can be instructions initiated by the user, or instructions initiated by the system after the user provides information. The instructions are used to start the preparation process for testing the cloud host. In the preparation process, at least the cloud host identifier, test type and load type are obtained from the test instructions. The cloud host identifier is used to mark the cloud host image, to indicate the model, configuration, etc. of the cloud host. The cloud host is created through the cloud host image. The test type includes testing the central processing unit (CPU) of the cloud host, and / or testing the memory and / or testing the disk. The load type is used to indicate the specific test load size when testing virtual components such as the CPU, memory and disk. For example, when testing the CPU, the load type is set to full load, then the CPU load must be increased to full load during the test.
[0040] After receiving the test command, the system retrieves the cloud host ID, test type, and load type from the command. It then determines the cloud host image based on the cloud host ID and creates a cloud host. This cloud host is a replica of the cloud host being tested. By testing the cloud host, the system can determine the performance of the cloud host being tested.
[0041] After creating a cloud host, upload the load script to the cloud host and install it. After installation, the load script generates a test script based on the cloud host's test type and load type. For example, if you are testing the cloud host's memory with a ramp load, a test script will be generated to gradually increase the cloud host's memory load to complete the test.
[0042] The solution provided by the embodiment of the present application obtains the cloud host identifier, test type and load type from the test instruction when a test instruction is received, wherein the cloud host identifier is used to mark the cloud host to be tested, the test type is used to indicate the virtual component of the cloud host to be tested, the virtual component being at least one of the central processing unit, memory and disk of the cloud host, and the load type is used to indicate the load size of the virtual component of the cloud host when testing the cloud host; according to the cloud host identifier, a cloud host is created; the load script is uploaded and installed to the cloud host; according to the test type and load type, a test script is generated from the load script; the test script is used to test the cloud host, so that specific load tests can be automatically performed on specific virtual components of the cloud host according to the user's test instructions, thereby achieving the effect of improving the test efficiency of testing the performance of the cloud host.
[0043] As an alternative example, Figure 2 As shown, based on the test type and load type, the test script generated by the load script includes:
[0044] S202, determining a virtual component indicated by the test type;
[0045] S204: Generate a test script for each virtual component according to the load type.
[0046] In this embodiment, the test type can indicate one or more virtual components, and the load type can be one or more load types. Regardless of how many virtual components the test type indicates and how many loads the load type indicates, when generating a test script, each test type can be combined with each load type to obtain all possible combinations, and each possible combination can generate a test script. For example, a full-load CPU test can correspond to a test script, while a gradual memory load test can generate a test script, and so on.
[0047] As an alternative example, Figure 3 As shown, the test script generated for each virtual component according to the load type includes:
[0048] S302 : When the load type indicates no load, generate an empty script for the virtual component indicated by the test type, wherein the empty script does not include any tasks.
[0049] In this embodiment, if the load type indicates "no load," it means that the cloud host is not required to perform any tasks during the test. For example, the cloud host's CPU, memory, and disk loads can remain at their current levels without increasing or decreasing. The "no load" can be the minimum load that the virtual components must maintain during cloud host operation, or a 0% load.
[0050] As an alternative example, Figure 4 As shown, the test script generated for each virtual component according to the load type includes:
[0051] S402. When the load type indicates full load, generate an adjustment script for the virtual component indicated by the test type, wherein the adjustment script is used to adjust the value of any system parameter of the virtual component; after adjusting the system parameter, when the load of the virtual component is not full, continue to adjust the values of other system parameters of the virtual component until the load of the virtual component is full.
[0052] In this embodiment, if the load type is full load, the virtual component can be pressurized by adjusting the value of the virtual component's system parameter, thereby adjusting the load pressure of the virtual component to full load. Full load can be 100% of the load of the virtual component of the cloud host or the maximum load allowed for the virtual component during the operation of the cloud host.
[0053] Before adjusting the system parameters of a virtual component, determine the values of all adjustable system parameters for the virtual component. Then, adjust one of them. After the adjustment, check the load of the virtual component on the cloud host. If it is not at full load, continue adjusting the values of other system parameters until the virtual component is at full load. If full load is still not reached after adjusting all system parameters, change the system parameter value and increase the adjustment range.
[0054] As an alternative example, Figure 5 As shown, the test script generated for each virtual component according to the load type includes:
[0055] S502, when the load type indication is a jump load, generate a first task script for the virtual component indicated by the test type, wherein the first task script includes multiple tasks, and each of the multiple tasks occupies at least m% of the load of the virtual component when executed, wherein m is a positive number greater than 1; the first task script is used to select one or more tasks from the first task script as target tasks during testing; each of the target tasks is executed simultaneously by the virtual component to keep the load of the virtual component at a first load, wherein each of the target tasks is repeatedly executed after being executed; when the load of the virtual component remains at the first load and is stable, the number of the target tasks is increased to keep the load of the virtual component at a second load, which is different from the first load.
[0056] In this embodiment, the jump load is the load of the virtual component that changes by at least 1%. When the load type is a jump load, as in the generated first task script, each task occupies at least 2% of the load of the virtual component when it is executed. The tasks in the first task script are executed in parallel. If a task is completed, the task is executed in a loop. For example, Task 1 and Task 2 are executed in parallel. After Task 1 is completed, Task 1 is executed repeatedly in a loop. After Task 2 is completed, Task 2 is executed repeatedly in a loop. Then, through Task 1 and Task 2, the load of the virtual component is maintained at the first load. After running for a period of time, the number of tasks in the target task is increased, and the load of the virtual component changes by at least 2%. Then the first load and the second load differ by at least 1% of the load value.
[0057] As an alternative example, Figure 6 As shown, the test script generated for each virtual component according to the load type includes:
[0058] S602, when the load type indication is a gradual load, generate a second task script for the virtual component indicated by the test type, wherein the second task script includes multiple tasks, and each of the multiple tasks occupies at most n% of the load of the virtual component when executed, wherein n is a positive number less than 1; wherein the second task script is used to select one or more tasks from the second task script as target tasks during testing; simultaneously execute each of the target tasks through the virtual component to keep the load of the virtual component at a third load, wherein each of the target tasks is repeatedly executed after being executed; when the load of the virtual component remains at the third load and is stable, increase the number of the target tasks to keep the load of the virtual component at a fourth load, wherein the third load is different from the fourth load.
[0059] In this embodiment, the gradient load is the load of the virtual component that changes by a maximum of 1%. When the load type is a gradient load, in the generated second task script, each task occupies at most less than 1% of the load of the virtual component when it is executed. The tasks in the second task script are executed in parallel. If a task is completed, the task is executed in a loop. For example, Task 1 and Task 2 are executed in parallel. After Task 1 is completed, Task 1 is executed repeatedly in a loop. After Task 2 is completed, Task 2 is executed repeatedly in a loop. Then, through Task 1 and Task 2, the load of the virtual component is maintained at the third load. After running for a period of time, the number of tasks in the target task is increased, and the load of the virtual component will gradually change. If one task is added to the target task each time, the load of the virtual component will change by 1% after one or more tasks are added to the target task. Then the third load and the fourth load differ by at least 1% of the load value.
[0060] As an alternative example, Figure 7 As shown, the test script generated for each virtual component according to the load type includes:
[0061] S702, when the load type indication is an input / output load, generating an input / output task script for the virtual component indicated by the test type, wherein the input / output task script is used to execute a predetermined number of input / output tasks through the virtual component within a predetermined time period.
[0062] In this embodiment, if the load type is an I / O load, the I / O performance of the virtual component is tested. The I / O script can be set to execute a certain number of I / O tasks within a predetermined time period to test the I / O performance of the virtual component.
[0063] Specifically, this embodiment provides a method for reliability testing the performance of a cloud host with a Linux operating system. The user provides information used in the test, such as the cloud host image version, source physical machine, destination physical machine, and other information, and can perform automated testing with one click without the need for continuous user intervention. In addition, the user can also select the load type and the virtual component to be tested. Test types include cpu, memory, disk filling, disk reading and writing, and load types include full load, gradual load, sudden load, and random load. You can choose to perform single-point and multi-point load testing on a single cloud host, or you can choose to perform single-point and multi-point load testing on multiple cloud hosts, and the load utilization rate of the cloud host can be obtained at any time for the user to observe.
[0064] For background preparation, first set up a Python code environment, a Django development environment, and a MangoDB database. When testing the cloud host, determine the cloud host image based on the user-provided cloud host ID and create a Linux cloud host. To more accurately test cloud host performance, a wide range of cloud host images are required. Optional Linux cloud host images include CentOS, Ubuntu, Debian, Fedora, and other versions, depending on the cloud host ID.
[0065] The front-end can construct one or more interfaces, including a variety of options such as single load, combined load, random load, and custom load. Users can provide the necessary information for the test instructions through the front-end interface. The data from the front-end interface is transmitted to the back-end, and the back-end interface is called to execute the corresponding load function for testing. The front-end also provides entry points for test accounts and machine models, and stores account and machine model information in the database, eliminating the need for the same tester to enter account and machine model information multiple times. The front-end then calls various back-end functions to perform performance and reliability testing. During the test, users can view the load status of the cloud host on the front-end interface. The front-end also allows users to enter test account information, host image version, source physical machine, destination physical machine, and other information.
[0066] If performance testing of multiple instances is required, the backend can batch create cloud hosts of different versions based on different cloud host images. Since it takes a certain amount of time for a cloud host to boot up, it is necessary to repeatedly check whether the cloud host status is active after creation. When all cloud hosts are in the active state, remotely log in to the cloud hosts of each version, upload the installation tools and load scripts to the cloud hosts, and wait for the frontend to issue a test request (either by the user or automatically by the system platform). The corresponding command will be used to install the toolkit and execute the load script for stress testing. After the load script is executed, it is necessary to check whether the CPU and memory of each host are in the corresponding stress state.
[0067] During backend testing, the nova API is called. If testing a single cloud host, simply call the nova API to request cloud host creation. If testing multiple cloud hosts, use multithreading to batch create cloud hosts with the specified image. Since cloud hosts are not immediately active after creation, the API is repeatedly called to query the VM status until all hosts are active or the polling period expires. Once all hosts are active, the Enterprise Information Portal (EIP) is bound to the host. Using this EIP, remotely log in to each host and upload and install the chaosblade and cpu_burn toolkits and load scripts.
[0068] Based on user selection or customization, load scripts are executed to continuously stress each cloud host (CPU, memory, and disk). These loads are then placed under different load scenarios, including no load, full load, transient load, gradual load, and input / output load. After executing the stress script, the success of the stress test is verified. After the use case test passes, the cloud host created for the test can be deleted to avoid resource usage. After the test is completed, the real-time load status of the cloud host can be observed on the platform for user evaluation.
[0069] Figure 8 This is a schematic diagram of the structure of a cloud host performance testing device provided in an embodiment of the present application. Figure 8 As shown, the cloud host performance testing device includes:
[0070] An acquisition module 802 is configured to, upon receiving a test instruction, acquire a cloud host identifier, a test type, and a load type from the test instruction, wherein the cloud host identifier is used to identify the cloud host to be tested, the test type is used to indicate a virtual component of the cloud host to be tested, where the virtual component is at least one of a central processing unit, a memory, and a disk of the cloud host, and the load type is used to indicate the load size of the virtual component of the cloud host when testing the cloud host;
[0071] A creation module 804 is used to create a cloud host according to the cloud host identifier;
[0072] Installation module 806, for uploading and installing the load script into the cloud host;
[0073] A generating module 808 is configured to generate a test script from a load script according to the test type and the load type;
[0074] The testing module 810 is used to test the cloud host using a test script.
[0075] The above-mentioned cloud host performance testing method is applied in the process of automated testing of cloud hosts. The effect achieved is that the user only needs to provide the test information, such as the content of the test instructions, and the system can generate the test instructions based on the user-provided information and automatically test according to the user-provided information.
[0076] The above-mentioned test instructions can be instructions initiated by the user, or instructions initiated by the system after the user provides information. The instructions are used to start the preparation process for testing the cloud host. In the preparation process, at least the cloud host identifier, test type and load type are obtained from the test instructions. The cloud host identifier is used to mark which cloud host to test, the model and configuration of the cloud host, etc. The test type includes testing the central processing unit (CPU) of the cloud host, and / or testing the memory and / or testing the disk. The load type is used to indicate the specific test load size when testing virtual components such as the CPU, memory and disk. For example, when testing the CPU, the load type is set to full load, then the CPU load must be increased to full load during the test.
[0077] After receiving the test instruction, the system retrieves the cloud host ID, test type, and load type from the test instruction. It then creates a cloud host based on the cloud host ID. This cloud host is a replica of the cloud host being tested. By testing the cloud host, the system can determine the performance of the cloud host being tested.
[0078] After creating a cloud host, upload the load script to the cloud host and install it. After installation, the load script generates a test script based on the cloud host's test type and load type. For example, if you are testing the cloud host's memory with a ramp load, a test script will be generated to gradually increase the cloud host's memory load to complete the test.
[0079] The solution provided by the embodiment of the present application obtains the cloud host identifier, test type and load type from the test instruction when a test instruction is received, wherein the cloud host identifier is used to mark the cloud host to be tested, the test type is used to indicate the virtual component of the cloud host to be tested, the virtual component being at least one of the central processing unit, memory and disk of the cloud host, and the load type is used to indicate the load size of the virtual component of the cloud host when testing the cloud host; according to the cloud host identifier, a cloud host is created; the load script is uploaded and installed to the cloud host; according to the test type and load type, a test script is generated from the load script; the test script is used to test the cloud host, so that specific load tests can be automatically performed on specific virtual components of the cloud host according to the user's test instructions, thereby achieving the effect of improving the test efficiency of testing the performance of the cloud host.
[0080] For other examples of this embodiment, please refer to the above examples and will not be repeated here.
[0081] like Figure 9As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0082] Memory 113, for storing computer programs;
[0083] In one embodiment of the present application, the processor 111 is configured to implement the cloud host performance testing method provided by any one of the aforementioned method embodiments when executing a program stored in the memory 113 .
[0084] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the cloud host performance testing method provided in any of the aforementioned method embodiments is implemented.
[0085] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0086] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.
[0087] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "comprise", "include", "contain" and "have" are inclusive and therefore specify the presence of stated features, steps, operations, elements and / or parts, but do not exclude the presence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be performed in the specific order described or illustrated, unless the order of execution is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0088] The foregoing description is intended only to provide specific embodiments of the present invention, which will enable those skilled in the art to understand and implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is intended to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A performance testing method for a cloud host, characterized in that: include: Upon receiving a test instruction, obtaining a cloud host identifier, a test type, and a load type from the test instruction, wherein the cloud host identifier is used to mark the cloud host to be tested, the test type is used to indicate a virtual component of the cloud host to be tested, the virtual component being at least one of a central processing unit, a memory, and a disk of the cloud host, and the load type is used to indicate a load size of the virtual component of the cloud host when testing the cloud host; Creating a cloud host according to the cloud host identifier; Upload and install the load script to the cloud host; Generating a test script from the load script according to the test type and the load type; Use the test script to test the cloud host.
2. The method according to claim 1, characterized in that Generating a test script from the load script according to the test type and the load type includes: determining the virtual component indicated by the test type; The test script is generated for each of the virtual components according to the load type.
3. The method according to claim 2, characterized in that Generating the test script for each virtual component according to the load type includes: When the load type indicates no load, an empty script is generated for the virtual component indicated by the test type, wherein the empty script does not include any tasks.
4. The method according to claim 2, characterized in that Generating the test script for each virtual component according to the load type includes: When the load type indicates full load, an adjustment script is generated for the virtual component indicated by the test type, wherein the adjustment script is used to adjust the value of any system parameter of the virtual component; and when the load of the virtual component is not full after adjusting the system parameter, the values of other system parameters of the virtual component continue to be adjusted until the load of the virtual component is full load.
5. The method according to claim 2, characterized in that Generating the test script for each virtual component according to the load type includes: When the load type indicates a jumping load, generating a first task script for the virtual component indicated by the test type, wherein the first task script includes a plurality of tasks, and each of the plurality of tasks occupies at least m% of the load of the virtual component when executed, wherein m is a positive number greater than 1; The first task script is used to select one or more tasks from the first task script as target tasks during testing; simultaneously execute each of the target tasks through the virtual component to keep the load of the virtual component at a first load, wherein each of the target tasks is repeatedly executed after being executed; and when the load of the virtual component remains at the first load and is stable, increase the number of target tasks to keep the load of the virtual component at a second load, which is different from the first load.
6. The method according to claim 2, characterized in that Generating the test script for each virtual component according to the load type includes: When the load type indicates a gradual load, generating a second task script for the virtual component indicated by the test type, wherein the second task script includes a plurality of tasks, and each of the plurality of tasks occupies at most n% of the load of the virtual component when executed, wherein n is a positive number less than 1; The second task script is used to select one or more tasks from the second task script as target tasks during testing; each of the target tasks is executed simultaneously by the virtual component to keep the load of the virtual component at a third load, wherein each of the target tasks is repeatedly executed after being executed; when the load of the virtual component is maintained at the third load and is stable, the number of target tasks is increased to keep the load of the virtual component at a fourth load, wherein the third load is different from the fourth load.
7. The method according to claim 2, characterized in that Generating the test script for each virtual component according to the load type includes: When the load type indicates an input / output load, an input / output task script is generated for the virtual component indicated by the test type, wherein the input / output task script is used to execute a predetermined number of input / output tasks through the virtual component within a predetermined time period.
8. A performance testing device for a cloud host, characterized in that: include: an acquisition module configured to, upon receiving a test instruction, acquire a cloud host identifier, a test type, and a load type from the test instruction, wherein the cloud host identifier is used to mark the cloud host to be tested, the test type is used to indicate a virtual component of the cloud host to be tested, the virtual component being at least one of a central processing unit, a memory, and a disk of the cloud host, and the load type is used to indicate a load size of the virtual component of the cloud host when testing the cloud host; A creation module, configured to create a cloud host according to the cloud host identifier; An installation module, used to upload and install the load script into the cloud host; A generating module, configured to generate a test script from the load script according to the test type and the load type; A testing module is used to test the cloud host using the test script.
9. An electronic device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein a computer program is stored in the memory, and when the processor executes the computer program, the cloud host performance testing method described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the cloud host performance testing method according to any one of claims 1 to 7 of the present application.