Resource capacity testing method and device, electronic equipment and storage medium
By obtaining multiple test conditions in electronic devices, the component services are controlled to operate under different resource capacity, perform performance detection, and determine the lower and upper resource capacity, which solves the problem of improper hardware resource allocation and achieves the normal operation of component services and the improvement of resource utilization.
Patent Information
- Application Number
- CN202410021767.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-07-08
AI Technical Summary
In the prior art, the allocation of hardware resources for electronic equipment component services is difficult to accurately determine, resulting in waste or insufficient resources, affecting the normal operation of component services.
By obtaining multiple test conditions, the control component services operate under different resource capacity, perform performance inspection, determine the lower and upper resource capacity that meets each performance indicator, and realize automated testing and precise resource allocation.
Ensure that component services operate normally on electronic devices, avoid resource waste, and improve hardware resource utilization.
Smart Images

Figure CN120276945A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a resource capacity testing method, device, electronic device and storage medium. Background Art
[0002] Currently, in the information environment, electronic devices need to allocate hardware resources according to the actual needs of component services. In reality, it is usually the system administrator who decides how much hardware resources to allocate to component services based on subjective experience or suggestions from developers. This approach is prone to excessive resource allocation, resulting in waste of hardware resources, or insufficient resource allocation, resulting in abnormal operation of component services, which affects the supply of hardware resources to component services.
[0003] Therefore, how to determine the resource capacity required to run component services is a technical problem that needs to be solved urgently in related technologies. Summary of the invention
[0004] In view of this, embodiments of the present application propose a resource capacity testing method, device, electronic device, and storage medium.
[0005] In a first aspect, an embodiment of the present application provides a resource capacity testing method, the method comprising: obtaining multiple test conditions set for a component service to be tested; one test condition indicates a performance indicator and a model to be tested; the multiple test conditions have at least two performance indicators for each model to be tested; for each test condition, controlling the model to be tested indicated by the test condition to allocate each of the multiple resource capacities to the component service to be tested, running the component service to be tested, and performing performance testing on the component service to be tested, obtaining performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested, respectively, the performance test results being used to indicate whether the performance indicators in the test conditions are met; determining the lower limit resource capacity of each performance indicator achieved by the component service to be tested under the model to be tested according to the performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested; determining the upper limit resource capacity of the component service to be tested under the model to be tested according to the lower limit resource capacity of the multiple performance indicators achieved by the component service to be tested under the model to be tested.
[0006] Second aspect, an embodiment of the present application provides a resource capacity testing device, which includes: an acquisition module, configured to acquire a plurality of test conditions set for a component service to be tested; one test condition indicates one performance index and one model to be tested; there are at least two performance indexes for each model to be tested among the plurality of test conditions; a test module, configured to, for each test condition, when controlling each resource capacity among the plurality of resource capacities allocated for the component service to be tested to serve the model to be tested, run the component service to be tested, and perform performance detection on the component service to be tested, so as to obtain performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested, and the performance test results are used to indicate whether the performance index in the test condition is met; a first determination module, configured to determine the lower limit resource capacity at which the component service to be tested meets each performance index under the model to be tested according to the performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested; a second determination module, configured to determine the upper limit resource capacity of the component service to be tested under the model to be tested according to the lower limit resource capacities at which the component service to be tested meets a plurality of performance indexes under the model to be tested.
[0007] Optionally, the plurality of resource capacities allocated for the component service to be tested include the resource capacities of each round of testing in multiple rounds of testing; the test module is further configured to control the model to be tested to run the component service to be tested when the resource capacity of the M-th round of testing is allocated for the component service to be tested, and perform performance detection on the component service to be tested, so as to obtain the test result of the M-th round when the component service to be tested is provided with the resource capacity of the M-th round of testing by the model to be tested; where M is a positive integer; the resource capacity of the first round of testing is preset; according to the test result of the M-th round, adjust the resource capacity of the M-th round of testing to obtain the resource capacity of the (M + 1)-th round of testing; increment M by 1, and return to execute the step of controlling the model to be tested to run the component service to be tested when the resource capacity of the M-th round of testing is allocated for the component service to be tested, and perform performance detection on the component service to be tested, so as to obtain the test result of the M-th round when the component service to be tested is provided with the resource capacity of the M-th round of testing by the model to be tested, until the test end condition is reached.
[0008] Optionally, when M is greater than 1, there are multiple resource capacities for the M-th round of testing; the testing module is further configured to, if there is a qualified test result indicating that the performance index in the test conditions is met in the M-th round of test results, determine the smallest resource capacity from the qualified resource capacities of the M-th round of testing as the candidate resource capacity for the M-th round of testing; the qualified resource capacity is the resource capacity corresponding to the qualified test result in the M-th round of testing; if the M-th round of test results all indicate that the performance index in the test conditions is not met, determine the largest resource capacity from the resource capacities of the M-th round of testing as the candidate resource capacity for the M-th round of testing; determine the resource capacity for the (M + 1)-th round of testing according to the candidate resource capacity for the M-th round of testing and the test result corresponding to the candidate resource capacity for the M-th round of testing.
[0009] Optionally, the testing module is further configured to determine the resource capacity adjustment direction according to the test result corresponding to the candidate resource capacity in the M-th round of test results; adjust the candidate resource capacity for the M-th round of testing according to the resource capacity adjustment direction and the preset resource capacity adjustment step size to obtain the determined resource capacity for the (M + 1)-th round of testing.
[0010] Optionally, if the test result corresponding to the candidate resource capacity for the (N - 1)-th round of testing indicates that the performance index in the test conditions is not met and the resource value of the target hardware resource in the qualified resource capacities for the N-th round of testing is not less than the resource value of the target hardware resource in the candidate resource capacity for the (N - 1)-th round of testing, it is determined that the test end condition is satisfied; where N is an integer greater than 2; the target hardware resource is any one of the multiple hardware resources required during the operation of the component service to be tested on the model to be tested; the first determination module is further configured to select the smallest qualified resource capacity from the resource capacities for the N-th round of testing as the lower limit resource capacity for the component service to be tested to meet the performance index indicated by the test conditions on the model to be tested indicated by the test conditions.
[0011] Optionally, if the test result corresponding to the candidate resource capacity for the (N - 1)-th round of testing indicates that the performance index in the test conditions is met and the N-th round of test results all indicate that the performance index in the test conditions is not met, it is determined that the test end condition is satisfied; the first determination module is further configured to obtain the candidate resource capacity corresponding to the (N - 1)-th round of testing as the lower limit resource capacity for the component service to be tested to meet the performance index indicated by the test conditions on the model to be tested indicated by the test conditions.
[0012] Optionally, the test module is further configured to, based on the resource capacity for the M-th round of testing allocated to the component under test in the model under test, generate a target test container configured according to the resource capacity for the M-th round of testing in the model under test; control the model under test to run the component service under test in its target test container; and perform performance detection on the component service under test during the process of running the component service under test in the target test container, so as to obtain the M-th round of test results of the component service under test when the model under test provides the resource capacity for the M-th round of testing.
[0013] Optionally, the performance metrics include sub-performance metrics corresponding to at least two performance parameters respectively; the at least two performance parameters include a quantifiable first performance parameter and a second performance parameter reflected by the running state; the test module is further configured to detect the first performance parameter during the process of running the component service under test in the target test container, and determine the first performance test result of the component service under test for the first performance parameter when the model under test provides the resource capacity for the M-th round of testing according to the sub-performance metric corresponding to the first performance parameter; during the process of running the component service under test in the target test container, determine the second performance test result of the component service under test for the second performance parameter when the model under test provides the resource capacity for the M-th round of testing according to the running state of the component service under test; the running state is that the component service under test runs normally or the component service under test runs abnormally; and determine the M-th round of test results of the component service under test when the model under test provides the resource capacity for the M-th round of testing according to the first performance test result of the component service under test for the first performance parameter and the second performance test result for the second performance parameter when the model under test provides the resource capacity for the M-th round of testing.
[0014] Optionally, the lower limit resource capacity includes the lower limit resource values of each hardware resource; the upper limit resource capacity includes the upper limit resource values of each hardware resource; the second determination module is further configured to determine, according to the lower limit resource values of each hardware resource in the lower limit resource capacity of multiple performance metrics reached by the component service under test in the model under test, the maximum lower limit resource value of the component service under test for each hardware resource in the model under test; and use the maximum lower limit resource value of the component service under test for each hardware resource in the model under test as the upper limit resource value of the component service under test for the hardware resource in the model under test.
[0015] Optionally, the acquisition module is further configured to determine multiple performance metrics set for the component service under test and at least one model under test capable of running the component service under test; and combine the multiple performance metrics set for the component service under test and the model identification of the at least one model under test to determine multiple service test conditions corresponding to the component service under test.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory; the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the above method is implemented.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor, the above-mentioned method is implemented.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program including computer instructions, which implement the above method when executed by a processor.
[0019] A resource capacity testing method, device, electronic device and storage medium provided in an embodiment of the present application, in which multiple test conditions set for a component service to be tested are obtained, and the multiple test conditions involve at least one model to be tested and at least two performance indicators corresponding to each model to be tested, and then the model to be tested indicated by the test conditions is tested according to the allocated multiple resource capacities, and performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested are obtained, thereby achieving the purpose of controlling the model to be tested to perform automatic testing according to the allocated resource capacities. Afterwards, it is possible to continue to determine whether the component service to be tested reaches each performance indicator under the model to be tested based on the performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested. The target lower limit resource capacity and the upper limit resource capacity of the component service to be tested under the model to be tested realize the determination of the lower limit resource capacity of the component service to be tested for each performance indicator on each model to be tested and the upper limit resource capacity of the component service to be tested on the model to be tested. In this way, it is convenient to subsequently allocate hardware resources in a targeted manner according to the model running the component service to be tested and the required performance indicators, that is, the allocated hardware resources are not less than the lower limit resource capacity for achieving the corresponding performance indicators on the model, and do not exceed the upper limit resource capacity on the model. In this way, it can not only ensure the normal operation of the component service to be tested on the electronic equipment of the corresponding model, but also avoid allocating too many hardware resources to the component service to be tested, resulting in waste of hardware resources and reduced utilization of hardware resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1A schematic diagram of an application scenario applicable to the embodiments of the present application is shown;
[0022] Figure 2 A flowchart of a resource capacity testing method proposed in an embodiment of the present application is shown;
[0023] Figure 3 A schematic diagram of a process for obtaining a performance test result in an embodiment of the present application is shown;
[0024] Figure 4 A schematic diagram of a process for testing a resource capacity in an embodiment of the present application is shown;
[0025] Figure 5 A schematic diagram of a test engine testing test conditions in an embodiment of the present application is shown;
[0026] Figure 6 Shown is Figure 2 A flowchart of steps S120 and S130 in a corresponding embodiment in one embodiment;
[0027] Figure 7 A schematic diagram of a process for determining a candidate resource capacity adjustment direction in an embodiment of the present application is shown;
[0028] Figure 8 A schematic diagram of another process for determining a candidate resource capacity adjustment direction in an embodiment of the present application is shown;
[0029] Figure 9 A schematic diagram of another process for testing a resource capacity in an embodiment of the present application is shown;
[0030] Figure 10 A block diagram of a resource capacity testing device proposed in an embodiment of the present application is shown;
[0031] Figure 11 A block diagram of an electronic device for executing a resource capacity testing method according to an embodiment of the present application is shown. Detailed implementation manners
[0032] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0033] In the following description, the terms "first / second" are only used to distinguish similar objects and do not represent a specific order for the objects. Understandably, "first / second" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0035] It should be noted that: "a plurality of" as mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0036] In the embodiments of this application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor or multiple processors or memories can be used to implement one or more modules or units. In addition, each module or unit can be a part of the whole module or unit that includes the function of the module or unit.
[0037] The present application discloses a resource capacity testing method, device, electronic device, and storage medium, which relate to cloud technology.
[0038] As Figure 1 shown, the application scenarios applicable to the embodiments of the present application include a terminal 20 and a server 10, and the terminal 20 and the server 10 are communicatively connected through a wired network or a wireless network. The terminal 20 refers to any model to be tested, and the terminal 20 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a vehicle-mounted terminal, an aircraft, a wearable device terminal, a virtual reality device, and other terminal devices that can determine the test conditions.
[0039] The server 10 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0040] Among them, the terminal 20 can determine multiple test conditions according to the to-be-tested model and performance indicators, and then the terminal 20 sends the multiple to-be-tested conditions to the server 10. For each test condition, the server 10 controls the to-be-tested component service to run under the condition that each resource capacity in the multiple resource capacities allocated for the to-be-tested component service is provided by the to-be-tested model, and performs performance detection on the to-be-tested component service to obtain the performance test results of the to-be-tested component service under the multiple resource capacities provided by the to-be-tested model respectively.
[0041] After that, the server 10 can continue to determine the lower limit resource capacity for the to-be-tested component service to meet each performance indicator under the to-be-tested model according to the performance test results of the to-be-tested component service under the multiple resource capacities provided by the to-be-tested model respectively, and determine the upper limit resource capacity for the to-be-tested component service under the to-be-tested model according to the lower limit resource capacities for the to-be-tested component service to meet multiple performance indicators under the to-be-tested model. Finally, the server 10 can send the upper and lower limit resource capacities to the terminal 20 so that the user can view the upper and lower limit resource capacities through the terminal 20.
[0042] In some other embodiments, the server 10 can determine multiple test conditions according to the to-be-tested model and performance indicators.
[0043] In addition, after obtaining the multiple test conditions, the terminal 20 can execute the resource capacity test method of the present application according to the multiple test conditions to obtain the upper and lower limit resource capacities.
[0044] For the convenience of description, in the embodiments of the present application, the resource capacity test method is explained by taking the execution by an electronic device as an example.
[0045] Please refer to Figure 2 , Figure 2 which shows a flowchart of a resource capacity test method proposed in an embodiment of the present application. This method can be applied to Figure 1 the server 10 or the terminal 20 in
[0046] S110. Obtain multiple test conditions set for the to-be-tested component service.
[0047] Among them, a test condition indicates a performance metric and a model to be tested; there are at least two performance metrics for each model to be tested for multiple test conditions. For any one test condition, the performance metric indicated by the test condition refers to the performance metric that the model to be tested needs to achieve during the operation of the component service to be tested.
[0048] Multiple test conditions involve at least one model to be tested. Since there are at least two performance metrics for each model to be tested for multiple test conditions (the performance metrics that the model to be tested needs to achieve during the operation of the component service to be tested include at least two), therefore, for any one model to be tested, the test conditions corresponding to it among multiple test conditions include at least two.
[0049] The component service to be tested can refer to the component service to be tested. The component service to be tested can be a subroutine in an application, a component in an application, or a script in a script set, etc.
[0050] The model to be tested can refer to any electronic device to be tested and supporting the component service to be tested. The hardware resources of different models to be tested can be different. For example, the model to be tested 1 includes a 5-core CPU (Central Processing Unit) of model a1 and 6g of memory, and the model to be tested 2 includes a 3-core CPU (Central Processing Unit) of model a2 and 8g of memory.
[0051] The component services that different models can run may be different. Exemplarily, the component services that different models can run are shown in Table 1 as follows:
[0052] Table 1
[0053] Model Number of CPU Cores Memory (GB) Disk (GB) Supported Component Services A1 96 376 6000 s1, s2, s3 A2 32 64 1000 s1, s2 A3 64 128 3000 s1, s2, s3 A4 96 256 128000 s1
[0054] Among them, the component service that can be supported can refer to the component service that the model can run. As shown in Table 1, if the component service to be tested is component service s3, the models to be tested can be A1 and A3. If the component service to be tested is s1, the models to be tested can be A1, A2, A3, and A4.
[0055] The performance metric refers to the various metrics that the model to be tested needs to achieve during the operation of the component service to be tested. The performance metric is used to indicate the performance quality during the operation of the model to be tested for the component service to be tested. The performance metric can include sub-performance metrics of the first performance parameter that can be quantified and sub-performance metrics of the second performance parameter reflected by the running state.
[0056] The sub - performance indicators of the first performance parameter can refer to the respective thresholds of each performance parameter. For example, the first performance parameter can include response time, concurrency, and error rate, and the sub - performance indicators of the first performance parameter can include the upper threshold of response time, the lower threshold of concurrency, and the upper threshold of error rate.
[0057] The sub - performance indicators of the second performance parameter can refer to the respective status information of each performance parameter. For example, the second performance parameter can include the running status and the running status under the required throughput. The sub - performance indicators of the second performance parameter can include normal operation and normal operation under the required throughput. Among them, the required throughput can be set in advance, and then the component service to be tested is run under the condition of setting the required throughput, and it is detected whether the component service to be tested can run normally during the running process of the component service to be tested. If the component service to be tested runs normally, it meets the sub - performance indicators of the second performance parameter; if the component service to be tested runs abnormally, it does not meet the sub - performance indicators of the second performance parameter.
[0058] In this embodiment, different performance indicators can be determined according to the user category to which the users targeted by the component service to be tested belong. Among them, the user category can include large customers, small customers, medium customers, etc., and the user category can also include individual customers and collective customers, etc.
[0059] Generally speaking, under the same component service, different user categories have different set performance indicators. Exemplarily, the corresponding relationship between the performance indicators of different user categories is shown in Table 2 as follows:
[0060] Table 2
[0061] Component Service User Category Response Time (s) Throughput (per s) Concurrency Number Error Rate (%) cvm Large Customer 0.001 100 20000 0.001 cvm Medium Customer 0.01 50 5000 0.01 cvm Small Customer 0.1 10 100 0.1
[0062] When the user categories are different, for the same component service, a combined relationship between the model and the performance indicators can be constructed to continue to construct test conditions according to the combination. Exemplarily, the combined relationship can be shown in Table 3:
[0063] Table 3
[0064] Model User Category Component Service Response Time (s) CPU Memory A1 Large Customer cvm 0.001 2 3Gi A2 Medium Customer cvm 0.01 1 3Gi A3 Medium Customer cvm 0.01 1 2Gi A4 Small Customer cvm 0.1 100m 500Mi
[0065] As shown in Table 3, one test condition constructed for the component service "cvm" can be to indicate model A1 and the performance indicator "response time 0.001 seconds", another test condition for the component service "cvm" can be to indicate model A2 and the performance indicator "response time 0.01 seconds", and again, one test condition for the component service "cvm" can be to indicate model A4 and the performance indicator "response time 0.1 seconds".
[0066] In some embodiments, the test conditions set for the component service to be tested may include model identification and performance metrics. Correspondingly, S110 may include: determining multiple performance metrics set for the component service to be tested and at least one test model capable of running the component service to be tested; combining the multiple performance metrics set for the component service to be tested and the model identifications of the at least one test model to determine multiple service test conditions corresponding to the component service to be tested.
[0067] Among them, for the component service to be tested, multiple performance metrics can be set according to the user category to which the targeted user belongs as required, and at least one test model capable of running the component service to be tested can be obtained. Then, multiple test conditions can be determined according to the multiple performance metrics and the model identifications of the at least one test model respectively.
[0068] In some embodiments, different test models can share performance metrics. At this time, the model identification of one test model and one performance metric can be combined to obtain one test condition. For example, if there are 3 test models, the corresponding model identifications are 3, and the performance metrics are 2. At this time, the constructed test conditions are 3×2 = 6.
[0069] In other embodiments, different test models correspond to their respective performance metrics. According to the model identification of each test model and the performance metrics of the test model, they are combined respectively to obtain multiple test conditions for the test model. By traversing all the test models, all the test conditions are obtained. For example, test model b1 corresponds to 3 performance metrics, and 3 test conditions for test model b1 are constructed. One test condition includes the model identification of test model b1 and one performance metric; test model b2 corresponds to 2 performance metrics, and 2 test conditions for test model b2 are constructed. One test condition includes the model identification of test model b2 and one performance metric.
[0070] S120. For each test condition, when controlling the component service to be tested to run under the condition that each resource capacity in the multiple resource capacities allocated to the component service to be tested by the test model indicated by the test condition, perform performance detection on the component service to be tested, and obtain the performance test results of the component service to be tested under the multiple resource capacities provided by the test model. The performance test results are used to indicate whether the performance metrics in the test conditions are met.
[0071] The resource capacity may refer to the resource value for hardware resources. Among them, the resource capacity may include the resource values for one or more hardware resources. For example, when the hardware resources are the CPU and memory, the resource capacity may include the frequency of the CPU (the frequency of the CPU may refer to the main frequency of the CPU, and the main frequency of the CPU is the clock frequency at which the CPU core operates) and the size of the memory.
[0072] For each test condition, multiple resource capacities can be set. Select any one resource capacity from the set multiple resource capacities, and then control the device under test to run the component service to be tested according to the selected resource capacity, and perform performance detection on the component service to be tested to obtain the performance test result of the component service to be tested when the device under test provides this resource capacity. Traverse the multiple resource capacities corresponding to this test condition to obtain the performance test results of the component service to be tested when the device under test provides multiple resource capacities respectively.
[0073] For example, for test condition c1, the device under test indicated is cj1, and the resource capacities set are d1, d2, and d3. Then control the device under test cj1 to run the component service to be tested according to resource capacity d1, and perform performance detection on the component service to be tested to obtain the performance test result of the component service to be tested when the device under test cj1 provides resource capacity d1. Control the device under test cj2 to run the component service to be tested according to resource capacity d2, and perform performance detection on the component service to be tested to obtain the performance test result of the component service to be tested when the device under test cj2 provides resource capacity d2. Control the device under test cj3 to run the component service to be tested according to resource capacity d3, and perform performance detection on the component service to be tested to obtain the performance test result of the component service to be tested when the device under test cj3 provides resource capacity d3.
[0074] The performance test result is used to indicate whether the performance index in the test condition is met. In the case where the performance index includes a sub-performance index of a quantifiable first performance parameter and a sub-performance index of a second performance parameter reflected by the running state, it is possible to determine the parameter measurement result of the first performance parameter and the actual state description information of the second performance parameter during the process of running the component service to be tested on the device under test, and determine the performance test result based on the parameter measurement result of the first performance parameter and the actual state description information of the second performance parameter. Among them, the parameter measurement result of the first performance parameter may refer to the specific value of the first performance parameter, and the actual state description information of the second performance parameter may refer to the specific state information during the process of running the component service to be tested on the device under test (the specific state information may include that the component service to be tested runs normally or the component service to be tested runs abnormally).
[0075] When the parameter measurement results of all performance parameters in the first performance parameter meet the preset conditions (when the sub-performance index corresponding to the performance parameter is the upper threshold, the parameter measurement result corresponding to the performance parameter is less than the corresponding upper threshold, then the preset conditions are met; when the sub-performance index corresponding to the performance parameter is the lower threshold, the parameter measurement result corresponding to the performance parameter is greater than the corresponding lower threshold, then the preset conditions are met), and the actual status description information of the second performance parameter is that the service of the component to be tested is running normally, it is determined that the performance test result reaches the performance index in the test conditions. When there is at least one performance parameter in the first performance parameter whose parameter measurement result does not meet the preset conditions, or the actual status description information of the second performance parameter is that the service of the component to be tested is running abnormally, it is determined that the performance test result does not reach the performance index in the test conditions.
[0076] In some embodiments, S120 may include: controlling to generate a current test container for the current resource capacity in the model to be tested indicated by the test conditions when the current resource capacity among the multiple resource capacities allocated by the model to be tested indicated by the test conditions for the service of the component to be tested; the current resource capacity is any one of the multiple resource capacities; controlling the model to be tested indicated by the test conditions to run the service of the component to be tested in its current test container, and performing performance detection on the service of the component to be tested to obtain the performance test result of the service of the component to be tested under the current resource capacity provided by the model to be tested.
[0077] That is to say, for each model to be tested, after determining any one of the resource capacities as the current resource capacity, a current test container is generated in the model to be tested through the current resource capacity (wherein, the hardware resources allocated in the current test container are the hardware resources defined by the current resource capacity), and then controlling the model to be tested to run the service of the component to be tested in the current test container, and performing performance detection on the service of the component to be tested to obtain the performance test result of the service of the component to be tested under the current resource capacity provided by the model to be tested. Among them, it may be to control the model to be tested to generate a current test container according to the current resource capacity through its own cgroup.
[0078] Cgroups is the abbreviation of control groups, which is a function of the Linux kernel used to limit, control, and isolate the resources (such as CPU, memory, disk input / output, etc.) of a process group.
[0079] By generating a test container in the model to be tested to run the service of the component to be tested separately, the isolated operation of the service of the component to be tested is realized, so that the service of the component to be tested is not affected by other running processes during the running process, and the situation where the performance test result is inaccurate due to the influence of other running processes on the running state of the service of the component to be tested is avoided.
[0080] As described above, the performance indicators may include sub-performance indicators of the quantifiable first performance parameter and sub-performance indicators of the second performance parameter reflected by the running state; correspondingly, the to-be-tested model indicated by the foregoing control test conditions runs the to-be-tested component service in its current test container, and performs performance detection on the to-be-tested component service to obtain the performance test result of the to-be-tested component service under the current resource capacity provided by the to-be-tested model, including: detecting the first performance parameter during the process of running the to-be-tested component service in the current test container, and determining the first test result of the to-be-tested component service for the first performance parameter under the current resource capacity provided by the to-be-tested model according to the sub-performance indicators corresponding to the first performance parameter; during the process of running the to-be-tested component service in the current test container, determining the second test result of the to-be-tested component service for the second performance parameter under the current resource capacity provided by the to-be-tested model according to the running state of the to-be-tested component service; the running state is that the to-be-tested component service runs normally or the to-be-tested component service runs abnormally; determining the performance test result of the to-be-tested component service under the current resource capacity provided by the to-be-tested model according to the first test result of the to-be-tested component service for the first performance parameter and the second test result for the second performance parameter under the current resource capacity provided by the to-be-tested model.
[0081] That is to say, for the quantifiable first performance parameter, during the process of running the to-be-tested component service in the current test container, the first performance parameter is detected to obtain the parameter measurement result of the first performance parameter, and then according to the parameter measurement results of the performance parameters in the first performance parameter and the corresponding thresholds, it is determined whether each performance parameter in the first performance parameter meets the preset conditions. Furthermore, when each performance parameter in the first performance parameter meets the preset conditions, the first test result is obtained as reaching the sub-performance indicator corresponding to the first sub-performance parameter in the test conditions.
[0082] For the non-quantifiable second performance parameter, or rather, the second performance parameter that cannot be measured in a single run of the to-be-tested component service, during the process of running the to-be-tested component service in the current test container, the running state of the to-be-tested component service is determined. When the running state is that the to-be-tested component service runs normally, the second test result is determined as reaching the sub-performance indicator corresponding to the second performance parameter in the test conditions. When the running state is that the to-be-tested component service runs abnormally, the second test result is obtained as not reaching the performance indicator in the test conditions.
[0083] Then, when both the first test result and the second test result reach the corresponding sub-performance indicators in the test conditions, the performance test result is determined as reaching the performance indicator in the test conditions, and when the first test result and / or the second test result do not reach the sub-performance indicators of the corresponding performance parameters in the test conditions, the performance test result is determined as not reaching the performance indicator in the test conditions.
[0084] For each test condition, after determining multiple resource capacities, traverse the multiple resource capacities corresponding to the to-be-tested model according to the foregoing process, and obtain the performance test results of the to-be-tested component service under the multiple resource capacities provided by the to-be-tested model indicated by this test condition. Then traverse all test conditions to obtain, for each test condition, the performance test results of the to-be-tested component service under the multiple resource capacities provided by the to-be-tested model indicated by this test condition.
[0085] For example, the test conditions include test condition e1 and test condition e2. Test condition e1 indicates the to-be-tested model ej1 and performance metric ex1, and test condition e2 indicates the to-be-tested model ej2 and performance metric ex2. The resource capacities configured for the to-be-tested model ej1 include ejz11, ejz12, and ejz13, and the resource capacities configured for the to-be-tested model ej2 include ejz21, ejz22, and ejz23. At this time, the obtained performance test results include the test results of the to-be-tested component service under 3 resource capacities provided by the to-be-tested model ej1 indicated by test condition e1 and the test results of the to-be-tested component service under 3 resource capacities provided by the to-be-tested model ej2 indicated by test condition e2: the performance test result of the to-be-tested component service under the resource capacity ejz11 provided by the to-be-tested model ej1 indicated by test condition e1, the performance test result of the to-be-tested component service under the resource capacity ejz12 provided by the to-be-tested model ej1 indicated by test condition e1, the performance test result of the to-be-tested component service under the resource capacity ejz13 provided by the to-be-tested model ej1 indicated by test condition e1, the performance test result of the to-be-tested component service under the resource capacity ejz21 provided by the to-be-tested model ej2 indicated by test condition e2, the performance test result of the to-be-tested component service under the resource capacity ejz22 provided by the to-be-tested model ej2 indicated by test condition e2, and the performance test result of the to-be-tested component service under the resource capacity ejz23 provided by the to-be-tested model ej2 indicated by test condition e2.
[0086] In this embodiment, as Figure 3 shown, the scheduling process of the test engine on the server controls the to-be-tested model to generate a current test container according to the current resource capacity. During the process of running the to-be-tested component service in the current test container of the to-be-tested model, the first test result of the first performance parameter is detected by the parameter detection service of the test engine, and the second test result of the second performance parameter is detected by the health detection service of the test engine.
[0087] S130. Determine the lower-limit resource capacity for each performance metric of the to-be-tested component service on the to-be-tested model according to the performance test results of the to-be-tested component service under the multiple resource capacities provided by the to-be-tested model.
[0088] Among them, the lower limit resource capacity for the component service to be tested to reach a performance index (assumed to be Performance Index A) under the model to be tested refers to the minimum resource capacity required for the performance of the component service to be tested to reach Performance Index A during the operation in the model to be tested. For example, it includes the minimum number of CPU cores and the minimum memory required.
[0089] For each test condition, based on the performance test results of the component service to be tested under multiple resource capacities provided by the model to be tested indicated for this test condition, the qualified performance test results indicating that the performance index in the test condition is reached can be determined. Then, select the minimum resource capacity corresponding to the qualified performance test results among the multiple resource capacities as the lower limit resource capacity of the component service to be tested for the model to be tested indicated for this test condition to reach the test condition indicated.
[0090] Among them, if there are no qualified performance test results indicating that the performance index in the test condition is reached among the performance test results of the component service to be tested under multiple resource capacities provided by the model to be tested indicated for this test condition, multiple new resource capacities can be reselected and return to execute S120 until there are qualified performance test results indicating that the performance index in the test condition is reached among the performance test results of the component service to be tested under multiple resource capacities provided by the model to be tested indicated for this test condition. Then, select the lower limit resource value in the foregoing manner.
[0091] As can be seen from the foregoing, at least two performance indexes are set for each model to be tested. Therefore, for each model to be tested, the lower limit resource capacity of each of the corresponding multiple performance indexes is obtained.
[0092] S140. Determine the upper limit resource capacity of the component service to be tested under the model to be tested according to the lower limit resource capacity of the component service to be tested to reach multiple performance indexes under the model to be tested.
[0093] The upper limit resource capacity of the component service to be tested under the model to be tested refers to the maximum resource capacity allocated to the component service to be tested on the model to be tested to ensure the normal operation of the component service to be tested on the model to be tested.
[0094] Among them, the lower limit resource capacity includes the lower limit resource values of each hardware resource; the upper limit resource capacity includes the upper limit resource values of each hardware resource; the hardware resource may refer to the hardware resources required during the operation of the model to be tested for the component service to be tested. For example, the hardware resource may include the CPU and memory. At this time, the lower limit resource value may include the minimum number of CPU cores and the minimum value of the memory, and the upper limit resource value may include the maximum number of CPU cores and the maximum value of the memory.
[0095] As described above, at least two performance metrics are set for each model to be tested. Therefore, for each model to be tested, the lower limit resource capacity of each of the corresponding multiple performance metrics is obtained, and then, based on the lower limit resource capacity of each of the multiple performance metrics corresponding to each model to be tested, the upper limit resource capacity corresponding to the model to be tested is determined.
[0096] In this embodiment, the maximum lower limit resource value of each hardware resource in the lower limit resource capacity of multiple performance metrics reached by the component service to be tested on the model to be tested can be determined, and the maximum lower limit resource value of each hardware resource of the component service to be tested on the model to be tested is used as the upper limit resource value of the component service to be tested on the model to be tested for the hardware resource.
[0097] That is to say, for each hardware resource, all the lower limit resource values of the hardware resource are obtained from the lower limit resource capacity of multiple performance metrics reached by the component service to be tested on the model to be tested, and the maximum lower limit resource value of the hardware resource is selected from all the lower limit resource values of the hardware resource. All the hardware resources are traversed to obtain the maximum lower limit resource value of each hardware resource, and then the maximum lower limit resource values of each hardware resource are combined into an overall resource capacity, and this overall resource capacity is the upper limit resource capacity of the model to be tested. In this way, all the models to be tested are traversed to obtain the upper limit resource capacity of each model to be tested.
[0098] For example, the performance metrics corresponding to the model to be tested F include performance metric f1 and performance metric f2, and the lower limit resource capacity of multiple performance metrics reached by the component service to be tested on the model to be tested includes the lower limit resource capacity fx1 corresponding to performance metric f1 and the lower limit resource capacity fx2 corresponding to performance metric f2. Among them, the lower limit resource capacity fx1 includes the lower limit resource value fx11 of the cpu and the lower limit resource value fx12 of the memory, and the lower limit resource capacity fx2 includes the lower limit resource value fx21 of the cpu and the lower limit resource value fx22 of the memory. The maximum lower limit resource value of the cpu is determined to be fx11, and the maximum lower limit resource value of the memory is determined to be fx22. At this time, the upper limit resource capacity of the model to be tested F includes the upper limit resource value fx11 of the cpu and the upper limit resource value fx22 of the memory.
[0099] In some examples, the test process of the resource capacity is as Figure 4As shown in the figure, Tester 1 sets performance indicators according to the model to be tested and requirements. Tester 2 (who can be the same as Tester 1 or a different tester) obtains the component service (i.e., the component service to be tested) and a list of models (including the model identifiers of each model to be tested). The server constructs test conditions based on the component service and the model list, obtaining Test Condition 1, Test Condition 2, …, Test Condition n. And the obtained test conditions are added to the test condition queue of the test platform.
[0100] Then, the test engine of the test platform sequentially takes out the test conditions from the test condition queue for testing, obtaining the test results of each test condition in the test condition queue. Finally, the test platform determines the upper limit resource capacity and the lower limit resource capacity according to the test results.
[0101] Among them, the process of testing the test conditions by the test engine is as Figure 5 shown. The test condition can be selected from the test condition queue, and the test condition is parsed by the test condition parser to obtain the model to be tested and the performance indicators indicated by the test condition. Then, the test condition scheduler performs resource scheduling according to the test condition to schedule the server to start the test engine. The test engine generates multiple resource capacities, and the resource capacity allocator configures the models to be tested (i.e., Figure 5 Machine 1, Machine 2, …, Machine n involved) so that the models to be tested generate corresponding test containers. The performance test trigger triggers the models to be tested to run the component service to be tested according to the generated test containers. Then, during the process of the models to be tested running the component service to be tested according to the generated test containers, the first test result is detected by the parameter detection service, the second test result is detected by the health detection service, and the performance test result is obtained by combining the first test result and the second test result. After that, the performance test result collector collects the performance test results, and the test condition scheduler continues to schedule the next test condition until all test conditions are traversed, and the upper and lower limit resource capacities are determined according to the performance test results determined by all test conditions.
[0102] Due to the different models of hardware resources (such as CPU model, memory model, disk model) on devices of different models, it is possible that the same component service needs different resource capacities to achieve the same performance index on different models. Therefore, in this application, the resource capacity (upper limit resource capacity and lower limit resource capacity) of the component service to be tested is determined under each model based on the model to be tested. Thus, it is convenient to allocate hardware resources to the component service to be tested in a targeted manner according to the upper limit resource capacity of each model under each performance index and the upper limit resource capacity under each model for the component service to be tested. In this way, it can be avoided that the hardware resources allocated due to the difference in the models of hardware resources on different models cannot guarantee the normal operation of the component service to be tested, or that too many hardware resources are allocated on the model. Moreover, it can also be avoided that when deploying a component service, only the resource capacity of the commonly used model is configured for the uncommon model, resulting in the mismatch between the hardware resources and resource capacity of the uncommon model and the failure of the component service to operate normally. According to the method of this application, it is also possible to avoid manually changing the resource capacity planning and avoid additional increase in operation and maintenance manpower and failure risks.
[0103] In this embodiment, multiple test conditions set for the component service to be tested are obtained, and the multiple test conditions involve at least one model to be tested and at least two performance indicators corresponding to each model to be tested. Then, the model to be tested indicated by the test conditions is tested according to the allocated multiple resource capacities, and performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested are obtained, thereby achieving the purpose of controlling the model to be tested to perform automatic testing according to the allocated resource capacities. Afterwards, the lower limit resource capacity of each performance indicator reached by the component service to be tested under the model to be tested and the performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested can be continued to be determined. The upper limit resource capacity under the model to be tested realizes the determination of the lower limit resource capacity of each performance indicator achieved by the component service to be tested on each model to be tested and the upper limit resource capacity of the component service to be tested on the model to be tested. This facilitates the subsequent targeted allocation of hardware resources according to the model running the component service to be tested and the required performance indicators, that is, the allocated hardware resources are not less than the lower limit resource capacity to achieve the corresponding performance indicators on the model, and do not exceed the upper limit resource capacity on the model. In this way, not only can the normal operation of the component service to be tested on the electronic equipment of the corresponding model be guaranteed, but also it can avoid allocating too many hardware resources to the component service to be tested, resulting in waste of hardware resources and reduced utilization of hardware resources.
[0104] In some embodiments, the multiple resource capacities allocated for the component to be tested service include resource capacities for each round of testing in multiple rounds of testing; Figure 6 As shown, step S120 may include:
[0105] S210. When controlling the device under test to allocate the resource capacity for the M-th round of testing for the component under test, run the service of the component under test, and perform a performance test on the service of the component under test to obtain the test result of the M-th round when the service of the component under test is provided with the resource capacity of the M-th round of testing by the device under test.
[0106] Where M is a positive integer; the resource capacity of the first round of testing is preset. The resource capacity of the first round of testing can be 1, or it can be randomly generated.
[0107] In this embodiment, the testing process includes multiple rounds of testing. For each round of testing, at least one resource capacity needs to be set for each test condition (only one resource capacity is required for the first round of testing, and multiple resource capacities can be set for other rounds of testing). For the M-th round of testing among multiple rounds of testing, control the device under test to run the service of the component under test when allocating the resource capacity of the M-th round of testing for the service of the component under test, and perform a performance test on the service of the component under test to obtain the test result of the M-th round when the service of the component under test is provided with the resource capacity of the M-th round of testing by the device under test.
[0108] Optionally, S210 may include: based on the device under test allocating the resource capacity of the M-th round of testing for the service of the component under test, generate a target test container configured according to the resource capacity of the M-th round of testing in the device under test; control the device under test to run the service of the component under test in its target test container; and perform a performance test on the service of the component under test during the process of running the service of the component under test in the target test container to obtain the test result of the M-th round when the service of the component under test is provided with the resource capacity of the M-th round of testing by the device under test.
[0109] That is to say, for each round of testing, the device under test can generate a target test container, and the device under test runs the service of the component under test in the generated target test container to obtain the test result of the M-th round when the service of the component under test is provided with the resource capacity of the M-th round of testing by the device under test. Among them, the test result of the M-th round may include the test results of the respective multiple resource capacities provided by the device under test for the M-th round of testing.
[0110] When M is 1, the resource capacity corresponding to the M-th round of testing is 1, that is, only one target test container can be generated, and then control the device under test to run the service of the component under test in the only target test container, and perform a performance test on the service of the component under test during the process of running the service of the component under test in the target test container to obtain the test result of the M-th round when the service of the component under test is provided with the resource capacity of the M-th round of testing by the device under test.
[0111] When M is greater than 1, there are multiple resource capacities corresponding to the M-th round of testing. For each resource capacity, a target test container is generated. For any resource capacity zr1, the model under test is then controlled to run the component service under test in the target test container corresponding to the resource capacity zr1, and during the process of running the component service under test in the target test container corresponding to the resource capacity zr1, the performance of the component service under test is detected to obtain the test result of the M-th round when the component service under test is provided with the resource capacity zr1 of the M-th round of testing on the model under test.
[0112] As described above, the performance metrics include sub-performance metrics corresponding to at least two performance parameters; the at least two performance parameters include a quantifiable first performance parameter and a second performance parameter reflected by the running state; correspondingly, during the process of running the component service under test in the target test container, the performance of the component service under test is detected to obtain the test result of the M-th round when the component service under test is provided with the resource capacity of the M-th round of testing on the model under test, including: detecting the first performance parameter during the process of running the component service under test in the target test container, and determining the first performance test result of the component service under test for the first performance parameter when the component service under test is provided with the resource capacity of the M-th round of testing on the model under test according to the sub-performance metric corresponding to the first performance parameter; during the process of running the component service under test in the target test container, determining the second performance test result of the component service under test for the second performance parameter when the component service under test is provided with the resource capacity of the M-th round of testing on the model under test according to the running state of the component service under test; the running state is that the component service under test runs normally or the component service under test runs abnormally; determining the test result of the M-th round when the component service under test is provided with the resource capacity of the M-th round of testing on the model under test according to the first performance test result of the component service under test for the first performance parameter and the second performance test result for the second performance parameter.
[0113] That is to say, during the M-th round of testing, for the quantifiable first performance parameter, the first performance parameter is detected during the process of running the component service under test in the target test container to obtain the parameter measurement result of the first performance parameter, and then according to the parameter measurement results of the performance parameters in the first performance parameter and the corresponding thresholds, it is determined whether each performance parameter in the first performance parameter meets the preset conditions. Furthermore, when each performance parameter in the first performance parameter meets the preset conditions, the first performance test result is obtained as the performance metric indicated by the test conditions being met, and when there is at least one performance parameter in the first performance parameter that does not meet the preset conditions, the first performance test result is obtained as the performance metric indicated by the test conditions not being met.
[0114] During the M-th round of testing, for the non-quantifiable second performance parameter, during the process of running the component service to be tested in the target test container, the running status of the component service to be tested is determined. When the running status is that the component service to be tested runs normally, it is determined that the second performance test result reaches the performance index indicated by the test conditions. When the running status is that the component service to be tested runs abnormally, it is obtained that the second performance test result does not reach the performance index indicated by the test conditions.
[0115] Then, when both the first performance test result and the second performance test result reach the performance index indicated by the test conditions, it is determined that the M-th round of test result reaches the performance index indicated by the test conditions. And when the first performance test result and / or the second performance test result do not reach the performance index indicated by the test conditions, it is determined that the M-th round of test result does not reach the performance index indicated by the test conditions.
[0116] S220. According to the M-th round of test result, adjust the resource capacity of the M-th round of test to obtain the resource capacity of the (M + 1)-th round of test.
[0117] After obtaining the M-th round of test result, the resource capacity of the next round of test can continue to be determined according to the M-th round of test result, so as to conduct the next round of test according to the resource capacity of one round of test.
[0118] In this embodiment, when M is 1, the resource capacity of the M-th round of test is 1.
[0119] At this time, the resource capacities of the next round of test can be directly determined according to the first round of test result (only including the test result corresponding to one resource capacity).
[0120] If the first round of test result indicates that the performance index indicated by the test conditions is not reached, the resource capacity can be increased based on the resource capacity of the first round of test to obtain the resource capacities of the next round of test. If the first round of test result indicates that the performance index indicated by the test conditions is reached, the resource capacity can be reduced based on the resource capacity of the first round of test to obtain the resource capacities of the next round of test. Increasing the resource capacity can mean increasing the resource value of at least one hardware resource, and reducing the resource capacity can mean reducing the resource value of one hardware resource.
[0121] For example, when the hardware resources include a CPU and memory, the adjustment methods for the resource values of the hardware resources may include: 1) increasing the memory and decreasing the CPU; 2) increasing the memory and keeping the CPU unchanged; 3) increasing the memory and increasing the CPU; 4) keeping the memory unchanged and decreasing the CPU; 5) keeping the memory unchanged and increasing the CPU; 6) decreasing the memory and decreasing the CPU; 7) decreasing the memory and keeping the CPU unchanged; 8) decreasing the memory and increasing the CPU. Among them, the adjustment methods for increasing the resource capacity may include: 1) increasing the memory and decreasing the CPU; 2) increasing the memory and keeping the CPU unchanged; 3) increasing the memory and increasing the CPU; 5) keeping the memory unchanged and increasing the CPU; 8) decreasing the memory and increasing the CPU. Correspondingly, the adjustment methods for decreasing the resource capacity may include: 1) increasing the memory and decreasing the CPU; 4) keeping the memory unchanged and decreasing the CPU; 6) decreasing the memory and decreasing the CPU; 7) decreasing the memory and keeping the CPU unchanged; 8) decreasing the memory and increasing the CPU.
[0122] In the case where M is greater than 1, the resource capacities for the M-th round of testing are multiple; according to the results of the M-th round of testing, adjusting the resource capacities for the M-th round of testing to obtain the resource capacities for the (M + 1)-th round of testing includes: if there is a passing test result in the results of the M-th round of testing indicating that the performance index in the test conditions is met, determining the smallest resource capacity from the passing resource capacities for the M-th round of testing as the candidate resource capacity for the M-th round of testing; the passing resource capacity is the resource capacity corresponding to the passing test result in the M-th round of testing; if all the results of the M-th round of testing indicate that the performance index in the test conditions is not met, determining the largest resource capacity from the resource capacities for the M-th round of testing as the candidate resource capacity for the M-th round of testing; determining the resource capacities for the (M + 1)-th round of testing according to the candidate resource capacity for the M-th round of testing and the test results corresponding to the candidate resource capacity for the M-th round of testing.
[0123] That is to say, if there is a passing test result in the results of the M-th round of testing indicating that the performance index in the test conditions is met, first screen the passing resource capacities for the M-th round of testing (the passing resource capacity is the resource capacity corresponding to the passing test result in the M-th round of testing), and then determine the smallest resource capacity from the passing resource capacities for the M-th round of testing as the candidate resource capacity, so that in the case of passing, the selected candidate resource capacity is smaller, avoiding the occurrence of resource waste caused by selecting too large a candidate resource capacity.
[0124] If all the results of the M-th round of testing indicate that the performance index in the test conditions is not met, then determine the largest resource capacity from the M-th round of testing as the candidate resource capacity, so that in the case of non-passing, the selected candidate resource capacity is larger, avoiding the occurrence of slow operation or inability to operate normally caused by selecting too small a candidate resource capacity.
[0125] After determining the candidate resource capacity for the M-th round of testing, based on the candidate resource capacity for the M-th round of testing, determine the resource capacity for the (M + 1)-th round of testing according to the candidate resource capacity for the M-th round of testing and the test results corresponding to the candidate resource capacity for the M-th round of testing.
[0126] Optionally, determining the resource capacity for the (M + 1)-th round of testing according to the candidate resource capacity for the M-th round of testing and the test results corresponding to the candidate resource capacity for the M-th round of testing includes: determining the resource capacity adjustment direction according to the test results corresponding to the candidate resource capacity in the M-th round of testing; adjusting the candidate resource capacity for the M-th round of testing according to the resource capacity adjustment direction and the preset resource capacity adjustment step size to obtain the determined resource capacity for the (M + 1)-th round of testing.
[0127] Among them, the resource capacity adjustment direction may include the direction of increasing the resource capacity and the direction of decreasing the resource capacity. When the test results corresponding to the candidate resource capacity for the M-th round of testing indicate that the performance index in the test conditions is not met, determine that the resource capacity adjustment direction is the direction of increasing the resource capacity. Correspondingly, when the test results corresponding to the candidate resource capacity for the M-th round of testing indicate that the performance index in the test conditions is met, determine that the resource capacity adjustment direction is the direction of decreasing the resource capacity.
[0128] The preset resource capacity adjustment step size may refer to the amplitude of each adjustment of the resource value of the hardware resource. For example, if the hardware resources are CPU and memory, the preset resource capacity adjustment step size may include a step size of 100 mHz for the CPU (Hz is the frequency of the CPU, m represents mega, and mHz is megahertz) and a step size of 100 mi for the memory (mi is the unit of memory, and 1 mi = 1024 bytes × 1024 bytes).
[0129] Exemplarily, if the hardware resources are CPU and memory, the preset resource capacity adjustment step size may include a step size of 100 m for the CPU and a step size of 100 mi for the memory. If the test results corresponding to the candidate resource capacity for the M-th round of testing indicate that the performance index in the test conditions is not met, the selected resource capacity adjustment directions include: 1) increase memory and decrease CPU; 2) increase memory and keep CPU unchanged; 3) increase memory and increase CPU; 5) keep memory unchanged and increase CPU; 8) decrease memory and increase CPU. Among them, the increase or decrease in each adjustment direction is based on the candidate resource capacity for the M-th round of testing and is adjusted according to the aforementioned step size of 100 m for the CPU and the step size of 100 mi for the memory. Similarly, if the test results corresponding to the candidate resource capacity for the M-th round of testing indicate that the performance index in the test conditions is met, the selected resource capacity adjustment directions include: 1) increase memory and decrease CPU; 4) keep memory unchanged and decrease CPU; 6) decrease memory and decrease CPU; 7) decrease memory and keep CPU unchanged; 8) decrease memory and increase CPU.
[0130] For the M-th round of testing, assume that c represents the number of CPU cores allocated to the component service to be tested, m represents the memory size allocated to the component service, i represents the model i to be tested, j represents the performance metric j, and f(c,m)ij represents the test result on the model i to be tested that meets the performance metric j under the condition that c CPU cores and m memory size resources are allocated to the component service to be tested. There are two such results: meeting the performance metric in the test conditions or not meeting the performance metric in the test conditions. Use 0 to represent meeting the performance metric in the test conditions and 1 to represent meeting the performance metric in the test conditions. At this time, the test result corresponding to any resource capacity in the M-th round of test results is:
[0131] For different test results, different resource capacity adjustment directions are used to adjust the resource capacity, so that the desired ideal result is achieved when testing according to the adjusted resource capacity:
[0132] f(c,m) ij = 0
[0133] f(c′m′) ij = 1
[0134] (c,m) → action → (c′,m′)
[0135] That is to say, after the resource capacity is adjusted by a certain resource capacity adjustment direction (action), the test result changes. This situation is the desired ideal state, so that the resource capacity in the case of a test result of 1 is the resource capacity to be obtained.
[0136] In this embodiment, the resource capacity adjustment direction of the candidate resource capacity in the M-th round of test results can be determined according to the test results corresponding to the candidate resource capacity in the M-th round of test results; according to the resource capacity adjustment direction of the candidate resource capacity in the M-th round of test and the preset resource capacity adjustment step, the candidate resource capacity in the M-th round of test is adjusted to obtain the resource capacity for determining the (M + 1)-th round of test. Then, the test is performed according to the resource capacity of the (M + 1)-th round of test to obtain the test result of the (M + 1)-th round of test. According to the test result of the (M + 1)-th round of test, the candidate resource capacity for the (M + 1)-th round of test is determined. Then, according to the change between the candidate resource capacity for the (M + 1)-th round of test and the candidate resource capacity for the M-th round of test, the candidate resource capacity adjustment direction between the (M + 1)-th round of test and the M-th round of test is determined, so as to record the change in the resource capacity between the (M + 1)-th round of test and the M-th round of test through this candidate resource capacity adjustment direction.
[0137] As Figure 7 - 8 shown, the hardware resources involved are CPU and memory. In Figure 7Among them, the test result of the candidate resource capacity in the M-th round of testing fails to meet the performance index (that is, the test result indicates that the performance index in the test conditions is not met). At this time, the determined resource capacity adjustment directions (that is, action in the figure) are respectively: increase memory, decrease CPU; increase memory, keep CPU unchanged; increase memory, increase CPU; keep memory unchanged, increase CPU; decrease memory, increase CPU. Adjust the candidate resource capacity in the M-th round of testing according to these 5 resource capacity adjustment directions to obtain 5 resource capacities for the (M + 1)-th round of testing, and then obtain the test results for the (M + 1)-th round of testing based on the 5 resource capacities for the (M + 1)-th round of testing. The test results for the (M + 1)-th round of testing should include the test results corresponding to each of the 5 resource capacities (as Figure 7 shown, meeting the performance index means that the test result indicates meeting the performance index in the test conditions). At this time, the smallest resource capacity can be selected from the resource capacities corresponding to the test results indicating meeting the performance index in the test conditions as the candidate resource capacity for the (M + 1)-th round of testing: select the resource capacity with the smallest difference from the candidate resource capacity in the M-th round of testing as the candidate resource capacity for the (M + 1)-th round of testing. At this time, the recorded candidate resource capacity adjustment direction (that is, candidate action) is: increase memory, keep CPU unchanged.
[0138] In Figure 8 Among them, the test result of the candidate resource capacity in the M-th round of testing indicates meeting the performance index in the test conditions. At this time, the determined resource capacity adjustment directions (that is, Figure 8 action in Figure 8 shown) are respectively: increase memory, decrease CPU; keep memory unchanged, decrease CPU; decrease memory, decrease CPU; decrease memory, keep CPU unchanged; decrease memory, increase CPU. Adjust the candidate resource capacity in the M-th round of testing according to these 5 resource capacity adjustment directions to obtain 5 resource capacities for the (M + 1)-th round of testing, and then obtain the test results for the (M + 1)-th round of testing based on the 5 resource capacities for the (M + 1)-th round of testing. The test results for the (M + 1)-th round of testing should include the test results corresponding to each of the 5 resource capacities (as
[0139] shown). At this time, the smallest resource capacity can be selected from the resource capacities corresponding to the test results indicating meeting the performance index in the test conditions as the candidate resource capacity for the (M + 1)-th round of testing: select the resource capacity with the smallest difference from the candidate resource capacity in the M-th round of testing as the candidate resource capacity for the (M + 1)-th round of testing. At this time, the recorded candidate resource capacity adjustment direction is: decrease memory, keep CPU unchanged.
[0139] S230. Cumulatively add 1 to M. Then return to execute S210. Until the test end condition is met, execute S130.
[0140] In some embodiments, when the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing indicates that the performance metric in the test conditions is not met, and the resource value of the target hardware resource in the qualified resource capacity of the N-th round of testing is not less than the resource value of the target hardware resource in the candidate resource capacity of the (N - 1)-th round of testing, it is determined that the test end condition is satisfied; where N is an integer greater than 2, the qualified resource capacity of the N-th round of testing is the resource capacity in the resource capacity of the N-th round of testing whose corresponding test result indicates that the performance metric in the test conditions is met; the target hardware resource is any one of the multiple hardware resources required during the operation of the component service to be tested on the model to be tested.
[0141] Correspondingly, S130 may include: S1301. Select the smallest qualified resource capacity from the resource capacity of the N-th round of testing as the lower limit resource capacity for the component service to be tested to meet the performance metric indicated in the test conditions under the model to be tested indicated in the test conditions.
[0142] When the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing indicates that the performance metric in the test conditions is not met, it means that it is not sufficient to meet the performance metric indicated in the test conditions when running the component service to be tested according to the candidate resource capacity in the (N - 1)-th round of testing; the qualified resource capacity of the N-th round of testing indicates that it is possible to meet the performance metric indicated in the test conditions when running the component service to be tested according to the qualified resource capacity of the N-th round of testing.
[0143] When the resource value of the target hardware resource in the qualified resource capacity of the N-th round of testing is not less than the resource value of the target hardware resource in the candidate resource capacity of the (N - 1)-th round of testing, since the target hardware resource is any one of the multiple hardware resources, it indicates that from the (N - 1)-th round of testing to the N-th round of testing, if the performance metric indicated in the test conditions is to be met, the resource values of all hardware resources in the qualified resource capacity of the N-th round of testing are not lower than the resource values corresponding to the respective hardware resources in the candidate resource capacity of the (N - 1)-th round of testing.
[0144] That is to say, the aforementioned test end condition actually means that from the (N - 1)-th round of testing to the N-th round of testing, it is necessary to increase the resource value corresponding to at least one hardware resource, and at the same time, the resource value of any hardware resource cannot be reduced. However, in the case where the resource values of all hardware resources cannot be reduced, the smaller the gap between the qualified resource capacity of the N-th round of testing and the candidate resource capacity of the (N - 1)-th round of testing, the more resources can be saved. Therefore, the smallest resource capacity can be selected from the qualified resource capacity corresponding to the N-th round of testing as the lower limit resource capacity for the component service to be tested to meet the performance metric indicated in the test conditions under the model to be tested indicated in the test conditions.
[0145] It can be understood that if the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing indicates that the performance index in the test conditions is not met, and the resource value of the target hardware resource in the qualified resource capacity of the N-th round of testing is less than the resource value of the target hardware resource in the candidate resource capacity of the (N - 1)-th round of testing, it indicates that from the (N - 1)-th round of testing to the N-th round of testing, the resource values of the hardware resources that can be reduced in the qualified resource capacity of the N-th round of testing are all lower than the resource values of the corresponding hardware resources in the candidate resource capacity of the (N - 1)-th round of testing. And the reduction of the resource value of the hardware resource that can be reduced can achieve the purpose of meeting the performance index in the test conditions. Then it can be shown that the resource value of the hardware resource that can be reduced can continue to be reduced in the (N + 1)-th round of testing. At this time, it is determined that the test end condition is not met.
[0146] Exemplarily, when the hardware resources include CPU and memory, when the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing indicates that the performance index in the test conditions is not met, the corresponding resource capacity adjustment direction and the selected candidate resource capacity adjustment direction are shown in Table 4 as follows:
[0147] Table 4
[0148]
[0149] Among them, "not meeting the performance index" means not meeting the performance index in the test conditions, "meeting the performance index" means meeting the performance index in the test conditions, actionx means the resource capacity adjustment direction x, candidate action means the candidate resource capacity adjustment direction, and the current state can refer to the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing. The test result under actionx means the test result obtained according to the resource capacity yx of the N-th round of testing determined by adjusting the candidate resource capacity of the (N - 1)-th round of testing according to actionx.
[0150] Among them, "candidate action x = end" means that after adjusting according to the candidate resource capacity of the (N - 1)-th round of testing corresponding to the candidate resource capacity adjustment direction x, when the candidate resource capacity corresponding to the N-th round of testing is obtained, this candidate resource capacity can be used as the lower limit resource capacity for the test model to meet the performance index indicated by the test conditions.
[0151] In another embodiment, if the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing indicates that the performance index in the test conditions is met, and the test result corresponding to the N-th round of testing indicates that the performance index in the test conditions is not met, it is determined that the test end condition is met.
[0152] Correspondingly, S130 may include: S1302, obtaining the candidate resource capacity corresponding to the (N - 1)-th round of testing as the lower-limit resource capacity for the component service under test to meet the performance indicators indicated by the test conditions on the target model indicated by the test conditions.
[0153] If the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing in the (N - 1)-th round of test results indicates that the performance indicator in the test conditions is met, the selected resource capacity adjustment direction is to reduce the resource values of at least one hardware resource. If all the test results corresponding to the N-th round of testing in the N-th round of test results indicate that the performance indicator in the test conditions is not met, it means that based on the candidate resource capacity of the (N - 1)-th round of testing, reducing the resource value of any one hardware resource will result in the test result corresponding to the N-th round of testing indicating that the performance indicator in the test conditions is not met, that is, the candidate resource capacity of the (N - 1)-th round of testing is already the lowest resource value. Therefore, the candidate resource capacity corresponding to the (N - 1)-th round of testing can be obtained as the lower-limit resource capacity for the component service under test to meet the performance indicators indicated by the test conditions on the target model indicated by the test conditions.
[0154] However, if the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing in the (N - 1)-th round of test results indicates that the performance indicator in the test conditions is met, the selected resource capacity adjustment direction is to reduce the resource values of at least one hardware resource. If there is a test result in the N-th round of test results corresponding to the N-th round of testing that indicates that the performance indicator in the test conditions is met, it means that based on the candidate resource capacity of the (N - 1)-th round of testing, reducing the resource value of a certain hardware resource can also make the test result corresponding to the N-th round of testing meet the performance indicator in the test conditions, that is, the candidate resource capacity of the (N - 1)-th round of testing is not yet the lowest resource value and the reduction adjustment of the resource value can continue. Therefore, it is determined that the test end condition is not satisfied.
[0155] Exemplarily, when the hardware resources include CPU and memory, when the test result corresponding to the candidate resource capacity of the (N - 1)-th round of testing in the (N - 1)-th round of test results indicates that the performance indicator in the test conditions is not met, the corresponding resource capacity adjustment direction and the selected candidate resource capacity adjustment direction are shown in Table 5 as follows:
[0156] Table 5
[0157]
[0158] Among them, the performance indicator that fails to meet the test condition indication refers to the performance indicator that fails to meet the performance indicator in the test condition, the performance indicator that meets the test condition indication refers to the performance indicator that meets the performance indicator in the test condition, actionx refers to the resource capacity adjustment direction x, the candidate action refers to the candidate resource capacity adjustment direction, and the current state can refer to the test result corresponding to the candidate resource capacity in the (N - 1)-th round of testing. The test result under actionx refers to the test result obtained according to the resource capacity yx of the N-th round of testing determined by adjusting the candidate resource capacity of the (N - 1)-th round of testing according to actionx.
[0159] Among them, "ending" means selecting the candidate resource capacity of the (N - 1)-th round of testing as the lower limit resource capacity that meets the performance indicator indicated by the test condition for the model to be tested.
[0160] In this embodiment, the resource capacity testing process is as Figure 9 shown. First, the server end obtains each test condition and starts to parse a single test condition (separately parse each test condition, and multiple test conditions corresponding to the same model are also independently parsed). After the server end completes the parsing of a single test condition, it schedules the test process to test each test condition with the scheduled process.
[0161] For each test condition, traverse each performance indicator under this test condition. Among them, this traversal process may include:
[0162] Schedule the single-performance test scheduling process (the process for executing a single test condition) to randomly generate the initial resource capacity for the component service (that is, the component service to be tested in the foregoing embodiment). Then, the server end controls the model indicated by this test condition to configure the foregoing generated initial resource capacity to obtain a test container; set the performance parameters (including the quantifiable first performance parameter and the non-quantifiable second performance parameter), and start the performance test trigger to control the model indicated by the test condition to run the component service in the test container;
[0163] Then determine whether it is necessary to measure the first performance parameter. If it is not necessary to measure the first performance parameter, it means that the performance detection result is determined by the non-quantifiable second performance parameter. At this time, continue to determine whether the component service is normal. If the component service runs normally, determine the candidate resource capacity and determine the resource capacity of the next test round according to the candidate resource capacity. If the component service is not normal, determine that the performance indicator is not met and continue to determine the resource capacity of the next test round (still need to determine the candidate resource capacity from the resource capacity of the current round and then determine the resource capacity of the next test round according to the candidate resource capacity);
[0164] If it is necessary to measure the first performance parameter, determine whether the first performance parameter meets the preset conditions and whether the component service is normal. If the first performance parameter meets the preset conditions and the component service is running normally, determine that the performance index is achieved and determine the candidate resource capacity. If the first performance parameter does not meet the preset conditions and / or the component service is running abnormally, determine that the performance index is not achieved, and continue to determine the resource capacity for the next test round (still determine the candidate resource capacity from the resource capacity of the current round, and then determine the resource capacity for the next test round based on the candidate resource capacity). Iterate in this way until the test end condition is met, determine that the single performance test corresponding to this test condition ends, and determine the lower limit resource capacity corresponding to this test condition (that is, Figure 10 the single performance test resource capacity in
[0165] Traverse all the performance indicators under each test condition according to the above-mentioned process of each performance indicator under each test condition, and obtain the lower limit resource capacity of all test conditions under their respective multiple performance indicators. Then, determine the lower limit resource capacity of the same model under the corresponding multiple performance indicators from the lower limit resource capacity of all test conditions under their respective multiple performance indicators. Then, select the maximum value to construct the upper limit resource capacity: According to the lower limit resource values of each hardware resource in the lower limit resource capacity of the component service to be tested under the model to be tested to achieve multiple performance indicators, determine the maximum lower limit resource value of each hardware resource of the component service to be tested under the model to be tested; use the maximum lower limit resource value of each hardware resource of the component service to be tested under the model to be tested as the upper limit resource value of the component service to be tested under the model to be tested for the hardware resource. Traverse all the models to obtain the upper limit resource capacity of each model.
[0166] In this embodiment, iterative testing is performed for multiple test rounds until the test end condition is met, and the lower limit resource capacity is determined. Through the testing of multiple test rounds, the accuracy of the determined lower limit resource capacity is relatively high, avoiding the situation where the lower limit resource capacity is too low or too high caused by a single test. Thus, it is possible to avoid the abnormal operation of the component service caused by the too low lower limit resource capacity and the waste of resources caused by the too high lower limit resource capacity.
[0167] In addition, when performing component service testing, combine the first performance test result of the quantifiable first performance parameter and the second performance test result of the non-quantifiable second performance parameter to obtain the performance test result, so that the accuracy of the performance test result is relatively high. Thus, the test accuracy of each test round is relatively high, improving the accuracy of the determined lower limit resource capacity, and further improving the accuracy of the upper limit resource capacity determined based on the lower limit resource capacity.
[0168] Please refer to Figure 10 , Figure 10The block diagram of a resource capacity testing device proposed by an embodiment of the present application is shown. The device 1000 includes:
[0169] An acquisition module 1010, configured to acquire a plurality of test conditions set for a component service to be tested; one test condition indicates one performance metric and one model to be tested; for each model to be tested, there are at least two performance metrics in the plurality of test conditions;
[0170] A test module 1020, configured to, for each test condition, control the component service to be tested to run when each resource capacity among a plurality of resource capacities allocated for the component service to be tested in the model to be tested indicated by the test condition is provided, and perform performance detection on the component service to be tested, so as to obtain performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested, where the performance test results are used to indicate whether the performance metric in the test condition is met;
[0171] A first determination module 1030, configured to determine the lower limit resource capacity at which the component service to be tested meets each performance metric in the model to be tested according to the performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested;
[0172] A second determination module 1040, configured to determine the upper limit resource capacity of the component service to be tested in the model to be tested according to the lower limit resource capacities at which the component service to be tested meets a plurality of performance metrics in the model to be tested.
[0173] Optionally, the plurality of resource capacities allocated for the component service to be tested include the resource capacities of each round in multiple rounds of testing; the test module 1020 is further configured to control the model to be tested to run the component service to be tested when the resource capacity of the M-th round of testing is allocated for the component service to be tested, and perform performance detection on the component service to be tested, so as to obtain the test result of the M-th round when the component service to be tested is provided with the resource capacity of the M-th round of testing by the model to be tested; where M is a positive integer; the resource capacity of the first round of testing is preset; according to the test result of the M-th round, the resource capacity of the M-th round of testing is adjusted to obtain the resource capacity of the (M + 1)-th round of testing; M is incremented by 1, and the step of returning to execute the control to make the model to be tested run the component service to be tested when the resource capacity of the M-th round of testing is allocated for the component service to be tested, and perform performance detection on the component service to be tested, so as to obtain the test result of the M-th round when the component service to be tested is provided with the resource capacity of the M-th round of testing by the model to be tested is performed until the test end condition is reached.
[0174] Optionally, when M is greater than 1, there are multiple resource capacities for the M-th round of testing; the testing module 1020 is further configured to, if there is a qualified test result indicating that the performance index in the test condition is reached in the M-th round of test results, determine the smallest resource capacity from the qualified resource capacities of the M-th round of testing as the candidate resource capacity for the M-th round of testing; the qualified resource capacity is the resource capacity corresponding to the qualified test result in the M-th round of testing; if the M-th round of test results all indicate that the performance index in the test condition is not reached, determine the largest resource capacity from the resource capacities of the M-th round of testing as the candidate resource capacity for the M-th round of testing; determine the resource capacity for the (M + 1)-th round of testing according to the candidate resource capacity for the M-th round of testing and the test result corresponding to the candidate resource capacity for the M-th round of testing.
[0175] Optionally, the testing module 1020 is further configured to determine the resource capacity adjustment direction according to the test result corresponding to the candidate resource capacity in the M-th round of test results; adjust the candidate resource capacity for the M-th round of testing according to the resource capacity adjustment direction and a preset resource capacity adjustment step size to obtain the resource capacity for determining the (M + 1)-th round of testing.
[0176] Optionally, if the test result corresponding to the candidate resource capacity for the (N - 1)-th round of testing indicates that the performance index in the test condition is not reached and the resource values of the target hardware resources in the qualified resource capacities for the N-th round of testing are not less than the resource values of the target hardware resources in the candidate resource capacity for the (N - 1)-th round of testing, it is determined that the test end condition is satisfied; where N is an integer greater than 2; the target hardware resource is any one of the multiple hardware resources required during the operation of the component service to be tested on the device to be tested; the first determination module 1030 is further configured to select the smallest qualified resource capacity from the resource capacities for the N-th round of testing as the lower limit resource capacity for the component service to be tested to reach the performance index indicated by the test condition on the device to be tested indicated by the test condition.
[0177] Optionally, if the test result corresponding to the candidate resource capacity for the (N - 1)-th round of testing indicates that the performance index in the test condition is reached and the N-th round of test results all indicate that the performance index in the test condition is not reached, it is determined that the test end condition is satisfied; the first determination module 1030 is further configured to obtain the candidate resource capacity corresponding to the (N - 1)-th round of testing as the lower limit resource capacity for the component service to be tested to reach the performance index indicated by the test condition on the device to be tested indicated by the test condition.
[0178] Optionally, the test module 1020 is further configured to allocate the resource capacity for the Mth round of testing for the component to be tested based on the model to be tested, generate a target test container configured according to the resource capacity of the Mth round of testing in the model to be tested; control the model to be tested to run the component service to be tested in its own target test container; perform performance detection on the component service to be tested during the process of running the component service to be tested in the target test container, and obtain the test result of the Mth round when the component service to be tested provides the resource capacity of the Mth round of testing in the model to be tested.
[0179] Optionally, the performance metrics include sub-performance metrics corresponding to at least two performance parameters respectively; the at least two performance parameters include a quantifiable first performance parameter and a second performance parameter reflected by the running state; the test module 1020 is further configured to detect the first performance parameter during the process of running the component service to be tested in the target test container, and determine the first performance test result of the component service to be tested for the first performance parameter when the model to be tested provides the resource capacity of the Mth round of testing according to the sub-performance metric corresponding to the first performance parameter; during the process of running the component service to be tested in the target test container, determine the second performance test result of the component service to be tested for the second performance parameter when the model to be tested provides the resource capacity of the Mth round of testing according to the running state of the component service to be tested; the running state is that the component service to be tested runs normally or the component service to be tested runs abnormally; determine the test result of the Mth round when the component service to be tested provides the resource capacity of the Mth round of testing in the model to be tested according to the first performance test result of the component service to be tested for the first performance parameter and the second performance test result for the second performance parameter when the model to be tested provides the resource capacity of the Mth round of testing.
[0180] Optionally, the lower limit resource capacity includes the lower limit resource values of each hardware resource; the upper limit resource capacity includes the upper limit resource values of each hardware resource; the second determination module 1040 is further configured to determine the maximum lower limit resource value of each hardware resource for the component service to be tested in the model to be tested according to the lower limit resource values of each hardware resource in the lower limit resource capacity of multiple performance metrics reached by the component service to be tested in the model to be tested; use the maximum lower limit resource value of each hardware resource for the component service to be tested in the model to be tested as the upper limit resource value of the hardware resource for the component service to be tested in the model to be tested.
[0181] Optionally, the acquisition module 1010 is further configured to determine multiple performance metrics set for the component service to be tested and at least one model to be tested capable of running the component service to be tested; combine the multiple performance metrics set for the component service to be tested and the model identification of at least one model to be tested to determine multiple service test conditions corresponding to the component service to be tested.
[0182] It should be noted that the device embodiments in this application correspond to the foregoing method embodiments. The specific principles in the device embodiments can be referred to the content in the foregoing method embodiments and will not be elaborated here.
[0183] Figure 11 FIG. shows a structural block diagram of an electronic device for performing a resource capacity testing method according to an embodiment of the present application. The electronic device may be Figure 1 such as the server 10 in Figure 11 The computer system 1200 of the electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0184] As Figure 11 shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage section 1208 into the random access memory (RAM) 1203, such as executing the method in the above embodiments. In the RAM 1203, various programs and data required for system operations are also stored. The CPU 1201, ROM 1202, and RAM 1203 are connected to each other via a bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.
[0185] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and speakers; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that the computer program read from it can be installed into the storage section 1208 as needed.
[0186] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.
[0187] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, apparatus, or device. In the present application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium can send, propagate, or transmit a program for use by or combined with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0188] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutively represented blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0189] The units involved in the embodiments described in the present application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not, in some cases, constitute a limitation on the unit itself.
[0190] On the other hand, the present application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The above computer-readable storage medium carries computer-readable instructions, and when the computer-readable storage instructions are executed by a processor, the methods in any of the above embodiments are implemented.
[0191] According to one aspect of the embodiments of the present application, there is provided a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods in any of the above embodiments.
[0192] It should be noted that although several modules or units of devices for performing actions are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0193] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a portable hard drive, etc.) or on a network, including several instructions to enable an electronic device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0194] After considering the specification and practicing the embodiments disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include the common general knowledge or conventional technical means in the technical field not disclosed in the present application. It should be understood that the present application is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
[0195] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A resource capacity testing method, characterized in that, The method includes: Obtaining a plurality of test conditions set for a component service to be tested; one test condition indicates one performance metric and one model to be tested; there are at least two performance metrics for each model to be tested among the plurality of test conditions; For each test condition, when controlling the resource capacities among the plurality of resource capacities allocated for the component service to be tested in the model to be tested indicated by the test condition, running the component service to be tested, and performing performance detection on the component service to be tested, obtaining performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested respectively, where the performance test results are used to indicate whether the performance metric in the test condition is met; According to the performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested respectively, determining the lower limit resource capacity for the component service to be tested to meet each performance metric in the model to be tested; According to the lower limit resource capacities for the component service to be tested to meet a plurality of performance metrics in the model to be tested, determining the upper limit resource capacity for the component service to be tested in the model to be tested.
2. The method according to claim 1, wherein The plurality of resource capacities allocated for the component service to be tested include the resource capacities for each round of testing in multiple rounds of testing; The controlling to run the component service to be tested and perform performance detection on the component service to be tested when the resource capacities among the plurality of resource capacities allocated for the component service to be tested in the model to be tested indicated by the test condition, and obtaining the performance test results of the component service to be tested under the plurality of resource capacities provided by the model to be tested respectively, includes: Controlling the model to be tested to run the component service to be tested when the resource capacity for the M-th round of testing is allocated for the component service to be tested, and performing performance detection on the component service to be tested, obtaining the test result of the M-th round of the component service to be tested when the model to be tested provides the resource capacity for the M-th round of testing; where M is a positive integer; the resource capacity for the first round of testing is preset; Adjusting the resource capacity for the M-th round of testing according to the test result of the M-th round of testing to obtain the resource capacity for the (M + 1)-th round of testing; Incrementing M by 1 in accumulation, and returning to execute the step of controlling the model to be tested to run the component service to be tested when the resource capacity for the M-th round of testing is allocated for the component service to be tested, and performing performance detection on the component service to be tested, obtaining the test result of the M-th round of the component service to be tested when the model to be tested provides the resource capacity for the M-th round of testing, until the test end condition is reached.
3. The method according to claim 2, wherein When M is greater than 1, the resource capacity for the M-th round of testing is multiple; The adjusting the resource capacity for the M-th round of testing according to the test result of the M-th round of testing to obtain the resource capacity for the (M + 1)-th round of testing includes: If there is a passing test result indicating that the performance index in the test conditions is achieved in the test results of the M-th round, determine the smallest resource capacity from the passing resource capacities of the M-th round as the candidate resource capacity of the M-th round; the passing resource capacity is the resource capacity corresponding to the passing test result in the M-th round. If the test results of the M-th round all indicate that the performance index in the test conditions is not achieved, determine the largest resource capacity from the resource capacities of the M-th round as the candidate resource capacity of the M-th round. Determine the resource capacity of the (M + 1)-th round according to the candidate resource capacity of the M-th round and the test results corresponding to the candidate resource capacity of the M-th round.
4. The method according to claim 3, wherein The determining the resource capacity of the (M + 1)-th round according to the candidate resource capacity of the M-th round and the test results corresponding to the candidate resource capacity of the M-th round includes: Determine the resource capacity adjustment direction according to the test results corresponding to the candidate resource capacity in the test results of the M-th round. Adjust the candidate resource capacity of the M-th round according to the resource capacity adjustment direction and the preset resource capacity adjustment step size to obtain the resource capacity for determining the (M + 1)-th round of testing.
5. The method according to claim 3, characterized in that, If the test results corresponding to the candidate resource capacity of the (N - 1)-th round indicate that the performance index in the test conditions is not achieved and the resource values of the target hardware resources in the passing resource capacities of the N-th round are not less than the resource values of the target hardware resources in the candidate resource capacity of the (N - 1)-th round, it is determined that the test end condition is satisfied; where N is an integer greater than 2; the target hardware resource is any one of the multiple hardware resources required during the operation of the component to be tested on the model to be tested. The determining the lower limit resource capacity for the component to be tested to reach each performance index on the model to be tested according to the performance test results of the component to be tested under multiple resource capacities provided by the model to be tested includes: Select the smallest passing resource capacity from the resource capacities of the N-th round as the lower limit resource capacity for the component to be tested to reach the performance index indicated by the test conditions on the model to be tested indicated by the test conditions.
6. The method according to claim 3, wherein If the test results corresponding to the candidate resource capacity of the (N - 1)-th round indicate that the performance index in the test conditions is achieved and the test results of the N-th round all indicate that the performance index in the test conditions is not achieved, it is determined that the test end condition is satisfied. The determining the lower limit resource capacity for the component to be tested to reach each performance index on the model to be tested according to the performance test results of the component to be tested under multiple resource capacities provided by the model to be tested includes: Obtain the candidate resource capacity corresponding to the (N - 1)-th round of testing as the lower limit resource capacity for the component to be tested to reach the performance index indicated by the test conditions on the model to be tested indicated by the test conditions.
7. The method according to claim 2, characterized in that, When controlling the resource capacity of the model under test to allocate the M-th round of test resources for the component service under test, running the component service under test, and performing performance detection on the component service under test to obtain the M-th round of test results of the component service under test when the model under test provides the resource capacity of the M-th round of test, it includes: Based on the resource capacity of the M-th round of test allocated by the model under test for the component service under test, generating a target test container configured according to the resource capacity of the M-th round of test in the model under test; Controlling the model under test to run the component service under test in its target test container; During the process of running the component service under test in the target test container, performing performance detection on the component service under test to obtain the M-th round of test results of the component service under test when the model under test provides the resource capacity of the M-th round of test.
8. The method according to claim 7, wherein The performance indicators include sub-performance indicators corresponding to at least two performance parameters respectively; the at least two performance parameters include a quantifiable first performance parameter and a second performance parameter reflected by the running state; The process of performing performance detection on the component service under test during the process of running the component service under test in the target test container to obtain the M-th round of test results of the component service under test when the model under test provides the resource capacity of the M-th round of test includes: During the process of running the component service under test in the target test container, detecting the first performance parameter, and determining the first performance test result of the component service under test for the first performance parameter when the model under test provides the resource capacity of the M-th round of test according to the sub-performance indicator corresponding to the first performance parameter; During the process of running the component service under test in the target test container, determining the second performance test result of the component service under test for the second performance parameter when the model under test provides the resource capacity of the M-th round of test according to the running state of the component service under test; the running state is that the component service under test runs normally or the component service under test runs abnormally; According to the first performance test result of the component service under test for the first performance parameter and the second performance test result for the second performance parameter when the model under test provides the resource capacity of the M-th round of test, determining the M-th round of test results of the component service under test when the model under test provides the resource capacity of the M-th round of test.
9. The method according to claim 1, wherein The lower limit resource capacity includes the lower limit resource values of each hardware resource; the upper limit resource capacity includes the upper limit resource values of each hardware resource; The process of determining the upper limit resource capacity of the component service under test on the model under test according to the lower limit resource capacity at which the component service under test reaches multiple performance indicators on the model under test includes: Determine the maximum lower limit resource value for each hardware resource of the component service to be tested under the model to be tested according to the lower limit resource values of the respective hardware resources in the lower limit resource capacity of the component service to be tested under the model to be tested when reaching multiple performance indicators; Use the maximum lower limit resource value for each hardware resource of the component service to be tested under the model to be tested as the upper limit resource value for the component service to be tested under the model to be tested for the respective hardware resources.
10. The method according to claim 1, characterized in that The obtaining of multiple test conditions set for the component service to be tested includes: Determine multiple performance indicators set for the component service to be tested and at least one model to be tested on which the component service to be tested can run; Combine the multiple performance indicators set for the component service to be tested and the model identifiers of the at least one model to be tested to determine multiple service test conditions corresponding to the component service to be tested.
11. A resource capacity testing device, characterized in that, The device includes: An obtaining module, configured to obtain multiple test conditions set for the component service to be tested; one test condition indicates one performance indicator and one model to be tested; the multiple test conditions have at least two performance indicators for each model to be tested; A testing module, configured to, for each test condition, when the test condition indicates that each resource capacity in the multiple resource capacities allocated to the component service to be tested on the model to be tested, run the component service to be tested and perform performance detection on the component service to be tested, and obtain performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested, where the performance test results are used to indicate whether the performance indicators in the test conditions are met; A first determination module, configured to determine the lower limit resource capacity for the component service to be tested under the model to be tested to reach each performance indicator according to the performance test results of the component service to be tested under the multiple resource capacities provided by the model to be tested; A second determination module, configured to determine the upper limit resource capacity for the component service to be tested under the model to be tested according to the lower limit resource capacity for the component service to be tested under the model to be tested when reaching multiple performance indicators.
12. An electronic device, characterized in that, Includes: A processor; A memory, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor, the method according to any one of claims 1-10 is implemented.
13. A computer-readable storage medium, characterized in that, On which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor, the method according to any one of claims 1-10 is implemented.
14. A computer program product or a computer program, characterized in that, Includes computer instructions, characterized in that when the computer instructions are executed by the processor, the method according to any one of claims 1-10 is implemented.