A load simulation method, apparatus and related products
Patent Information
- Application Number
- CN202510359530.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2026-09-25
AI Technical Summary
但在面对复杂多变的负载情况下,难以更好的实现自动缩扩容机制,也即通过相关技术方案模拟获得的负载的灵活性较低,其无法动态调整集群的负载情况,从而难以更好的实现对于自动扩缩容机制的验证
[0022]本申请技术方案中首先获取待模拟负载的负载配置信息,此后根据负载模拟类型和负载模拟数据,获得待模拟负载对应的负载配置函数,以及根据负载配置函数和负载模拟数据,获得待模拟负载对应的负载变化时段表,最后对待模拟负载对应的负载变化时段表进行模拟处理,获得待模拟负载对应的负载变化趋势。需要说明的是,负载配置信息根据待模拟负载的所需的负载变化趋势确定,负载配置信息包括负载模拟类型和负载模拟数据。
Smart Images

Figure CN122817042A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of load simulation technology, and in particular to a load simulation method, apparatus and related products. Background Technology
[0002] In cloud-native architectures, scaling up is typically achieved by increasing the load on the cluster, and scaling down is achieved by decreasing the load on the cluster. Related technologies usually involve using load testing tools or test cases to initiate load tests on the cluster to increase the load, and using the same tools or test cases to stop the load tests to decrease the load. This process verifies the automatic scaling up / down mechanism.
[0003] Specifically, in related technologies, when load testing is initiated on the cluster using load testing tools or test cases, the cluster load gradually increases and eventually stabilizes; when load testing is stopped using these tools or test cases, the cluster load gradually decreases and eventually returns to zero. However, when facing complex and variable load conditions, it is difficult to effectively implement an automatic scaling-up / scaling mechanism. In other words, the load simulated by related technical solutions has low flexibility and cannot dynamically adjust the cluster load, thus making it difficult to effectively verify the automatic scaling-up / scaling mechanism.
[0004] Therefore, how to improve the flexibility of the simulated load has become a pressing technical problem in the field. Summary of the Invention
[0005] This application provides a load simulation method, apparatus, and related products, which aim to improve the flexibility of the simulated load.
[0006] The first aspect of this application provides a load simulation method, comprising:
[0007] Obtain the load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and load simulation data;
[0008] Based on the load simulation type and the load simulation data, obtain the load configuration function corresponding to the load to be simulated;
[0009] Based on the load configuration function and the load simulation data, obtain the load change time period table corresponding to the load to be simulated;
[0010] The load change time period table corresponding to the load to be simulated is simulated to obtain the load change trend corresponding to the load to be simulated.
[0011] A second aspect of this application provides a load simulation apparatus, comprising:
[0012] A configuration information acquisition unit is used to acquire load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes load simulation type and load simulation data;
[0013] The configuration function obtaining unit is used to obtain the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data;
[0014] The load change time table acquisition unit is used to obtain the load change time table corresponding to the load to be simulated based on the load configuration function and the load simulation data.
[0015] The trend acquisition unit is used to perform simulation processing on the load change time period table corresponding to the load to be simulated, and obtain the load change trend corresponding to the load to be simulated.
[0016] A third aspect of this application provides a computer device, the device comprising a processor and a memory:
[0017] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0018] The processor is configured to execute the steps of the load simulation method provided in the first aspect according to the instructions in the computer program.
[0019] A fourth aspect of this application provides a computer-readable storage medium for storing a computer program that, when executed by a computer device, implements the steps of the load simulation method provided in the first aspect.
[0020] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a computer device, implements the steps of the load simulation method provided in the first aspect.
[0021] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0022] The technical solution of this application first obtains the load configuration information of the load to be simulated. Then, based on the load simulation type and load simulation data, it obtains the load configuration function corresponding to the load to be simulated. Next, based on the load configuration function and load simulation data, it obtains a load change time period table corresponding to the load to be simulated. Finally, it performs simulation processing on the load change time period table corresponding to the load to be simulated to obtain the load change trend corresponding to the load to be simulated. It should be noted that the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and the load simulation data.
[0023] As can be seen, in this application, the load configuration function can be determined by the load configuration information based on the required load change trend of the load to be simulated. Then, based on this load configuration function and the load simulation data in the load configuration information, a load change period table can be generated. This load change period table can simulate the load change trend of the load to be simulated. Thus, in this application, corresponding load configuration functions can be generated based on different load configuration information. Therefore, based on the load configuration function and the load simulation data in the load information, the load change trends of the load to be simulated with different requirements can be simulated, thereby improving the flexibility of the simulated load. Attached Figure Description
[0024] Figure 1 This is a schematic diagram illustrating the verification of scaling up and down provided in related technologies;
[0025] Figure 2 A scenario architecture diagram of a load simulation method provided in this application embodiment;
[0026] Figure 3 This application provides an embodiment of the internal architecture diagram of a server in a load simulation method.
[0027] Figure 4 A flowchart illustrating a load simulation method provided in this application embodiment;
[0028] Figure 5 A flowchart illustrating the method for obtaining a load configuration function in a load simulation approach provided in this application embodiment;
[0029] Figure 6 A flowchart illustrating another load simulation method provided in this application for obtaining a load configuration function;
[0030] Figure 7 A schematic diagram illustrating the determination of vertex coordinates in a load simulation method provided in an embodiment of this application;
[0031] Figure 8 A schematic diagram illustrating the determination of vertex coordinates in another load simulation method provided in this application embodiment;
[0032] Figure 9 This application provides a complete flowchart of the load simulation process in a load simulation method according to an embodiment of the present application.
[0033] Figure 10 A schematic diagram illustrating the load change trend in a load simulation method provided in this application embodiment;
[0034] Figure 11 A schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment;
[0035] Figure 12 A schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment;
[0036] Figure 13 A schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment;
[0037] Figure 14 A schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment;
[0038] Figure 15 A schematic diagram illustrating the load change trend in a further load simulation method provided in this application embodiment;
[0039] Figure 16 This is a schematic diagram of the structure of a load simulation device provided in an embodiment of this application;
[0040] Figure 17 This is a schematic diagram of the server structure in an embodiment of this application;
[0041] Figure 18 This is a schematic diagram of the structure of a terminal device in an embodiment of this application. Detailed Implementation
[0042] The embodiments of this application will now be described with reference to the accompanying drawings.
[0043] First, we will explain several terms that may be involved in the embodiments of this application below.
[0044] wrk: An HTTP benchmarking tool.
[0045] JMeter: An open-source load testing tool.
[0046] Scaling up / down mechanism: A mechanism that automatically adjusts resources based on load.
[0047] K8S: Kubernetes, an open-source container orchestration platform.
[0048] Scaling mechanism: HBA mechanism, Horizontal Pod Autoscaler, the native automatic horizontal scaling mechanism for Pods in Kubernetes.
[0049] Resource component: POD, which is the most basic computing unit in Kubernetes and is used to manage resources.
[0050] In cloud-native architectures, scaling up is typically achieved by increasing the load on the cluster, and scaling down is achieved by decreasing the load. Related technologies usually involve using load testing tools or test cases to initiate load tests on the cluster to increase the load, and then stopping the load tests to decrease the load, thus verifying the automatic scaling mechanism. Load testing tools include wrk and JMeter, and test cases include those written by project personnel. Specifically, in these technologies, after initiating load tests on the cluster using load testing tools or test cases, the cluster load gradually increases and eventually stabilizes; conversely, after stopping the load tests, the cluster load gradually decreases and eventually returns to zero.
[0051] like Figure 1 As shown, Figure 1 This is a schematic diagram illustrating the verification of scaling in related technologies. Figure 1 The diagram illustrates how, in related technologies, load testing tools or test cases are typically used to simulate load, thereby triggering the scaling mechanism in Kubernetes and adjusting the number of resource components. Specifically, when the load testing tool or test case starts, the load gradually increases, triggering the scaling mechanism to increase the number of resource components; conversely, when the load testing tool or test case stops, the load gradually decreases, triggering the scaling mechanism to decrease the number of resource components. This allows for the simulation of load through load testing tools or test cases, thus validating the scaling mechanism.
[0052] However, the simulated loads in related technologies only have three states: startup, stable, and shutdown. This limits the verification of simple scaling logic based on the simulated loads obtained from these technologies. However, when facing complex and variable loads, it is difficult to implement automatic scaling mechanisms effectively. In other words, the loads simulated using these technologies have low flexibility and cannot dynamically adjust the cluster's load, thus hindering the verification of automatic scaling mechanisms. Therefore, improving the flexibility of simulated loads has become a pressing technical problem in this field.
[0053] In view of the above problems, this application provides a load simulation method, apparatus, and related products, aiming to improve the flexibility of the simulated load. In the technical solution provided in this application, firstly, the load configuration information of the load to be simulated can be obtained. Then, based on the load simulation type and load simulation data, the load configuration function corresponding to the load to be simulated can be obtained. Furthermore, based on the load configuration function and load simulation data, a load change time period table corresponding to the load to be simulated can be obtained. Finally, the load change time period table corresponding to the load to be simulated can be simulated to obtain the load change trend corresponding to the load to be simulated. It should be noted that the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and the load simulation data.
[0054] As can be seen, in this application, the load configuration function can be determined by the load configuration information based on the required load change trend of the load to be simulated. Then, based on this load configuration function and the load simulation data in the load configuration information, a load change period table can be generated. This load change period table can simulate the load change trend of the load to be simulated. Thus, in this application, corresponding load configuration functions can be generated based on different load configuration information, realizing dynamic adjustment of the load configuration function. Based on the load configuration function and the load simulation data in the load information, load change trends of the load to be simulated with different requirements can be generated, thereby improving the flexibility of the simulated load and enabling better automatic scaling mechanisms under different load environments.
[0055] The execution subject of the load simulation method provided in this application embodiment can be a terminal device. For example, the load configuration information of the load to be simulated can be obtained on the terminal device. As an example, the terminal device may include, but is not limited to, mobile phones, desktop computers, tablet computers, laptops, PDAs, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The execution subject of the load simulation method provided in this application embodiment can also be a server, that is, the load configuration information of the load to be simulated can be obtained on the server. In addition, the load simulation method provided in this application embodiment can also be executed collaboratively by the terminal device and the server. The terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited here. Therefore, the implementation subject of the technical solution of this application is not limited in this application embodiment.
[0056] Figure 2An exemplary scenario architecture diagram of a load simulation method is shown. The diagram includes a server and various types of terminal devices. For example, firstly, the load configuration information of the load to be simulated can be obtained through the terminal devices. Then, the server determines the load configuration function based on the load simulation type and load simulation data in the load configuration information. Based on this load configuration function and the load simulation data in the load configuration information, a load change time period table is determined. Finally, the load change time period table can be simulated to obtain the load change trend corresponding to the load to be simulated. In this way, the load configuration function can be dynamically adjusted, thereby improving the flexibility of the simulated load.
[0057] Figure 2 The server shown can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. Furthermore, the server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. It should be noted that the server in this application can be a server supporting a single-core CPU, or it can be a server supporting multiple-core CPUs. Understandably, this application, after determining the load configuration function based on load configuration information, can generate load change trends for single-core CPUs based on the load configuration function, and it can also generate load change trends for multiple-core CPUs based on the load configuration function.
[0058] like Figure 3 As shown, Figure 3 This is an internal architecture diagram of a server in a load simulation method provided in an embodiment of this application. Figure 3 The server mainly uses CPU tools to simulate the load change trend corresponding to the load to be simulated. Specifically, in this application, the number of resource components can be adjusted by simulating the load change trend using CPU tools, so as to dynamically adjust the scaling-up and scaling-down mechanisms.
[0059] See Figure 4 This figure is a flowchart of a load simulation method provided in an embodiment of this application. Figure 4 The load simulation method shown includes the following steps:
[0060] S401: Obtain the load configuration information of the load to be simulated.
[0061] In this step, the load to be simulated can be understood as the load to be simulated. The load configuration information is determined based on the required load change trend of the load to be simulated. That is, in this application, the load configuration information can be determined according to the load change trend to be simulated. For example, if the required load change trend is a steep upward trend, the load configuration information can be determined based on the steep upward trend; or if the required load change trend is a steep downward trend, the load configuration information can be determined based on the steep downward trend; or if the required load change trend is a smooth upward trend, the load configuration information can be determined based on the smooth upward trend; or if the required load change trend is a smooth downward trend, the load configuration information can be determined based on the smooth downward trend.
[0062] The load configuration information supports the generation of load configuration functions. Understandably, the load configuration function changes according to the changes in the load configuration information, thereby simulating the required load change trend. Furthermore, the load configuration information includes load simulation type and load simulation data. The load simulation type represents the type of change curve corresponding to the load change trend, and the load simulation data supports determining the required load change trend of the load to be simulated. In other words, in this application, the load change trend can be adjusted by adjusting the load simulation data. It should be noted that this load configuration information can be preset manually or set each time a load change trend needs to be simulated. The load configuration information can also be obtained according to actual needs in practical applications.
[0063] S402: Based on the load simulation type and the load simulation data, obtain the load configuration function corresponding to the load to be simulated.
[0064] In this step, the load configuration function corresponding to the load to be simulated can be determined based on the load simulation type and load simulation data. In other words, this application can determine the load configuration information based on the required load change trend of the load to be simulated, and further determine the load configuration function that can support the simulation of the load change trend of the load to be simulated. This facilitates the simulation of the load change trend based on the load configuration function in subsequent processes.
[0065] In the embodiments of this application, the aforementioned S402 can be implemented in various ways, which will be described below. It should be noted that the implementation methods given below are only illustrative examples and do not represent all implementation methods of the embodiments of this application.
[0066] The first optional implementation of S402 is as follows:
[0067] First, it should be noted that the load simulation type includes linear load simulation, which represents a linear load change trend. The load simulation data includes a first load simulation group and a second load simulation group. The first load simulation group includes a first simulation time and a corresponding first load utilization rate. The second load simulation group includes a second simulation time and a corresponding second load utilization rate. The first simulation time occurs earlier than the second simulation time. The first load utilization rate differs from the second load utilization rate. Both the first and second load utilization rates represent CPU load utilization. It should also be noted that the load simulation data may include other load simulation groups, which can be determined based on the required load change trend in practical applications.
[0068] Specifically, the first simulation time and first load utilization rate in the first load simulation group can be understood as the CPU load utilization reaching the first load utilization rate within the first simulation time; similarly, the second simulation time and second load utilization rate in the second load simulation group can be understood as the CPU load utilization reaching the second load utilization rate within the second simulation time. For example, if the CPU load utilization reaches 50% within 60 seconds, and then drops to 30% within the next 20 seconds, where the first simulation time is 60 seconds and the first load utilization rate is 50%, and the second simulation time is 20 seconds and the second load utilization rate is 30%, then by configuring the load simulation data as described above, the subsequent simulated load change trend can exhibit a steep downward trend.
[0069] In one feasible implementation, the load configuration information can be represented by code, specifically as follows (where LinearCfg represents the load simulation type, CPULimit represents the load utilization, and TimeDuration represents the simulation time):
[0070] LinearCfg:# Linear function
[0071] Action:
[0072] -CPULimit:50
[0073] TimeDuration: 60
[0074] -CPULimit:30
[0075] TimeDuration: 20
[0076] like Figure 5 As shown, Figure 5 This is a flowchart illustrating the method for obtaining a load configuration function in a load simulation approach provided in this application. Figure 5Steps S402A1-S402A3 are shown in the diagram. The specific implementation of steps S402A1-S402A3 is as follows:
[0077] S402A1: Obtain multiple simulation coordinates based on the first simulation time, the first load utilization rate, the second simulation time, and the second load utilization rate.
[0078] It should be noted that before performing the operation of obtaining multiple simulated coordinates based on the first simulation time, the first load utilization, the second simulation time, and the second load utilization, this application can also obtain the initial simulation time and the initial load utilization corresponding to the initial simulation time. Since the server is not started at this time, the initial simulation time can be 0 seconds and the initial load utilization can be 0%, that is, at 0 seconds, the CPU load utilization is 0%.
[0079] Furthermore, in this application, the initial simulation time and initial load utilization can be processed to obtain a first sub-coordinate, and the first simulation time and first load utilization can be processed to obtain a second sub-coordinate. The first and second sub-coordinates can then be combined to obtain a first coordinate group, for example, (0,0) and (60,50). The first coordinate group is used to determine a first configuration function, which can be understood as a piecewise function, including the function corresponding to the first load simulation group.
[0080] In this application, the first simulation time, the second simulation time, and the second load utilization rate can be processed to obtain a third sub-coordinate. The second and third sub-coordinates can then be combined to obtain a second coordinate group, such as (60, 50) and (80, 30). This second coordinate group is used to determine the second configuration function, which can be understood as a piecewise function including the function corresponding to the second load simulation group. Finally, the first and second coordinate groups can be used as multiple simulation coordinates to determine the first and second configuration functions. Thus, in this application, multiple simulation coordinates can be determined based on the first simulation time, the first load utilization rate, the second simulation time, and the second load utilization rate, so that subsequent processes can determine the configuration function corresponding to each load simulation group based on these multiple simulation coordinates.
[0081] S402A2: Calculate and process the multiple simulation coordinates based on the linear load simulation to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group.
[0082] In this step, the linear configuration function corresponding to the linear load simulation can be determined first based on the linear load simulation. Then, the first coordinate group among multiple simulation coordinates can be calculated and processed according to the linear configuration function to obtain the first configuration function corresponding to the first load simulation group. The second coordinate group among multiple simulation coordinates can be calculated and processed according to the linear configuration function to obtain the second configuration function corresponding to the second load simulation group.
[0083] In one feasible implementation, the linear allocation function can be Equation (1), which is specifically embodied as follows:
[0084] Formula (1) is y = kx + b.
[0085] Where (x, y) represents the sub-coordinates, and k and b represent the function coefficients of the linear configuration function.
[0086] Furthermore, it can be understood that in this application, the first coordinate group among multiple simulated coordinates can be calculated and processed according to the linear configuration function to obtain the first function coefficient and the second function coefficient. Then, based on the first function coefficient and the second function coefficient, the first configuration function corresponding to the first load simulation group can be obtained. Similarly, the second coordinate group among multiple simulated coordinates can be calculated and processed according to the linear configuration function to obtain the third function coefficient and the fourth function coefficient. Then, based on the third function coefficient and the fourth function coefficient, the second configuration function corresponding to the second load simulation group can be obtained.
[0087] S402A3: Use the first configuration function and the second configuration function as the load configuration function corresponding to the load to be simulated.
[0088] In one feasible implementation, the load configuration function can be formula (2), which is specifically embodied as follows:
[0089]
[0090] In this application, y = k1x + b1 represents the first configuration function, y = k2x + b1 represents the second configuration function, k1 represents the coefficient of the first function, b1 represents the coefficient of the second function, t0 represents the initial simulation time, t1 represents the first simulation time, k2 represents the coefficient of the third function, b2 represents the coefficient of the fourth function, t2 represents the second simulation time, x represents the independent variable, and y represents the dependent variable. This x can be changed as needed in subsequent processes. Thus, this application can generate the required load configuration function using different load configuration information, thereby supporting the effective simulation of various load change scenarios in subsequent processes.
[0091] The second optional implementation of S402 is as follows:
[0092] First, it should be noted that the load simulation type includes load curve simulation, which represents the load change trend as a curve load trend. The load simulation data includes the first load simulation group and the second load simulation group. It should also be noted that the load simulation data may include other load simulation groups, which can be determined in actual applications according to the required load change trend.
[0093] The first load simulation group includes a first load variable, a first simulation time, and a first load utilization rate corresponding to the first simulation time. The second load simulation group includes a second load variable, a second simulation time, and a second load utilization rate corresponding to the second simulation time. The occurrence time of the first simulation time is earlier than the occurrence time of the second simulation time. The first load utilization rate is different from the second load utilization rate. Both the first and second load utilization rates characterize CPU load utilization. The first and second load variables are used to indicate the opening direction of the configuration function. It can be understood that if the load variable is -1, it indicates that the opening direction of the configuration function of the load simulation group corresponding to that load variable is downward; if the load variable is 1, it indicates that the opening direction of the configuration function of the load simulation group corresponding to that load variable is upward.
[0094] Specifically, the first load variable, first simulation time, and first load utilization rate in the first load simulation group can be understood as the CPU load utilization reaching the first load utilization rate within the first simulation time, assuming the indicator function opens in the correct direction. Similarly, the second load variable, second simulation time, and second load utilization rate in the second load simulation group can be understood as the CPU load utilization reaching the second load utilization rate within the second simulation time, assuming the indicator function opens in the correct direction. For example, if the CPU load utilization reaches 50% within 60 seconds assuming the indicator function opens in the correct direction for the next segment, and then drops to 30% within the following 20 seconds assuming the next segment opens in the correct direction, where the first simulation time is 60 seconds and the first load utilization rate is 50%, and the second simulation time is 20 seconds and the second load utilization rate is 30%, then by configuring the load simulation data as described above, the subsequent simulated load change trend can exhibit a steep downward trend.
[0095] In one feasible implementation, the load configuration information can be represented by code, specifically as follows (where QuadraticCfg represents the load simulation type, CPULimit represents the load utilization, TimeDuration represents the simulation time, and Trend represents the load variable):
[0096] QuadraticCfg:# Quadratic function
[0097] Action:
[0098] -CPULimit:50
[0099] TimeDuration: 60
[0100] Trend: -1
[0101] -CPULimit:30
[0102] TimeDuration: 20
[0103] Trend:1
[0104] like Figure 6 As shown, Figure 6 A flowchart illustrating another load simulation method provided in this application for obtaining a load configuration function. Figure 6 Steps S402B1-S402B3 are shown in the diagram. The specific implementation of steps S402B1-S402B3 is as follows:
[0105] S402B1: Obtain multiple simulation coordinates based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate.
[0106] It should be noted that before performing the operation of obtaining multiple simulated coordinates based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate, this application can also obtain the initial load simulation time, the initial load utilization rate corresponding to the initial simulation time, and the vertex determination rule. Since the server is not started at this time, the initial simulation time can be 0 seconds, and the initial load utilization rate can be 0%, that is, at 0 seconds, the CPU load utilization rate is 0%.
[0107] The vertex determination rule is used to determine vertex coordinates based on the load variable. Further, it can be understood that in this application, the vertex determination rule includes rules for determining vertex coordinates based on the load variable. It should be noted that since three points are needed to fix a quadratic function, in this application, to more conveniently determine the quadratic function (configuration function), it is determined using one vertex coordinate and one random point coordinate. The following describes the process of determining vertex coordinates based on different load variables under the action of the vertex determination rule.
[0108] like Figure 7 As shown, Figure 7 This is a schematic diagram illustrating the determination of vertex coordinates in a load simulation method provided in an embodiment of this application. Figure 7If the vertex determination rule includes the rule that the opening direction of the configuration function indicating the load variable is upward, then the vertex coordinates can be determined based on the trend of load utilization changes, which is determined by the current load utilization and the previous load utilization. If the load utilization trend is upward, the vertex coordinates (t, c) can be obtained by constructing the simulation time and load utilization in the load simulation group corresponding to the load variable; if the load utilization trend is downward, the vertex coordinates (t1, c1) can be obtained by constructing the combined simulation time and load utilization in the load simulation group corresponding to the load variable, where the combined simulation time is obtained by adding the simulation time in the load simulation group corresponding to the load variable to the previous simulation time corresponding to the previous load utilization.
[0109] like Figure 8 As shown, Figure 8 This is a schematic diagram illustrating the determination of vertex coordinates in another load simulation method provided in this application embodiment. Figure 8 If the vertex determination rule includes the rule that the opening direction of the configuration function indicating the load variable is downward, then the vertex coordinates can be determined based on the trend of load utilization changes, which is determined by the current load utilization and the previous load utilization. If the load utilization trend is downward, the vertex coordinates (t, c) can be obtained by constructing the simulation time and load utilization in the load simulation group corresponding to the load variable; if the load utilization trend is upward, the vertex coordinates (t1, c1) can be obtained by constructing the combined simulation time and load utilization in the load simulation group corresponding to the load variable, where the combined simulation time is obtained by adding the simulation time in the load simulation group corresponding to the load variable to the previous simulation time corresponding to the previous load utilization.
[0110] Furthermore, in this application, the vertex determination rule can first be determined based on the first load variable: either the load variable indicates that the opening direction of the configuration function is upward, or the load variable indicates that the opening direction of the configuration function is downward. If the vertex determination rule is that the load variable indicates that the opening direction of the configuration function is downward (when Trend is -1), then the trend of load utilization between the initial load utilization and the first load utilization can be determined. If the trend of load utilization is upward (i.e., from 0% to 50%), then the initial simulation time, the first simulation time, and the first load utilization can be processed to obtain the coordinates of the first vertex. It should be noted that when the initial simulation time is 0 seconds, the first simulation time is added to the initial simulation time to obtain the first simulation time, for example, the coordinates of the first vertex are (60, 50).
[0111] Accordingly, in this application, the vertex determination rule can be determined based on the second load variable, either as a rule that the opening direction of the configuration function indicated by the load variable is upward, or as a rule that the opening direction of the configuration function indicated by the load variable is downward. If the vertex determination rule is that the opening direction of the configuration function indicated by the load variable is upward (when Trend is 1), then the trend of load utilization between the initial load utilization and the second load utilization can be determined. If the trend of load utilization is downward (i.e., from 50% to 30%), then the first simulation time, the second simulation time, and the second load utilization can be processed to obtain the second vertex coordinates, for example, the second vertex coordinates are (80, 30). It should be noted that in practical applications, the vertex coordinates can also change according to the changing trends of the load variable and the load utilization.
[0112] Furthermore, in this application, the initial simulation time and initial load utilization can be processed to obtain the first random point coordinates, and the first simulation time and first load utilization can be processed to obtain the second random point coordinates. Afterwards, the first vertex coordinates and the first random point coordinates can be combined to obtain a first coordinate group, and the second vertex coordinates and the second random point coordinates can be combined to obtain a second coordinate group. For example, the first coordinate group could be (0,0) and (60,50), and the second coordinate group could be (60,50) and (80,30).
[0113] The first coordinate group is used to determine the first configuration function, and the second coordinate group is used to determine the second configuration function. The first and second configuration functions can be understood as piecewise functions. The first configuration function includes the function corresponding to the first load simulation group, and the second configuration function includes the function corresponding to the second load simulation group. Finally, the first and second coordinate groups can be used as multiple simulation coordinates. Thus, in this application, multiple simulation coordinates can be determined based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate, so that subsequent processes can determine the configuration function corresponding to each load simulation group based on these multiple simulation coordinates.
[0114] S402B2: Based on the load curve simulation, the multiple simulation coordinates are calculated and processed to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group.
[0115] In this step, the curve configuration function corresponding to the load curve simulation can be determined firstly based on the load curve simulation. Then, the first coordinate group among multiple simulation coordinates can be calculated and processed according to the curve configuration function to obtain the first configuration function corresponding to the first load simulation group. The second coordinate group among multiple simulation coordinates can be calculated and processed according to the curve configuration function to obtain the second configuration function corresponding to the second load simulation group.
[0116] In one feasible implementation, the curve configuration function can be formula (3), which is specifically embodied as follows:
[0117] y = a(xh) 2 +k Formula (3)
[0118] Where (h, k) represents the vertex coordinates, (x, y) represents the coordinates of a random point, and a represents the function coefficient of the linear collocation function. This a can also represent the opening direction of the curve collocation function.
[0119] Furthermore, it can be understood that in this application, the first coordinate group among multiple simulated coordinates can be calculated and processed according to the curve configuration function to obtain the first function coefficients. Subsequently, based on the first function coefficients, the first configuration function corresponding to the first load simulation group can be obtained. Similarly, the second coordinate group among multiple simulated coordinates can be calculated and processed according to the curve configuration function to obtain the second function coefficients. Subsequently, based on the second function coefficients, the second configuration function corresponding to the second load simulation group can be obtained.
[0120] S402B3: Use the first configuration function and the second configuration function as the load configuration function corresponding to the load to be simulated.
[0121] In one feasible implementation, the load configuration function can be formula (4), which is specifically embodied as follows:
[0122]
[0123] Where y = a1(x - h1) 2 +k1 represents the first allocation function, y = a2(x - h2). 2+k2 represents the second configuration function, (h1, k1) represents the first vertex coordinates, a1 represents the first function coefficients, t0 represents the initial simulation time, t1 represents the first simulation time, (h2, k2) represents the second vertex coordinates, a2 represents the first function coefficients, t2 represents the second simulation time, x represents the independent variable, and y represents the dependent variable. This x can be changed as needed in subsequent processes. Thus, in this application, the required load configuration function can be generated using different load configuration information, thereby supporting the effective simulation of various load change scenarios in subsequent processes.
[0124] The third optional implementation of S402 is as follows:
[0125] First, it's important to note that load simulation types include sinusoidal load simulation, which represents a sinusoidal load change trend. The load simulation data includes an upper limit and a lower limit of load utilization, as well as the simulation time, which represents the simulation period. This period allows for the simulation of the load and the acquisition of the load change trend for the simulated load. It's also worth noting that load simulation types include cosine and tangent load simulations. The load simulation data can be determined based on the desired load change trend in practical applications. For example, the upper limit of load utilization could be 70%, the lower limit 20%, and the simulation time 300 seconds.
[0126] In one feasible implementation, the load configuration information can be represented by code, specifically as follows (where LinearCfg represents the load simulation type, CPULimit represents the load utilization, and TimeDuration represents the simulation time):
[0127] TrigonmetryCfg:#Sine function
[0128] Upper Limit: 70
[0129] LowerLimit:20
[0130] Cycle: 300
[0131] Specifically, this application first determines the sinusoidal configuration function corresponding to the sinusoidal load simulation based on the load sinusoidal simulation. Then, it calculates the upper and lower limits of load utilization and the load simulation time based on the sinusoidal configuration function to obtain the amplitude, period, phase, and vertical translation. Finally, it determines the load configuration function corresponding to the load to be simulated based on the amplitude, period, phase, and vertical translation. Thus, this application can generate the required load configuration function using different load configuration information, thereby supporting the effective simulation of various load change scenarios in subsequent processes.
[0132] In one feasible implementation, the load configuration function can be formula (5), which is specifically embodied as follows:
[0133]
[0134] In this context, UpperLimit represents the upper limit of load utilization, LowerLimit represents the lower limit of load utilization, x represents the independent variable, and y represents the dependent variable. The x value can be changed according to requirements in subsequent processes.
[0135] It should be noted that, for the above three optional implementation methods, the terminal device may choose one or combine multiple methods to implement them, and this application does not impose any restrictions on this.
[0136] S403: Based on the load configuration function and the load simulation data, obtain the load change time period table corresponding to the load to be simulated.
[0137] It should be noted that, in order to improve the flexibility of the simulated load, this application proposes controlling the ratio of CPU running and sleeping time to control CPU load utilization. Understandably, if the CPU is controlled to run for 700 milliseconds per second, followed by a 300 millisecond sleep period, the CPU load utilization can be stabilized at 70%. Based on this, this application proposes simulating CPU load utilization by constructing a load configuration function, meaning the CPU load utilization can fluctuate according to the curve of the load configuration function. In other words, by determining the load utilization for each time period, the non-idle time and idle time within each time period can be determined based on this load utilization. This achieves flexible control over the simulated load.
[0138] In the embodiments of this application, the aforementioned S403 can be implemented in various ways, which will be described below. It should be noted that the implementation methods given below are only illustrative examples and do not represent all implementation methods of the embodiments of this application.
[0139] The first optional implementation of S403 is mainly based on the load configuration function generated by load linear simulation and load curve simulation to determine the load change period table. The specific details of the first optional implementation are as follows:
[0140] First, it should be noted that before performing the operation of obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and load simulation data, this application can also obtain a preset time. This preset time is used to divide the simulation time, and can be 100 milliseconds. This preset time can also be set according to actual needs in practical applications. Specifically, the first simulation time in the load simulation data can be divided according to the preset time to obtain multiple first simulation time periods corresponding to the first simulation time. Similarly, the second simulation time in the load simulation data can be divided according to the preset time to obtain multiple second simulation time periods corresponding to the second simulation time. In one example, the first simulation time is 300 milliseconds, and the preset time is 100 milliseconds. In this case, the multiple first simulation time periods corresponding to the first simulation time can be simulation time period 1, simulation time period 2, and simulation time period 3.
[0141] Subsequently, for each first simulation period, the first simulation period can be calculated and processed according to the first configuration function in the load configuration function to obtain the corresponding load non-idle time and load idle time. Thus, for multiple first simulation periods, the corresponding load non-idle time and load idle time for each first simulation period can be obtained. Similarly, for each second simulation period, the second simulation period can be calculated and processed according to the second configuration function in the load configuration function to obtain the corresponding load non-idle time and load idle time. Thus, for multiple second simulation periods, the corresponding load non-idle time and load idle time for each second simulation period can be obtained.
[0142] In one feasible implementation, the load non-idle time and load idle time can be obtained by formulas (6) and (7) in this application. Formulas (6) and (7) are specifically embodied as follows:
[0143] busy[i]=k n t[i]+b n / busy[i] = a n (t[i]-h n ) 2 +k n Formula (6)
[0144] idle[i]=T-busy[i] formula (7)
[0145] Where busy[i] represents the non-idle time of the load corresponding to the i-th simulation period, i is greater than 0, t[i] represents the i-th simulation period, and a n k n and b n Characterizes the function coefficients calculated based on the nth load simulation group, where n is greater than 0, (h n k n ) represents the vertex coordinates calculated based on the nth load simulation group, T represents the preset time, and idle[i] represents the load idle time corresponding to the ith simulation period.
[0146] Finally, in this application, a load change time table corresponding to the load to be simulated can be generated based on the load non-idle time and load idle time corresponding to multiple first simulation time periods and the load non-idle time and load idle time corresponding to multiple second simulation time periods. For example, this load change time table can be represented as {(load non-idle time 1, load idle time 1), (load non-idle time 2, load idle time 2), ..., (load non-idle time n, load idle time n)}. Thus, in this application, under the action of the load configuration function and load configuration information, a load change time table corresponding to the load to be simulated can be generated, thereby enabling the effective simulation of the required load change trend based on the load non-idle time and load idle time in subsequent processes.
[0147] The second optional implementation of S403 is mainly based on the load configuration function generated by load sinusoidal simulation to determine the load change time period table. The specific details of the second optional implementation are as follows:
[0148] First, it should be noted that before performing the operation of obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and load simulation data, this application can also obtain a preset time, which is used to divide the simulation time. The preset time can be 100 milliseconds, and the preset time can also be set according to actual needs in actual applications.
[0149] Specifically, this application first divides the load simulation time in the load simulation data according to a preset time to obtain multiple load simulation time periods corresponding to the load simulation time. Then, it calculates and processes these multiple load simulation time periods according to a load configuration function to obtain the load non-idle time and load idle time corresponding to each load simulation time period. Finally, based on the load non-idle time and load idle time corresponding to each of the multiple load simulation time periods, a load change time table corresponding to the load to be simulated can be generated. Thus, this application can determine the load non-idle time and load idle time corresponding to each load simulation time period based on the load configuration function and the preset time, thereby effectively simulating the required load change trend in subsequent processes.
[0150] In one feasible implementation, the load idle time and load non-idle time can be obtained by formulas (7) and (8) in this application. Formula (8) is specifically embodied as follows:
[0151]
[0152] Where busy[i] represents the non-idle time of the load corresponding to the i-th simulation period, i is greater than 0, and t[i] represents the i-th simulation period.
[0153] It should be noted that, for the two optional implementation methods mentioned above, the terminal device may choose one or combine multiple methods to implement them, and this application does not impose any restrictions on this.
[0154] S404: Perform simulation processing on the load change time period table corresponding to the load to be simulated to obtain the load change trend corresponding to the load to be simulated.
[0155] In this step, loop logic can be invoked to simulate multiple non-idle periods of the load in the load change time table corresponding to the load to be simulated, and pause logic can be invoked to simulate multiple idle periods of the load in the same table. This allows the load change trend of the load to be simulated to be obtained. The loop logic includes a while loop, and the pause logic includes time.sleep. Thus, this application can simulate both non-idle and idle periods of the load in the load change time table, effectively generating the required load change trend for the load to be simulated and improving the flexibility of the simulated load.
[0156] Furthermore, this application can directly verify the expansion mechanism and the shrinkage mechanism based on the load change trend. The expansion and shrinkage mechanisms can be those found in Kubernetes. This ensures the sufficiency of automatic expansion and shrinkage verification, thereby guaranteeing CPU stability during operation to a certain extent.
[0157] like Figure 9 As shown, Figure 9 This is a complete flowchart of the load simulation process in a load simulation method provided in an embodiment of this application. Figure 9 The process first obtains the load configuration information of the load to be simulated and determines whether the load simulation type in the load configuration information is sinusoidal, linear, or curvilinear. If it is sinusoidal / linear / curvilinear simulation, the corresponding load configuration function can be determined based on the load configuration and the load simulation data in the load configuration information. Based on this load configuration function and the load simulation data, a load change time period table corresponding to the load to be simulated is determined, and the load change trend corresponding to the load to be simulated is simulated based on this load change time period table. Thus, this application can generate different load configuration functions and the required load change trend of the load to be simulated when different load configuration information is customized, thereby improving the flexibility of the simulated load.
[0158] like Figure 10 As shown, Figure 10 This is a schematic diagram illustrating the load change trend in a load simulation method provided in an embodiment of this application. Figure 10 This shows the load change trend of the simulated load when the load simulation type is load sinusoidal simulation, the load utilization upper limit in the load simulation data is 80%, and the load utilization upper limit is 30%. (The horizontal axis represents time, the vertical axis represents load utilization, and multiple curves represent that the server is a multi-core CPU.) In this way, the scaling up and down of game players during peak hours and off-peak hours can be verified periodically through this load change trend.
[0159] like Figure 11 As shown, Figure 11 This is a schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment. Figure 11 The diagram shows the load change trend of the simulated load when the load simulation type is load curve simulation and the load simulation data includes five load simulation groups. This allows for the simulation of the load change trend for a day, including scenarios such as morning load surge, midday peak, midday shutdown, evening peak, and early morning shutdown.
[0160] The load configuration information used in the above load change trend can be represented by code, which is shown below:
[0161]
[0162]
[0163] like Figure 12 As shown, Figure 12 This is a schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment. Figure 12 The figure shows the load change trend of the simulated load when the load simulation type is linear load simulation. This load change trend can characterize the trend of continuous sudden increase in load in a short period of time, so as to verify the expansion mechanism.
[0164] like Figure 13 As shown, Figure 13 This is a schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment. Figure 13 The figure shows the load change trend of the simulated load when the load simulation type is linear load simulation. This load change trend can characterize the trend of a sharp drop in load in a short period of time, so as to verify the scaling down mechanism.
[0165] like Figure 14 As shown, Figure 14 This is a schematic diagram illustrating the load change trend in another load simulation method provided in this application embodiment. Figure 14 The figure shows the load change trend of the simulated load when the load simulation type is load curve simulation. This load change trend can characterize the trend of the load first increasing and then decreasing, so as to verify the mechanism of first expanding and then shrinking capacity.
[0166] like Figure 15 As shown, Figure 15 This is a schematic diagram illustrating the load change trend in a further load simulation method provided in this application embodiment. Figure 15 The figure shows the load change trend of the simulated load when the load simulation type is load curve simulation. This load change trend can characterize the trend of the load first decreasing and then increasing, so as to verify the mechanism of first shrinking and then expanding the capacity.
[0167] In summary, in this embodiment, a load configuration function can be determined by identifying the load configuration information based on the required load change trend of the load to be simulated. Then, based on this load configuration function and the load simulation data in the load configuration information, a load change period table can be generated. This load change period table can simulate the load change trend of the load to be simulated. Thus, in this application, corresponding load configuration functions can be generated based on different load configuration information, achieving dynamic adjustment of the load configuration function. Based on the load configuration function and the load simulation data in the load information, load change trends of the load to be simulated with different requirements can be generated, thereby improving the flexibility of the simulated load. This enables better implementation of automatic scaling mechanisms under different load environments and allows for effective verification of automatic scaling mechanisms in cloud-native architectures.
[0168] Based on the load simulation method provided in the preceding embodiments, this application also provides a load simulation device. The load simulation device provided in the embodiments of this application will be described in detail below.
[0169] See Figure 16 This figure is a schematic diagram of the structure of a load simulation device provided in an embodiment of this application. Figure 16 As shown, the load simulation device specifically includes:
[0170] The configuration information acquisition unit 1601 is used to acquire the load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and load simulation data.
[0171] The configuration function obtaining unit 1602 is used to obtain the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data;
[0172] The load change time table acquisition unit 1603 is used to obtain the load change time table corresponding to the load to be simulated based on the load configuration function and the load simulation data.
[0173] The trend acquisition unit 1604 is used to perform simulation processing on the load change time period table corresponding to the load to be simulated, and obtain the load change trend corresponding to the load to be simulated.
[0174] In one feasible implementation, the configuration function obtaining unit 1602 includes:
[0175] The first coordinate acquisition unit is used to obtain multiple simulated coordinates based on the first simulation time, the first load utilization rate, the second simulation time, and the second load utilization rate;
[0176] The first coordinate calculation unit is used to calculate and process the multiple simulation coordinates according to the load linear simulation to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group;
[0177] The first function determination unit is used to use the first configuration function and the second configuration function as the load configuration function corresponding to the load to be simulated.
[0178] In one feasible implementation, the device further includes:
[0179] An initial time acquisition unit is used to acquire the initial simulation time and the initial load utilization rate corresponding to the initial simulation time.
[0180] The first coordinate acquisition unit is specifically used for:
[0181] The initial simulation time, the initial load utilization, the first simulation time, and the first load utilization are processed to obtain a first coordinate group, wherein the first coordinate group is used to determine the first configuration function;
[0182] The first simulation time, the first load utilization, the second simulation time, and the second load utilization are processed to obtain a second coordinate set, wherein the second coordinate set is used to determine the second configuration function;
[0183] The first coordinate group and the second coordinate group are used as multiple simulated coordinates.
[0184] In one feasible implementation, the configuration function obtaining unit 1602 includes:
[0185] The second coordinate acquisition unit is used to obtain multiple simulation coordinates based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate.
[0186] The second coordinate calculation unit is used to calculate and process the multiple simulated coordinates according to the load curve simulation to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group.
[0187] The second function determination unit is used to use the first configuration function and the second configuration function as the load configuration function corresponding to the load to be simulated.
[0188] In one feasible implementation, the device further includes:
[0189] An initial utilization acquisition unit is used to acquire the initial simulation time, the initial load utilization corresponding to the initial simulation time, and the vertex determination rule, wherein the vertex determination rule is used to determine the vertex coordinates based on the load variable.
[0190] The second coordinate acquisition unit is specifically used for:
[0191] Based on the vertex determination rules and the first load variable, the first simulation time and the first load utilization rate are constructed to obtain the first vertex coordinates; and based on the vertex determination rules and the second load variable, the second simulation time and the second load utilization rate are constructed to obtain the second vertex coordinates.
[0192] The initial simulation time and the initial load utilization rate are processed to obtain the coordinates of a first random point, and the first simulation time and the first load utilization rate are processed to obtain the coordinates of a second random point;
[0193] The coordinates of the first vertex and the coordinates of the first random point are combined to obtain a first coordinate group, and the coordinates of the second vertex and the coordinates of the second random point are combined to obtain a second coordinate group, wherein the first coordinate group is used to determine a first configuration function, and the second coordinate group is used to determine a second configuration function;
[0194] The first coordinate group and the second coordinate group are used as multiple simulated coordinates.
[0195] In one feasible implementation, the device further includes:
[0196] The first preset time acquisition unit is used to acquire a preset time, wherein the preset time is used to divide the simulation time.
[0197] The time period table acquisition unit 1603 is specifically used for:
[0198] The load simulation data is divided into multiple first simulation periods corresponding to the first simulation time according to the preset time; and the load simulation data is divided into multiple second simulation periods corresponding to the second simulation time according to the preset time.
[0199] The multiple first simulated time periods are calculated and processed according to the first configuration function in the load configuration function to obtain the load non-idle time and load idle time corresponding to the multiple first simulated time periods respectively; and the multiple second simulated time periods are calculated and processed according to the second configuration function in the load configuration function to obtain the load non-idle time and load idle time corresponding to the multiple second simulated time periods respectively.
[0200] Based on the load non-idle time and load idle time corresponding to the plurality of first simulation time periods, and the load non-idle time and load idle time corresponding to the plurality of second simulation time periods, a load change time period table corresponding to the load to be simulated is generated.
[0201] In one feasible implementation, the configuration function obtaining unit 1602 is specifically used for:
[0202] Based on the load sinusoidal simulation, determine the sinusoidal configuration function corresponding to the load sinusoidal simulation;
[0203] The load configuration function is obtained by calculating the upper limit of load utilization, the lower limit of load utilization, and the load simulation time based on the sinusoidal configuration function.
[0204] In one feasible implementation, the device further includes:
[0205] The second preset time acquisition unit is used to acquire a preset time, wherein the preset time is used to divide the simulation time.
[0206] The time period table acquisition unit 1603 is specifically used for:
[0207] The load simulation time in the load simulation data is divided according to the preset time to obtain multiple load simulation time periods corresponding to the load simulation time.
[0208] The load configuration function is used to calculate and process the multiple load simulation periods to obtain the load non-idle time and load idle time corresponding to the multiple load simulation periods respectively.
[0209] Based on the non-idle time and idle time of the load corresponding to the multiple load simulation periods, a load change period table corresponding to the load to be simulated is generated.
[0210] In one feasible implementation, the trend acquisition unit 1604 is specifically used for:
[0211] The loop logic is invoked to simulate multiple non-idle times of the load in the load change time period table corresponding to the load to be simulated, and the pause logic is invoked to simulate multiple idle times of the load in the load change time period table corresponding to the load to be simulated, so as to obtain the load change trend corresponding to the load to be simulated.
[0212] In one feasible implementation, the device further includes:
[0213] The expansion / shrinkage mechanism verification unit is used to verify the expansion and shrinkage mechanisms based on the load change trend.
[0214] The load simulation device provided in this application embodiment has the same beneficial effects as the load simulation method provided in the above embodiments, and therefore will not be described again.
[0215] This application provides a computer device, which can be a server. Figure 17 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 922 (e.g., one or more processors) and memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 942 or data 944. The memory 932 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 922 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the server 900.
[0216] Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0217] CPU 922 is used to perform the following steps:
[0218] Obtain the load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and load simulation data;
[0219] Based on the load simulation type and the load simulation data, obtain the load configuration function corresponding to the load to be simulated;
[0220] Based on the load configuration function and the load simulation data, obtain the load change time period table corresponding to the load to be simulated;
[0221] The load change time period table corresponding to the load to be simulated is simulated to obtain the load change trend corresponding to the load to be simulated.
[0222] This application also provides another computer device, which can be a terminal device. For example... Figure 18 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. Taking a mobile phone as an example:
[0223] Figure 18 The diagram shown is a block diagram of a portion of the structure of a mobile phone provided in an embodiment of this application. (Reference) Figure 18 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090, etc. Those skilled in the art will understand that... Figure 18 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0224] The following is combined Figure 18 A detailed introduction to each component of a mobile phone:
[0225] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0226] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0227] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0228] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1041. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 18 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0229] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0230] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0231] WiFi is a short-range wireless transmission technology. Through the WiFi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 18 The WiFi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0232] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby collecting overall data and information from the phone. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.
[0233] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0234] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0235] In this embodiment of the application, the processor 1080 included in the mobile phone also has the following functions:
[0236] Obtain the load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and load simulation data;
[0237] Based on the load simulation type and the load simulation data, obtain the load configuration function corresponding to the load to be simulated;
[0238] Based on the load configuration function and the load simulation data, obtain the load change time period table corresponding to the load to be simulated;
[0239] The load change time period table corresponding to the load to be simulated is simulated to obtain the load change trend corresponding to the load to be simulated.
[0240] This application also provides a computer-readable storage medium for storing a computer program that, when run on a computer device, causes the computer device to perform any one of the load simulation methods described in the foregoing embodiments.
[0241] This application also provides a computer program product including a computer program, which, when run on a computer device, causes the computer device to execute any one of the implementation methods of the load simulation method described in the foregoing embodiments.
[0242] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and equipment described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0243] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of the system is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple systems may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0244] The system described as separate components may or may not be physically separate. Components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0245] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0246] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing computer programs.
[0247] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0248] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions 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 this application.
Claims
1. A load simulation method, characterized in that, include: Obtain the load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes the load simulation type and load simulation data; Based on the load simulation type and the load simulation data, obtain the load configuration function corresponding to the load to be simulated; Based on the load configuration function and the load simulation data, obtain the load change time period table corresponding to the load to be simulated; The load change time period table corresponding to the load to be simulated is simulated to obtain the load change trend corresponding to the load to be simulated.
2. The method according to claim 1, characterized in that, The load simulation type includes linear load simulation, and the load simulation data includes a first load simulation group and a second load simulation group. The first load simulation group includes a first simulation time and a first load utilization rate corresponding to the first simulation time. The second load simulation group includes a second simulation time and a second load utilization rate corresponding to the second simulation time. The occurrence time of the first simulation time is earlier than the occurrence time of the second simulation time, and the first load utilization rate is different from the second load utilization rate. The step of obtaining the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data includes: Based on the first simulation time, the first load utilization rate, the second simulation time, and the second load utilization rate, multiple simulation coordinates are obtained; Based on the load linear simulation, the multiple simulation coordinates are calculated and processed to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group; The first configuration function and the second configuration function are used as the load configuration functions corresponding to the load to be simulated.
3. The method according to claim 2, characterized in that, Before obtaining multiple simulation coordinates based on the first simulation time, the first load utilization, the second simulation time, and the second load utilization, the method further includes: Obtain the initial simulation time and the initial load utilization rate corresponding to the initial simulation time; The process of obtaining multiple simulation coordinates based on the first simulation time, the first load utilization rate, the second simulation time, and the second load utilization rate includes: The initial simulation time, the initial load utilization, the first simulation time, and the first load utilization are processed to obtain a first coordinate group, wherein the first coordinate group is used to determine the first configuration function; The first simulation time, the first load utilization, the second simulation time, and the second load utilization are processed to obtain a second coordinate set, wherein the second coordinate set is used to determine the second configuration function; The first coordinate group and the second coordinate group are used as multiple simulated coordinates.
4. The method according to claim 1, characterized in that, The load simulation type includes load curve simulation, and the load simulation data includes a first load simulation group and a second load simulation group. The first load simulation group includes a first load variable, a first simulation time, and a first load utilization rate corresponding to the first simulation time. The second load simulation group includes a second load variable, a second simulation time, and a second load utilization rate corresponding to the second simulation time. The occurrence time of the first simulation time is earlier than the occurrence time of the second simulation time. The first load utilization rate is different from the second load utilization rate. The first load variable and the second load variable are used to indicate the opening direction of the configuration function. The step of obtaining the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data includes: Multiple simulation coordinates are obtained based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate; Based on the load curve simulation, the multiple simulation coordinates are calculated and processed to obtain the first configuration function corresponding to the first load simulation group and the second configuration function corresponding to the second load simulation group; The first configuration function and the second configuration function are used as the load configuration functions corresponding to the load to be simulated.
5. The method according to claim 4, characterized in that, Before obtaining multiple simulation coordinates based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate, the method further includes: The initial simulation time, the initial load utilization rate corresponding to the initial simulation time, and the vertex determination rule are obtained, wherein the vertex determination rule is used to determine the vertex coordinates based on the load variable. The process of obtaining multiple simulation coordinates based on the first load variable, the first simulation time, the first load utilization rate, the second load variable, the second simulation time, and the second load utilization rate includes: Based on the vertex determination rules and the first load variable, the first simulation time and the first load utilization rate are constructed to obtain the first vertex coordinates; and based on the vertex determination rules and the second load variable, the second simulation time and the second load utilization rate are constructed to obtain the second vertex coordinates. The initial simulation time and the initial load utilization rate are processed to obtain the coordinates of a first random point, and the first simulation time and the first load utilization rate are processed to obtain the coordinates of a second random point; The coordinates of the first vertex and the coordinates of the first random point are combined to obtain a first coordinate group, and the coordinates of the second vertex and the coordinates of the second random point are combined to obtain a second coordinate group, wherein the first coordinate group is used to determine a first configuration function, and the second coordinate group is used to determine a second configuration function; The first coordinate group and the second coordinate group are used as multiple simulated coordinates.
6. The method according to claim 2 or 4, characterized in that, Before obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and the load simulation data, the method further includes: Obtain a preset time, wherein the preset time is used to divide the simulation time; The step of obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and the load simulation data includes: The load simulation data is divided into multiple first simulation periods corresponding to the first simulation time according to the preset time; and the load simulation data is divided into multiple second simulation periods corresponding to the second simulation time according to the preset time. The multiple first simulated time periods are calculated and processed according to the first configuration function in the load configuration function to obtain the load non-idle time and load idle time corresponding to the multiple first simulated time periods respectively; and the multiple second simulated time periods are calculated and processed according to the second configuration function in the load configuration function to obtain the load non-idle time and load idle time corresponding to the multiple second simulated time periods respectively. Based on the load non-idle time and load idle time corresponding to the plurality of first simulation time periods, and the load non-idle time and load idle time corresponding to the plurality of second simulation time periods, a load change time period table corresponding to the load to be simulated is generated.
7. The method according to claim 1, characterized in that, The load simulation type includes load sinusoidal simulation, and the load simulation data includes an upper limit of load utilization, a lower limit of load utilization, and a load simulation time. The step of obtaining the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data includes: Based on the load sinusoidal simulation, determine the sinusoidal configuration function corresponding to the load sinusoidal simulation; The load configuration function is obtained by calculating the upper limit of load utilization, the lower limit of load utilization, and the load simulation time based on the sinusoidal configuration function.
8. The method according to claim 7, characterized in that, Before obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and the load simulation data, the method further includes: Obtain a preset time, wherein the preset time is used to divide the simulation time; The step of obtaining the load change time period table corresponding to the load to be simulated based on the load configuration function and the load simulation data includes: The load simulation time in the load simulation data is divided according to the preset time to obtain multiple load simulation time periods corresponding to the load simulation time. The load configuration function is used to calculate and process the multiple load simulation periods to obtain the load non-idle time and load idle time corresponding to the multiple load simulation periods respectively. Based on the non-idle time and idle time of the load corresponding to the multiple load simulation periods, a load change period table corresponding to the load to be simulated is generated.
9. The method according to claim 6, characterized in that, The step of simulating the load change time period table corresponding to the load to be simulated to obtain the load change trend corresponding to the load to be simulated includes: The loop logic is invoked to simulate multiple non-idle times of the load in the load change time period table corresponding to the load to be simulated, and the pause logic is invoked to simulate multiple idle times of the load in the load change time period table corresponding to the load to be simulated, so as to obtain the load change trend corresponding to the load to be simulated.
10. The method according to claim 1, characterized in that, Also includes: Based on the load change trend, verify the expansion and contraction mechanisms.
11. A load simulation device, characterized in that, include: A configuration information acquisition unit is used to acquire load configuration information of the load to be simulated, wherein the load configuration information is determined according to the required load change trend of the load to be simulated, and the load configuration information includes load simulation type and load simulation data; The configuration function obtaining unit is used to obtain the load configuration function corresponding to the load to be simulated based on the load simulation type and the load simulation data; The load change time table acquisition unit is used to obtain the load change time table corresponding to the load to be simulated based on the load configuration function and the load simulation data. The trend acquisition unit is used to perform simulation processing on the load change time period table corresponding to the load to be simulated, and obtain the load change trend corresponding to the load to be simulated.
12. A computer device, characterized in that, The device includes a processor and a memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the steps of the load simulation method according to any one of claims 1 to 10, based on instructions in the computer program.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a computer device, implements the steps of the load simulation method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, Includes a computer program that, when executed by a computer device, implements the steps of the load simulation method according to any one of claims 1 to 10.