Software and hardware resource scaling methods, devices, equipment, storage media and program products
By training the prediction model in the offline stage, predicting the optimal software resource configuration under different hardware resource configurations, the problem of increasing response time caused by hardware resource scaling in web applications is solved, and more efficient resource utilization and response time reduction is achieved.
Patent Information
- Application Number
- CN202411899325.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In web application scenarios, only scaling of hardware resources leads to inadequate utilization or over-allocation of hardware resources, resulting in increased response time.
By obtaining a prediction model based on hardware resource configuration and software resource configuration training in the offline stage, the optimal software resource configuration under different hardware resource configurations are accurately predicted, so that software resources are timely adjusted according to changes in hardware resource at the online stage.
It effectively avoids the problem of inadequate utilization or excessive allocation of hardware resources, reduces the response time of web applications, and improves the stability and quality of services.
Smart Images

Figure CN119356880B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of resource scheduling, and in particular to a method for scaling software and hardware resources, a device for scaling software and hardware resources, a storage medium, and a computer program product. Background Art
[0002] In web application scenarios, workloads are changing dynamically. Currently, responsive scaling algorithms are used to dynamically allocate hardware resources. For example, the average value of historical resource usage and the scaling ratio configured by the user are used to calculate the hardware resources that should be allocated; or scaling algorithms based on machine learning or historical experience are used to allocate hardware resources.
[0003] However, simply scaling the hardware resources may result in insufficient utilization of the hardware resources or excessive allocation of hardware resources, resulting in resource competition, thereby increasing response time. Summary of the invention
[0004] The main purpose of the present application is to provide a method for scaling software and hardware resources, a device for scaling software and hardware resources, a storage medium and a computer program product to solve the technical problem of long response time of web applications caused by scaling hardware resources.
[0005] To achieve the above objectives, the present application proposes a method for scaling software and hardware resources, the method comprising:
[0006] Obtain different hardware resource configurations for applications and the optimal software resource configurations under different hardware resource configurations;
[0007] In the offline stage, a prediction model for predicting the optimal software resource configuration is obtained based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration.
[0008] In one embodiment, the method comprises:
[0009] After hardware resource scaling is performed in the online stage, the optimal software resource configuration under the hardware resource configuration after the hardware resource scaling is predicted by a prediction model, wherein the prediction model is trained based on the hardware resource configuration in the offline stage and the optimal software resource configuration under the hardware resource configuration.
[0010] In one embodiment, the method comprises:
[0011] When the load status of the application changes, the prediction model is used to predict the optimal software resource configuration under the hardware resource configuration after the hardware resources are scaled up or down;
[0012] Re-collect performance indicators under different hardware resource configurations to obtain new optimal software resources, and use the new optimal software resources as the target software resource configuration.
[0013] In one embodiment, the step of configuring the new optimal software resource as the target software resource includes:
[0014] The prediction model is updated by executing the hardware resource configuration after hardware resource scaling and the target software resource configuration under the hardware resource configuration to obtain a new prediction model;
[0015] Predictions of optimal software resource configurations are performed through new prediction models.
[0016] In one embodiment, the step of obtaining different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations includes:
[0017] Collect application performance metrics while performing stress testing on the application;
[0018] Allocate hardware resource configuration and software resource configuration under the hardware resource configuration to the application according to the performance indicator, wherein one hardware resource configuration has multiple software resource configurations;
[0019] For any of the hardware resource configurations, an optimal software resource configuration is selected from a plurality of software resource configurations.
[0020] In one embodiment, for any of the hardware resource configurations, the step of selecting the optimal software resource configuration from a plurality of software resource configurations includes:
[0021] Calculate and count the confidence intervals of the sampled values of the performance indicators under each software resource configuration one by one until the calculated confidence interval is less than a preset threshold for the first time;
[0022] The software resource configuration whose confidence interval is smaller than the preset threshold for the first time is regarded as the optimal software resource configuration.
[0023] In addition, to achieve the above-mentioned purpose, the present application also proposes a software and hardware resource scaling device, the software and hardware resource scaling device comprising: an acquisition module, used to acquire different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations;
[0024] The training module is used to train the prediction model for predicting the optimal software resource configuration based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration in an offline stage.
[0025] In addition, to achieve the above-mentioned purpose, the present application also proposes a software and hardware resource scaling device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the software and hardware resource scaling method described above.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the software and hardware resource scaling method described above are implemented.
[0027] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the software and hardware resource scaling method described above are implemented.
[0028] One or more technical solutions proposed in this application have at least the following technical effects:
[0029] Compared with the current practice of only scaling hardware resources, which results in insufficient utilization of hardware resources or resource competition caused by over-allocation of hardware resources, which increases the response time of web applications, this application obtains a prediction model based on hardware resource configuration and software resource configuration training in the offline stage, which can accurately predict the optimal software resource configuration under different hardware resource configurations, thereby providing a basis for resource allocation in response to dynamically changing workloads, and can use the prediction model to adjust software resources in a timely manner according to changes in hardware resources in the online stage, avoiding the problem of insufficient utilization or over-allocation of hardware resources caused by simply scaling hardware resources, thereby reducing the response time of web applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0032] Figure 1 This is a schematic diagram of the existing automatic scaler hardware resource scaling;
[0033] Figure 2 A flowchart of the first embodiment of the software and hardware resource scaling method of the present application is provided;
[0034] Figure 3 A brief flowchart diagram of the second embodiment of the software and hardware resource scaling method of the present application;
[0035] Figure 4 This is a schematic diagram of the module structure of the software and hardware resource expansion device of this application;
[0036] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the software and hardware resource scaling method of this application.
[0037] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0038] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0039] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0040] Since the workload in web applications is changing dynamically, hardware resources need to be dynamically allocated to web applications to meet their load requirements.
[0041] In one feasible implementation, hardware resources can be dynamically allocated to web applications through a rule-based autoscaler in Kubernetes, which is a cloud environment commonly used in the industry for production deployment.
[0042] like Figure 1 As shown in the figure, the autoscaling components in Kubernetes mainly include cluster monitoring module and autoscaling module. Cluster monitoring module: The cluster monitoring module uses Metric Server (a service that aggregates resource indicators) through the monitor, which is mainly used to collect resource usage data (such as CPU, memory, etc.) of each node and node in the Kubernetes cluster. Autoscaling module: It runs in the Kubernetes control plane and executes the main logic of autoscaling through the scaling controller. The scaling controller periodically (by default, every 15 seconds) checks the resource usage of the monitored nodes and calculates the required resources according to the scaling control algorithm.
[0043] Scaling control algorithms include responsive scaling algorithms (a type of vertical scaling that uses the average historical resource usage rate and the user-configured scaling ratio to calculate the resource quota that should be allocated), machine-based scaling algorithms, and automatic scaling algorithms with active features based on learning historical experience.
[0044] However, simply scaling hardware resources cannot completely alleviate the performance degradation of sudden workloads. Instead, there will be resource competition problems caused by insufficient or over-allocated hardware resources. In the face of sudden loads, the performance degradation caused by resource competition is particularly obvious, which will greatly increase the response time.
[0045] The present application provides a solution that enables corresponding changes to be made to software resources when hardware resources change, and sets the optimal software resource configuration under different hardware resource configurations, which can greatly reduce response time and improve service stability and service quality.
[0046] It should be noted that the execution subject of this embodiment may be a software and hardware resource scaling device, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of implementing the above functions, a processor, etc. The following takes the software and hardware resource scaling device as an example to illustrate this embodiment and the following embodiments.
[0047] Based on this, the embodiment of the present application provides a method for scaling software and hardware resources, referring to Figure 2 , Figure 2 This is a flowchart of the first embodiment of the software and hardware resource scaling method of the present application.
[0048] In this embodiment, the method for scaling software and hardware resources includes steps S10 to S20:
[0049] Step S10, obtaining different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations;
[0050] It should be noted that after obtaining different hardware resource configurations of the application and the software resource configurations under different hardware resource configurations, the present application proposes an optimal software resource search algorithm, which is used to select the optimal software resource configuration under any hardware resource configuration from different software resource configurations, thereby obtaining different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations.
[0051] Exemplarily, a training controller can be used to allocate different hardware resource configurations and different software resource configurations to an application, wherein the training controller is not a scaling controller for hardware resource scaling, but is obtained through additional training in an offline phase and is used to simulate the allocation of hardware resources and software resources to an application according to different loads, wherein the hardware resource configuration includes the number of CPUs, memory capacity, network resources, etc., and the software resource configuration includes the number of threads, the number of database connections, the number of thread pools, etc.
[0052] Step S20, in an offline stage, a prediction model for predicting the optimal software resource configuration is obtained based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration.
[0053] It should be noted that the offline stage refers to the stage where the prediction model is not deployed. In step S10, many hardware resource configurations and the optimal software resource configurations under multiple hardware resource configurations obtained are used as training data. The prediction model is trained using the training data. The prediction model is used to predict the optimal software resource configuration under any hardware resource configuration. The specific training process of the prediction model will not be repeated here.
[0054] In a feasible implementation, the prediction model can be an xgboost (eXtreme GradientBoosting, based on a gradient boosting algorithm) model, which is a regression model and also a tree model, which can reduce overfitting, optimize the algorithm to process sparse data, support parallel computing and distributed learning, and efficient cache-aware access mode, so that it performs better on large-scale data sets.
[0055] By training the prediction model for predicting the optimal software resources in the offline stage, the model training process is carried out in a relatively separate environment from the actual operating environment. Offline training can utilize a large amount of historical data or simulation data without affecting the running system.
[0056] In this embodiment, a prediction model is obtained through offline training based on hardware resource configuration and software resource configuration, which can accurately predict the optimal software resource configuration under different hardware resource configurations, thereby providing a basis for resource allocation in response to dynamically changing workloads, and can adjust software resources in time according to changes in hardware resources, avoiding the problem of insufficient utilization or over-allocation of hardware resources caused by simply scaling hardware resources, thereby reducing the response time of web applications.
[0057] In a feasible implementation, the method for scaling software and hardware resources includes: after performing hardware resource scaling in an online stage, predicting the optimal software resource configuration under the hardware resource configuration after hardware resource scaling through a prediction model, wherein the prediction model is trained based on the hardware resource configuration in the offline stage and the optimal software resource configuration under the hardware resource configuration.
[0058] It should be noted that the online stage refers to the stage of predictive model deployment. The predictive model obtained through offline training predicts the optimal software resource configuration after hardware resource scaling. Hardware resource scaling is performed because the workload of the application changes.
[0059] After the hardware resource scaling is performed in the online stage, before the step of predicting the optimal software resource configuration after the hardware resource scaling by the prediction model, the method includes:
[0060] Detect the application load in real time and obtain the application hardware indicators;
[0061] If the hardware indicator reaches a preset resource scaling threshold, hardware resource scaling is performed on the application program.
[0062] It should be noted that the hardware indicators of the application are obtained by real-time detection of the application load, and the hardware indicators include CPU utilization, memory usage, etc. The preset resource scaling threshold is a predetermined critical value. For example, when the hardware indicator such as CPU utilization reaches the preset resource scaling threshold such as 85%, the hardware resources are scaled up, which can be more hardware resources allocated to the application, such as increasing the number of CPU cores or increasing the CPU frequency, increasing the memory capacity, etc.
[0063] In this embodiment, hardware resources are scaled based on the actual needs of the application. Reasonable upward scaling of hardware resources can avoid the situation where the application performance is seriously degraded or even fails to work normally due to insufficient hardware resources. Reasonable downward scaling of hardware resources can release excess hardware resources. The released hardware resources can be used by other applications, thereby improving the utilization rate of hardware resources.
[0064] In another feasible implementation, the method for scaling software and hardware resources includes: when the load state of the application changes, predicting the optimal software resource configuration under the hardware resource configuration through a prediction model after the hardware resources are scaled; re-collecting performance indicators under different hardware resource configurations to obtain new optimal software resources, and using the new optimal software resources as the target software resource configuration.
[0065] It should be noted that when the application load state changes, since the software and hardware resource scaling device has a window period (for example, 15 seconds) to check the resource usage of the application and calculate the required hardware resources based on the resource usage, when the application load state changes (for example, from low load to high load, sudden increase in data in the database), the scaling of the hardware resources fails to respond in time. It is necessary to re-acquire the performance indicators under each hardware resource configuration in order to search for a new optimal software resource configuration based on the performance indicators and use the new optimal software resource configuration as the target software resource configuration.
[0066] In a feasible implementation, performing optimal resource configuration is equivalent to allocating the number of threads to an application. When the application load state changes, a local search for software resource configuration can be performed within a preset thread interval (exemplarily, it can be set to ten thread intervals above and below), and the predicted optimal software resource configuration is adjusted to obtain the target software resource configuration when the application load state changes. The target software resource configuration is applied to the application to adapt to the change in its load state and reduce the web application response time on the application side.
[0067] After the step of configuring the new optimal software resource as the target software resource when the load state of the application program changes, the method includes steps A10 to A20:
[0068] Step A10, updating the prediction model by executing the hardware resource configuration after hardware resource scaling and the target software resource configuration under the hardware resource configuration to obtain a new prediction model;
[0069] It should be noted that after hardware resource scaling is performed, a new hardware resource configuration will be obtained. The new hardware resource configuration is the hardware resource state adjusted according to the current load of the application. Under the new hardware resource configuration, there is also a corresponding target software resource configuration. The target software resource configuration is obtained by adjusting the optimal software resource configuration predicted by the prediction model according to the load state of the application to ensure that the application can run well under the new hardware resource conditions and reduce the response time.
[0070] Step A20, performing prediction of optimal software resource configuration through the new prediction model.
[0071] It should be noted that the new prediction model has been updated to include more information about the relationship between different hardware resource conditions and software resource configuration. When faced with new situations (such as new application operation scenarios, different hardware environments, or new changes in application load, etc.), the prediction model can predict the optimal software resource configuration based on its learned knowledge and algorithms.
[0072] In this embodiment, the prediction model is updated through new hardware resource configurations and their corresponding target software resource configurations, so that the prediction model can learn diverse resource configuration relationships. When the prediction model faces similar hardware resource changes, it can more accurately predict the software resource configuration, reduce prediction errors, adapt to new hardware resource configurations, and improve the accuracy and applicability of the model.
[0073] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can refer to the above introduction, and will not be repeated in the following. Figure 3 , step S10, the software and hardware resource scaling method further includes steps D10 to D30:
[0074] Step D10, collecting performance indicators of the application when performing stress testing on the application;
[0075] It should be noted that the purpose of stress testing an application is to simulate the workload in an actual application, such as high concurrent user access, large amounts of data processing, and other scenarios. In the process of stress testing an application, performance indicators such as response time, throughput, and goodput (GP) are collected. For example, the locust tool for distributed stress testing can be used as a load generator.
[0076] Step D20, allocating hardware resource configuration and software resource configuration under the hardware resource configuration to the application according to the performance index, wherein one hardware resource configuration has multiple software resource configurations;
[0077] It should be noted that the collected performance indicators can reflect the current operating status of the application. For example, if the performance indicators show that the application's response time is long and the throughput is low, it means that the current hardware resources cannot meet the needs of the application, and it is necessary to reconfigure the hardware resources and the software resource configuration under the hardware resource configuration. Under one hardware resource configuration, there can be multiple software resource configuration schemes due to the diversity of software and different functional requirements.
[0078] Step D30: for any hardware resource configuration, select the optimal software resource configuration from multiple software resource configurations.
[0079] It should be noted that, since it is necessary to train a prediction model for predicting the optimal software resource configuration, it is necessary to select the optimal software resource configuration from multiple software resource configurations.
[0080] Exemplarily, an optimal software resource search algorithm may be used. The optimal software resource search algorithm specifically includes: finding an optimal software resource configuration in a given software resource configuration and corresponding effective throughput gp and throughput data. It gradually increases the number of concurrent connections w0 and checks the confidence interval of the corresponding data. Once the confidence interval is lower than the set lower limit, the crossover point is found, and the software resource configuration corresponding to this point is optimal.
[0081] Specifically:
[0082] Input: Software resource configuration and corresponding effective throughput gp and throughput throughput.
[0083] Specifically, it is represented by a set of triples P = {( , , ), ( , , ),..., ( , , }, where x is the software resource configuration, y is gp, and z is throughput.
[0084] Output: Optimal software resource configuration .
[0085] 1. Initialize a random variable `θ`.
[0086] 2. Set the minimum concurrency (min_concurrency) to 1.
[0087] 3. Set the maximum concurrency (max_concurrency) to 200.
[0088] 4. Set w0 to min_concurrency.
[0089] 5. Set the crossover_point to None.
[0090] 6. Set the confidence_lower_bound to 0.90.
[0091] 7. While loop:
[0092] As long as w0 is less than or equal to max_concurrency, perform the following steps:
[0093] 8. Select all yi values that satisfy xi = w0, that is, the current data (current_data) current_data ={y1, y2,..., yi, where xi = w0}.
[0094] 9. Calculate the mean of current_data.
[0095] 10. Calculate the standard deviation of current_data with 1 degree of freedom.
[0096] 11. Calculate the length of current_data.
[0097] 12. Calculate the confidence interval (confidence_interval): Calculate confidence_interval = mean_sat - 1.96 * (std_dev / sqrt(n)).
[0098] 13. If confidence_interval is less than confidence_lower_bound, then:
[0099] 14. Update crossover_point: Set crossover_point to w0.
[0100] 15. Break out of the loop.
[0101] 17. Increase w0 by 1.
[0102] 18. The while loop ends.
[0103] 19. Return crossover_point.
[0104] In a feasible implementation manner, in step D30, the software and hardware resource scaling method further includes steps E10 to E20:
[0105] Step E10, calculating and counting the confidence intervals of the sampled values of the performance indicators under each software resource configuration one by one, until the calculated confidence interval is smaller than a preset threshold for the first time;
[0106] It should be noted that the mean, variance, and standard deviation of the sampling values of the performance indicators under each software resource configuration are calculated one by one to obtain the confidence interval, and it is determined whether the 96% left confidence interval is greater than or equal to 90%. If the 96% left confidence interval is greater than or equal to 90%, the next one is calculated until the 96% left confidence interval is less than 90% for the first time, which is equivalent to an inflection point, a turning point where it first rises and then falls.
[0107] Step E20: taking the software resource configuration whose confidence interval is smaller than the preset threshold for the first time as the optimal software resource configuration.
[0108] It should be noted that the software resource configuration corresponding to the inflection point where the confidence interval is smaller than the preset threshold for the first time is taken as the optimal software resource configuration.
[0109] In this embodiment, under the optimal software resource configuration, since the confidence interval is small, the fluctuation of the performance indicators is small, which means that the operation is relatively stable under the software resource configuration at this time, and there will be no drastic changes in performance indicators. While utilizing existing resources, it can run with relatively stable performance.
[0110] In this embodiment, allocating hardware and software resource configurations to applications based on the collected performance indicators is an optimization strategy. Different application functions and performance requirements require different resource support. The optimal software resource configuration can ensure that the application runs more efficiently under a specific hardware resource configuration. The appropriate software resource configuration can better utilize hardware resources and avoid idle or excessive competition for resources. By optimizing the software resource configuration, hardware resources can be more fully utilized, thereby saving CPU resources for other key tasks. This not only reduces hardware costs, but also improves resource utilization.
[0111] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the software and hardware resource scaling method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0112] This application also provides a software and hardware resource expansion device, please refer to Figure 4 , the software and hardware resource expansion and contraction device comprises:
[0113] An acquisition module 10 is used to acquire different hardware resource configurations of the application program and the optimal software resource configuration under different hardware resource configurations;
[0114] The training module 20 is used to train a prediction model for predicting the optimal software resource configuration based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration in an offline stage.
[0115] The software and hardware resource scaling device includes a prediction module, which is used to predict the optimal software resource configuration under the hardware resource configuration after the hardware resource scaling is performed in the online stage through a prediction model, wherein the prediction model is trained based on the hardware resource configuration in the offline stage and the optimal software resource configuration under the hardware resource configuration.
[0116] The software and hardware resource scaling device includes a search module, which is used to predict the optimal software resource configuration under the hardware resource configuration through a prediction model after the hardware resource is scaled when the load state of the application program changes;
[0117] Re-collect performance indicators under different hardware resource configurations to obtain new optimal software resources, and use the new optimal software resources as the target software resource configuration.
[0118] The search module is further used to update the prediction model by executing the hardware resource configuration after hardware resource scaling and the target software resource configuration under the hardware resource configuration to obtain a new prediction model;
[0119] Predictions of optimal software resource configurations are performed through new prediction models.
[0120] The acquisition module 10 is also used to collect performance indicators of the application when performing stress testing on the application;
[0121] Allocate hardware resource configuration and software resource configuration under the hardware resource configuration to the application according to the performance indicator, wherein one hardware resource configuration has multiple software resource configurations;
[0122] For any of the hardware resource configurations, an optimal software resource configuration is selected from a plurality of software resource configurations.
[0123] The acquisition module 10 is further used to calculate and count the confidence intervals of the sampled values of the performance indicators under each software resource configuration one by one, until the calculated confidence interval is less than a preset threshold for the first time;
[0124] The software resource configuration whose confidence interval is smaller than the preset threshold for the first time is regarded as the optimal software resource configuration.
[0125] The software and hardware resource scaling device provided by the present application adopts the software and hardware resource scaling method in the above embodiment, which can solve the technical problem that the scaling of hardware resources leads to a long response time of the web application. Compared with the prior art, the beneficial effects of the software and hardware resource scaling device provided by the present application are the same as the beneficial effects of the software and hardware resource scaling method provided by the above embodiment, and other technical features in the software and hardware resource scaling device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0126] The present application provides a software and hardware resource scaling device, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the software and hardware resource scaling method in the first embodiment above.
[0127] Reference below Figure 5 , which shows a schematic diagram of the structure of a software and hardware resource expansion and contraction device suitable for implementing the embodiment of the present application. The software and hardware resource expansion and contraction device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The software and hardware resource scaling device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0128] like Figure 5 As shown, the software and hardware resource scaling device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the software and hardware resource scaling device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the software and hardware resource scaling device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a software and hardware resource scaling device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0129] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0130] The software and hardware resource scaling device provided by the present application adopts the software and hardware resource scaling method in the above embodiment, which can solve the technical problem that the expansion and contraction of hardware resources leads to a long response time of the web application. Compared with the prior art, the beneficial effects of the software and hardware resource scaling device provided by the present application are the same as the beneficial effects of the software and hardware resource scaling method provided by the above embodiment, and other technical features in the software and hardware resource scaling device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0131] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0132] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0133] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the software and hardware resource scaling method in the above-mentioned embodiment.
[0134] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0135] The computer-readable storage medium may be included in the software and hardware resource scaling device; or may exist independently without being assembled into the software and hardware resource scaling device.
[0136] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the software and hardware resource scaling device, the software and hardware resource scaling device: obtains different hardware resource configurations of the application program and the optimal software resource configuration under different hardware resource configurations;
[0137] In the offline stage, a prediction model for predicting the optimal software resource configuration is obtained based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration.
[0138] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0139] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0140] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0141] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned software and hardware resource scaling method, and can solve the technical problem that the scaling of hardware resources leads to a long response time of web applications. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the software and hardware resource scaling method provided in the above-mentioned embodiment, and will not be described in detail here.
[0142] The present application also provides a computer program product, including a computer program, which implements the steps of the software and hardware resource scaling method as described above when executed by a processor.
[0143] The computer program product provided by the present application can solve the technical problem that the expansion and contraction of hardware resources leads to a long response time of web applications. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the software and hardware resource expansion method provided by the above embodiment, which will not be repeated here.
[0144] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for scaling software and hardware resources, characterized in that: The software and hardware resource scaling method comprises: Obtain different hardware resource configurations for applications and the optimal software resource configurations under different hardware resource configurations; In an offline stage, a prediction model for predicting the optimal software resource configuration is obtained based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration; Detect the application load in real time and obtain the application hardware indicators; If the hardware indicator reaches a preset resource scaling threshold, hardware resource scaling is performed on the application program; After hardware resource scaling is performed in the online phase, the prediction model is used to predict the optimal software resource configuration under the hardware resource configuration after hardware resource scaling; The step of obtaining different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations includes: Collect application performance metrics while performing stress testing on the application; Allocate hardware resource configuration and software resource configuration under the hardware resource configuration to the application according to the performance indicator, wherein one hardware resource configuration has multiple software resource configurations; For any hardware resource configuration, select the optimal software resource configuration from multiple software resource configurations; The step of selecting the optimal software resource configuration from multiple software resource configurations for any hardware resource configuration includes: Calculate and count the confidence intervals of the sampled values of the performance indicators under each software resource configuration one by one until the calculated confidence interval is less than a preset threshold for the first time; The software resource configuration whose confidence interval is smaller than the preset threshold for the first time is regarded as the optimal software resource configuration.
2. The method for scaling software and hardware resources as claimed in claim 1, characterized in that: The method comprises: The prediction model is updated by executing the hardware resource configuration after hardware resource scaling and the target software resource configuration under the hardware resource configuration to obtain a new prediction model; Predictions of optimal software resource configurations are performed through new prediction models.
3. A software and hardware resource expansion device, characterized in that: The software and hardware resource expansion and contraction device comprises: An acquisition module is used to acquire different hardware resource configurations of the application and the optimal software resource configuration under different hardware resource configurations; A training module, used for training an optimal software resource configuration based on the hardware resource configuration and the optimal software resource configuration under the hardware resource configuration in an offline stage to obtain a prediction model for predicting the optimal software resource configuration; The software and hardware resource scaling device includes a prediction module, which is used to detect the load of the application in real time and obtain the hardware index of the application; if the hardware index reaches a preset resource scaling threshold, the hardware resource scaling is performed on the application; after the hardware resource scaling is performed in the online stage, the optimal software resource configuration under the hardware resource configuration after the hardware resource scaling is predicted by the prediction model; The acquisition module is used to collect performance indicators of the application when performing stress testing on the application; allocate hardware resource configuration and software resource configuration under the hardware resource configuration to the application according to the performance indicators, wherein there are multiple software resource configurations under one hardware resource configuration; for any hardware resource configuration, select the optimal software resource configuration from the multiple software resource configurations; The step of selecting the optimal software resource configuration from multiple software resource configurations for any hardware resource configuration includes: Calculate and count the confidence intervals of the sampled values of the performance indicators under each software resource configuration one by one until the calculated confidence interval is less than a preset threshold for the first time; The software resource configuration whose confidence interval is smaller than the preset threshold for the first time is regarded as the optimal software resource configuration.
4. A software and hardware resource scaling device, characterized in that: The software and hardware resource scaling device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the software and hardware resource scaling method according to any one of claims 1 to 2.
5. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the software and hardware resource scaling method according to any one of claims 1 to 2 are implemented.
6. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for scaling software and hardware resources as claimed in any one of claims 1 to 2 are implemented.
Citation Information
Patent Citations
Application program thread count dynamic regulating method used under isomerous many-core system
CN104657219A