Resource control method and device

By using a pre-trained resource prediction model to predict service resources during service deployment, generating prediction arrays of each duration, and determining scaling strategies, the problem of lack of predictability in decision-making in the existing technology is solved, and more efficient automatic scaling is achieved.

CN113760527BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011516255.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-21
Publication Date
2025-02-21
Estimated Expiration
2040-12-21

AI Technical Summary

Technical Problem

The prior art only makes decisions based on the current status when deploying services, and the policy implementation lacks predictability and fails to effectively respond to short-term and long-term fluctuations in services.

Method used

By obtaining the status information of each service unit in the service resource pool, input it to the pre-trained resource prediction model, generating a prediction array corresponding to each duration, and determining the corresponding scaling strategy.

Benefits of technology

The accuracy of resource prediction is improved, and by predicting the resource usage of different lengths in the future, an accurate scaling strategy is determined for the service unit, which improves the execution efficiency of automatic scaling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760527B_ABST
    Figure CN113760527B_ABST
Patent Text Reader

Abstract

The present application discloses a resource control method and device, and the specific implementation scheme is as follows: in response to receiving a deployment request for a service and the service deployment is not the first time, the status information of each service unit in the resource pool corresponding to the service is obtained, wherein the status information is represented by an information set consisting of the usage of resources required by the service and the call information of the service; all the obtained status information is input into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage and call information of the resource based on each duration; based on the prediction array corresponding to each duration, the scaling strategy corresponding to the deployment request of the service is determined. This scheme determines an accurate scaling strategy for the service unit by predicting the resource usage of different durations in the future, thereby improving the execution efficiency of automatic scaling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, specifically to the field of image processing technology, and especially to a resource control method and device. Background Art

[0002] At present, when deploying services, it is generally adopted to obtain the graphics processing unit (GPU) information and memory information of each service unit, and determine the scaling strategy based on the GPU information, memory information and the current total number of service units of each service unit, where the scaling strategy is used to control the number of service units. This method makes decisions only based on the current state of the system, and the execution of the strategy is often not predictable. For example, if the number of service units needs to be increased based on the current state, the service may have reached a bottleneck before the expansion action is completed. At the same time, this method does not consider the short-term and long-term fluctuation response strategies for the service. Summary of the invention

[0003] The present application provides a resource control method, apparatus, device and storage medium.

[0004] According to a first aspect of the present application, a resource control method is provided, the method comprising: in response to receiving a deployment request for a service and the service deployment is not the first time, obtaining status information of each service unit in a resource pool corresponding to the service, wherein the status information is represented by an information set consisting of a usage of resources required by the service and call information of the service; inputting all the obtained status information into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of resource usage and call information based on each duration, and the prediction information in the prediction array corresponds to each information in the status information; based on the prediction array corresponding to each duration, determining a scaling policy corresponding to the deployment request of the service, wherein the scaling policy is used to control the number of service units in the resource pool.

[0005] In some embodiments, each duration includes: a short duration measured in hours and a long duration measured in weeks or months; based on the prediction array corresponding to each duration, determining a scaling policy corresponding to the deployment request of the service includes: determining a first scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to the short duration, the first scaling policy being used to create or destroy a service unit; determining a second scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to the long duration, the second scaling policy being used to occupy resources of each service unit in a resource pool; and determining a scaling policy corresponding to the deployment request of the service according to the first scaling policy and the second scaling policy.

[0006] In some embodiments, the resource prediction model is trained in the following manner: obtaining a training sample set, wherein the training samples in the training sample set include status information of each service unit in the resource pool and a prediction array corresponding to each duration of each service; utilizing a deep learning method, taking the status information of each service unit in the resource pool included in the training samples in the training sample set as input data, and taking the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool as expected output data, to train the resource prediction model.

[0007] In some embodiments, the method also includes: in response to the service being deployed for the first time, using a pre-trained first prediction model to predict the usage of resources required for the service to obtain the predicted resource usage of the service, wherein the first prediction model is used to characterize the adjustment of the usage of resources required for the service based on an optimization goal, and the optimization goal is to balance the allocation of resources required for the service and / or find the boundaries of each resource usage; based on the resource usage of the service, updating each service unit in the resource pool corresponding to the predicted resource usage.

[0008] In some embodiments, a pre-trained first prediction model is used to predict the usage of resources required for a service to obtain the predicted resource usage of the service, including: based on the preset usage of the resources required for the service, constructing a first service unit corresponding to the preset usage of the resources in a resource pool, wherein the construction is used to characterize the setting of status information for the first service unit; using an optimization algorithm to optimize the usage of resources required for the service to obtain the optimized resource usage of the service, wherein the optimization algorithm is used to characterize the adjustment of the usage of resources required for the service based on the first service unit and the optimization target; deleting the first service unit.

[0009] In some embodiments, resources include: GPU resources, CPU resources, memory resources, disk resources, network bandwidth resources and various resources required for the service; call information includes: number of calls, call time point, call cycle and various information corresponding to the service call.

[0010] In some embodiments, the method further includes: executing operations corresponding to the scaling policy.

[0011] According to a second aspect of the present application, a resource control device is provided, the device comprising: an acquisition unit, configured to, in response to receiving a deployment request for a service and the service deployment is not the first time, acquire status information of each service unit in a resource pool corresponding to the service, wherein the status information is represented by an information set consisting of a usage of resources required for the service and call information of the service; a first prediction unit, configured to input all acquired status information into a pre-trained resource prediction model, and generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of resource usage and call information based on each duration, and the prediction information in the prediction array corresponds to each information in the status information; a determination unit, configured to determine a scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to each duration, wherein the scaling policy is used to control the number of service units in the resource pool.

[0012] In some embodiments, each duration in the first prediction unit includes: a short duration measured in hours and a long duration measured in weeks or months; the determination unit includes: a first determination module, configured to determine a first scaling policy corresponding to a deployment request of a service based on a prediction array corresponding to the short duration, the first scaling policy being used to create or destroy a service unit; a second determination module, configured to determine a second scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to the long duration, the second scaling policy being used to occupy resources of each service unit in a resource pool; and a third determination module, configured to determine a scaling policy corresponding to the deployment request of the service based on the first scaling policy and the second scaling policy.

[0013] In some embodiments, the resource prediction model in the first prediction unit is obtained by training the following modules: an acquisition module is configured to acquire a training sample set, wherein the training samples in the training sample set include status information of each service unit in the resource pool and a prediction array corresponding to each duration of each service; a training module is configured to use a deep learning method, taking the status information of each service unit in the resource pool included in the training samples in the training sample set as input data, and taking the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool as expected output data, to train the resource prediction model.

[0014] In some embodiments, the device also includes: a second prediction unit, configured to predict the usage of resources required for the service using a pre-trained first prediction model in response to the service being deployed for the first time, to obtain the predicted resource usage of the service, wherein the first prediction model is used to characterize the adjustment of the usage of resources required for the service based on an optimization goal, and the optimization goal is to balance the allocation of resources required for the service and / or find the boundaries of each resource usage; an update unit, configured to update each service unit in the resource pool corresponding to the predicted resource usage based on the resource usage of the service.

[0015] In some embodiments, the second prediction unit includes: a construction module, configured to construct a first service unit corresponding to the preset usage of resources in the resource pool based on the preset usage of resources required for the service, wherein the construction is used to characterize the setting of status information of the first service unit; an optimization module, configured to optimize the usage of resources required for the service using an optimization algorithm to obtain the resource usage of the optimized service, wherein the optimization algorithm is used to characterize the adjustment of the usage of resources required for the service based on the first service unit and the optimization target; and a deletion module, configured to delete the first service unit.

[0016] In some embodiments, resources include: GPU resources, CPU resources, memory resources, disk resources, network bandwidth resources and various resources required for the service; call information includes: number of calls, call time point, call cycle and various information corresponding to the service call.

[0017] In some embodiments, the device further includes: an execution unit configured to execute operations corresponding to the scaling policy.

[0018] According to the third aspect of the present application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable 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 method described in any implementation manner in the first aspect.

[0019] According to a fourth aspect of the present application, the present application provides a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to enable a computer to execute a method as described in any implementation manner in the first aspect.

[0020] According to the technology of the present application, in response to receiving a deployment request for a service and the service deployment is not the first time, the state information of each service unit in the resource pool corresponding to the service is obtained, wherein the state information is represented by an information set consisting of the usage of resources required by the service and the call information of the service, and all the obtained state information is input into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage and call information of the resource based on each duration, and based on the prediction array corresponding to each duration, the scaling strategy corresponding to the deployment request of the service is determined, which solves the problem that the existing technology only makes decisions based on the current state, and the execution of the strategy is often not predictable. For example, the number of service units is increased according to the need to determine the current state, and the service may have reached a bottleneck before the expansion action is completed. The resources are predicted by the pre-trained resource prediction model, which improves the accuracy of resource prediction. By predicting the resource usage of different durations in the future, an accurate scaling strategy is determined for the service unit, and the execution efficiency of automatic scaling is improved. The method is applicable to the deployment of any software service, including but not limited to algorithm models, general backend services, front-end services, etc., and realizes the formulation of corresponding scaling strategies for various types of services, with high scalability and universality.

[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0023] Figure 1 is a schematic diagram of a first embodiment of a resource control method according to the present application;

[0024] Figure 2 It is a scene diagram that can implement the resource control method of the embodiment of the present application;

[0025] Figure 3 is a schematic diagram of a second embodiment of a resource control method according to the present application;

[0026] Figure 4 is a structural diagram of an embodiment of a resource control device according to the present application;

[0027] Figure 5 It is a block diagram of an electronic device used to implement the resource control method of the embodiment of the present application. DETAILED DESCRIPTION

[0028] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0029] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0030] Figure 1 A schematic diagram 100 of a first embodiment of a resource control method according to the present application is shown. The resource control method comprises the following steps:

[0031] Step 101: in response to receiving a deployment request for a service and the service deployment is not the first time, obtaining status information of each service unit in a resource pool corresponding to the service.

[0032] In this embodiment, when the execution subject (such as a server) receives a deployment request for a service and determines that the service deployment is not the first time, the status information of each service unit in the resource pool corresponding to the service can be obtained from a local or remote device through a wired connection or a wireless connection. The status information is represented by an information set consisting of the usage of resources required for the service and the call information of the service. For example, the information set is (2-core CPU, one GPU, 8G memory, 50G storage space, 1M / s bandwidth resources). The service unit is abstracted as an information set and subsequent predictions and parameter optimization are performed based on this. The service unit is used to characterize the smallest unit required to deploy a service.

[0033] In some optional implementations of this embodiment, resources may include: GPU resources, central processing unit (CPU) resources, memory resources, disk resources, network bandwidth resources and various resources required for services; call information may include: number of calls, call time, call cycle and various information corresponding to service calls. This solves the problem that in the prior art, decisions are made based only on GPU information and memory information, and decision variables do not have good scalability and universality. This avoids the situation where the scaling decision effect is very poor for some services that are highly dependent on parameters such as the device's CPU, disk space and network performance, and implements an automatic scaling deployment strategy based on the usage of resources such as GPU, CPU, memory, disk, and network.

[0034] Step 102: input all acquired status information into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service.

[0035] In this embodiment, the execution entity can input all the status information obtained in step 101 into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service. The resource prediction model is used to characterize the prediction of resource usage and call information based on each duration. The prediction array is used to indicate the predicted value of each resource usage corresponding to a certain duration. The prediction information in the prediction array corresponds to each information in the status information, that is, the prediction information in the prediction array is used to indicate the usage of resources required for the service and the call information of the service. Each duration can be pre-set according to actual conditions. Prediction models include but are not limited to LSTM (Long short-term memory) model, ARMA (Autoregressive Moving Average) model, ARIMA (Autoregressive Integrated Moving Average) model, etc.

[0036] In some optional implementations of this embodiment, the resource prediction model is trained in the following manner: obtaining a training sample set, wherein the training samples in the training sample set include the status information of each service unit in the resource pool and the prediction array corresponding to each duration of each service; using a deep learning method, taking the status information of each service unit in the resource pool included in the training samples in the training sample set as input data, and taking the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool as expected output data, and training to obtain the resource prediction model. Using machine learning algorithms, the model is made more accurate and efficient, and has a wider range of applications.

[0037] Step 103: Determine a scaling strategy corresponding to the deployment request of the service based on the prediction arrays corresponding to the respective durations.

[0038] In this embodiment, the execution subject can determine the scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to each duration using the policy determination method. The scaling policy is used to control the number of service units in the resource pool. The scaling policy can be used to create or destroy service units, and can also be used to occupy resources of each service unit in the resource pool.

[0039] Here, each resource in the resource pool can be quantified into three states: working state, idle state, and pre-occupied state. The working state is used to indicate that the resource is in use, the idle state is used to indicate that the resource is not in use, and the occupied state is used to indicate that the resource parameters will be used as a long-term resource reserve for a certain service. The resource pool is responsible for maintaining the status of all physical resources in the cluster, and the scaling policy is used to switch the status of each resource in the resource pool. When a service needs to be expanded, service units are created from the resources occupied by this service first. If the occupied resources are not enough, they are created from the idle resources first. Only when the occupied resources and idle resources of this service are insufficient, service units will be created from the occupied resources of other services.

[0040] In some optional implementations of this embodiment, each duration includes: a short duration measured in hours and a long duration measured in weeks or months; based on the prediction arrays corresponding to each duration, a scaling strategy corresponding to the deployment request of the service is determined, including: based on the prediction array corresponding to the short duration, a first scaling strategy corresponding to the deployment request of the service is determined, and the first scaling strategy is used to create or destroy the service unit; based on the prediction array corresponding to the long duration, a second scaling strategy corresponding to the deployment request of the service is determined, and the second scaling strategy is used to occupy the resources of each service unit in the resource pool; according to the first scaling strategy and the second scaling strategy, the scaling strategy corresponding to the deployment request of the service is determined. The problem that the prior art does not consider the response strategy for short-term fluctuations and long-term fluctuations of the service is solved, and the problems of frequent scaling operations caused by short-term fluctuations and insufficient resources caused by long-term fluctuations are effectively alleviated. The prediction of the number of service units is divided into two dimensions, long-term and short-term. The short-term dimension is used to build the service unit in advance, and the long-term dimension is used to pre-occupy resources from the public resource pool in advance. Through various state information, the prediction result is more accurate and intelligent.

[0041] In some optional implementations of this embodiment, the method further includes: executing operations corresponding to the scaling strategy, that is, expanding or shrinking the service unit, and can also be used to pre-occupy the expansion or pre-occupy the shrinkage of the resources of each service unit in the resource pool, and adjust the state identifier (working state, idle state, pre-occupied state) of each resource accordingly. Accurate and intelligent deployment of service resources is achieved. Expansion refers to creating a new service unit in the resource pool according to the predicted resource change results, and shrinking refers to releasing the resources of the service unit back to the resource pool according to the predicted resource change results.

[0042] For example, use sp[] to represent the prediction array corresponding to the short time duration, and lp[] to represent the prediction array corresponding to the long time duration. Four thresholds are preset: sth1, sth2, lth1, and lth2. The value ranges of the four thresholds satisfy 0 < sth1, sth2, lth1, lth2 < 1; sth1 < sth2, and lth1 < lth2. Shrinking refers to: when sp[i] < sth1 * total_resources[i], where i represents a certain service, and total_resources[] represents the array of the total amount of resources such as GPU resources, CPU resources, memory resources, disk resources, and network bandwidth resources of the current service, try to mark some service units as destructible until sth1 * total_resources[i] < sp[i] < sth2 * total_resources[i], and perform a shrinking operation based on the current actual resource usage tp[] until sth1 * total_resources[i] < tp[i] < sth2 * total_resources[i]. Expansion refers to: when there is sp[i] > sth2 * total_resources[i], construct new service units until sth1 * total_resources[i] < sp[i] < sth2 * total_resources[i], and enable the pre-expanded service units based on the current actual resource usage until sth1 * total_resources[i] < tp[i] < sth2 * total_resources[i]. Preemptive shrinking refers to: when there is lp[i] < lth1 * total_reservation[i], try to release the resources marked as reserved until lth1 * total_reservation[i] < lp[i] < lth2 * total_reservation[i]. Preemptive expansion refers to: when there is lp[i] > lth2 * total_reservation[i], apply for resources from the resource pool and mark them as occupied until lth1 * total_reservation[i] < lp[i] < lth2 * total_reservation[i].

[0043] It should be noted that technicians can set the model structure of the above resource prediction model according to actual needs, and the embodiments of the present disclosure do not limit this.

[0044] Continue to refer to Figure 2, the resource control method 200 of this embodiment runs in an electronic device 201. When the electronic device 201 receives a deployment request for a service and determines that the service deployment is not the first time, the state information 202 of each service unit in the resource pool corresponding to the service is obtained, and then the electronic device 201 inputs all the acquired state information into a pre-trained resource prediction model to generate a prediction array 203 corresponding to each duration of the service. Finally, the electronic device 201 determines the scaling strategy 204 corresponding to the deployment request of the service based on the prediction array corresponding to each duration. Among them, the state information is represented by an information set consisting of the usage of resources required by the service and the call information of the service, and the resource prediction model is used to characterize the prediction of the usage and call information of the resources based on each duration.

[0045] The resource control method provided by the above embodiment of the present application adopts a method of obtaining the status information of each service unit in the resource pool corresponding to the service in response to receiving the deployment request of the service and the service deployment is not the first time, wherein the status information is represented by an information set consisting of the usage of the resources required by the service and the call information of the service, and all the status information obtained is input into the pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage and call information of the resource based on each duration, and based on the prediction array corresponding to each duration, the scaling strategy corresponding to the deployment request of the service is determined, which solves the problem that the existing technology only makes decisions based on the current state, and the execution of the strategy is often not predictable. For example, according to the need to increase the number of service units determined by the current state, the service may have reached a bottleneck before the expansion action is completed. The resources are predicted by the pre-trained resource prediction model, which improves the accuracy of resource prediction. By predicting the resource usage of different durations in the future, the scaling strategy is determined for the service unit in advance, and the execution efficiency of automatic scaling is improved. This method is applicable to the deployment of any software service, including but not limited to algorithm models, general back-end services, front-end services, etc. It implements the formulation of corresponding scaling strategies for various types of services and has high scalability and universality.

[0046] Further references Figure 3 , which shows a schematic diagram 300 of a second embodiment of a resource control method. The process of the method includes the following steps:

[0047] Step 301, in response to receiving a deployment request for a service and the service is deployed for the first time, predicting the usage of resources required by the service using a pre-trained first prediction model to obtain predicted resource usage of the service.

[0048] In this embodiment, when the execution subject receives a deployment request for a service and determines that the service is deployed for the first time, the pre-trained first prediction model can be used to predict the usage of resources required for the service to obtain the predicted resource usage of the service. The first prediction model is used to characterize the adjustment of the usage of resources required for the service based on the optimization goal, and the optimization goal is to balance the allocation of resources required for the service and / or find the boundaries of the usage of each resource.

[0049] In some optional implementations of the present embodiment, a pre-trained first prediction model is used to predict the usage of resources required for a service to obtain the predicted resource usage of the service, including: based on the preset usage of resources required for the service, a first service unit corresponding to the preset usage of resources is constructed in a resource pool, wherein the construction is used to characterize the setting of state information of the first service unit; using an optimization algorithm, the usage of resources required for the service is optimized to obtain the optimized resource usage of the service, wherein the optimization algorithm is used to characterize the adjustment of the usage of resources required for the service based on the first service unit and the optimization target; deleting the first service unit. The first service unit is used to characterize the service unit for parameter optimization. The constructed first service unit is used to find the optimal service unit resource configuration, so that limited computing resources can be used more efficiently.

[0050] To further explain, service units can be divided into two types: one is a common service unit and the other is a service unit for parameter optimization. Both common service units and parameter optimization service units provide the same services to the outside world. The difference is that the parameter optimization service unit only appears in the stage of parameter optimization of a certain service. When the parameter optimization process is over, the parameter optimization service unit will be cleared.

[0051] Here is an example of the optimization process. First, the number of requests for the first service unit is continuously increased through stress testing, and the supply of service unit resources is adjusted using the return results of the optimization target. The supply of service resources is gradually increased while satisfying the constraints until the optimal solution for the optimization target is found. After that, a new parameter optimization service unit is constructed based on the optimized service unit configuration parameters.

[0052] Step 302: Based on the resource usage of the service, update each service unit in the resource pool corresponding to the predicted resource usage.

[0053] In this embodiment, the execution entity may gradually update all service units of the service in the resource pool to a parameter configuration scheme corresponding to the predicted resource usage based on the resource usage of the service predicted in step 301 .

[0054] It should be noted that technicians can set the model structure of the first prediction model according to actual needs, and the embodiments of the present disclosure are not limited to this.

[0055] from Figure 3 It can be seen that Figure 1 Compared with the corresponding embodiment, the schematic diagram 300 of the resource control method in this embodiment adopts a method of predicting the usage of resources required by the service by using a pre-trained first prediction model in response to receiving a deployment request of the service and the service deployment is the first time, obtaining the predicted resource usage of the service, and updating each service unit corresponding to the predicted resource usage in the resource pool based on the resource usage of the service, which solves the problem that the prior art only considers the horizontal scaling of the number of service units, but does not pay enough attention to the service unit itself, resulting in the lack of vertical dimension scaling function of the service unit. The optimal parameter setting of the service unit is predicted before the formal deployment, so that the limited total amount of resources can eventually provide the maximum service capacity. By taking the balanced allocation of resources required by the service as the optimization goal, the ineffective waste of a certain resource is reduced, and by finding the boundary of each resource usage as the optimization goal, it is ensured that the resources can be fully utilized, the unit resource output is maximized, and the demand for redundant resources at the peak of the service is guaranteed. An adaptive adjustment strategy is implemented to dynamically adjust the parameters of the GPU, CPU, memory, disk, network and other resources in the service unit according to different types of services, including the ratio and absolute value between different resources. A multi-dimensional adaptive scalable deployment method is implemented, which takes into account both the horizontal scalability of the number of service units and the vertical scalability of the resource configuration parameters within the service units.

[0056] Further references Figure 4 , as a response to the above Figures 1 to 3 In order to realize the method shown in the figure, the present application provides an embodiment of a resource control device, and the embodiment of the device is Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0057] like Figure 4As shown, the resource control device 400 of this embodiment includes: an acquisition unit 401, a first prediction unit 402 and a determination unit 403, wherein the acquisition unit is configured to, in response to receiving a deployment request for a service and the service deployment is not the first time, acquire the state information of each service unit in the resource pool corresponding to the service, wherein the state information is represented by an information set consisting of the usage of resources required by the service and the call information of the service; the first prediction unit is configured to input all the acquired state information into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage and call information of the resource based on each duration, and the prediction information in the prediction array corresponds to each information in the state information; the determination unit is configured to determine the scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to each duration, wherein the scaling policy is used to control the number of service units in the resource pool.

[0058] In this embodiment, the specific processing of the acquisition unit 401, the first prediction unit 402 and the determination unit 403 of the resource control device 400 and the technical effects thereof can be referred to in Figure 1 The relevant descriptions of steps 101 to 103 in the corresponding embodiment are not repeated here.

[0059] In some optional implementations of this embodiment, each duration in the first prediction unit includes: a short duration measured in hours and a long duration measured in weeks or months; the determination unit includes: a first determination module, configured to determine a first scaling policy corresponding to a deployment request of a service based on a prediction array corresponding to the short duration, the first scaling policy being used to create or destroy a service unit; a second determination module, configured to determine a second scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to the long duration, the second scaling policy being used to occupy resources of each service unit in a resource pool; and a third determination module, configured to determine a scaling policy corresponding to the deployment request of the service based on the first scaling policy and the second scaling policy.

[0060] In some optional implementations of the present embodiment, the resource prediction model in the first prediction unit is obtained by training the following modules: an acquisition module is configured to acquire a training sample set, wherein the training samples in the training sample set include status information of each service unit in the resource pool and a prediction array corresponding to each duration of each service; a training module is configured to use a deep learning method, taking the status information of each service unit in the resource pool included in the training samples in the training sample set as input data, and taking the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool as expected output data, to train the resource prediction model.

[0061] In some optional implementations of this embodiment, the device also includes: a second prediction unit, configured to predict the usage of resources required for the service using a pre-trained first prediction model in response to the service being deployed for the first time, to obtain the predicted resource usage of the service, wherein the first prediction model is used to characterize the adjustment of the usage of resources required for the service based on an optimization goal, and the optimization goal is to balance the allocation of resources required for the service and / or find the boundaries of each resource usage; an update unit, configured to update each service unit in the resource pool corresponding to the predicted resource usage based on the resource usage of the service.

[0062] In some optional implementations of this embodiment, the second prediction unit includes: a construction module, configured to construct a first service unit corresponding to the preset usage of resources in the resource pool based on the preset usage of resources required for the service, wherein the construction is used to characterize the setting of status information of the first service unit; an optimization module, configured to optimize the usage of resources required for the service using an optimization algorithm to obtain the resource usage of the optimized service, wherein the optimization algorithm is used to characterize the adjustment of the usage of resources required for the service based on the first service unit and the optimization target; and a deletion module, configured to delete the first service unit.

[0063] In some optional implementations of this embodiment, resources include: GPU resources, CPU resources, memory resources, disk resources, network bandwidth resources and various resources required for the service; call information includes: number of calls, call time point, call cycle and various information corresponding to the service call.

[0064] In some optional implementations of this embodiment, the device further includes: an execution unit configured to execute an operation corresponding to the scaling policy.

[0065] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

[0066] like Figure 5 , is a block diagram of an electronic device according to a resource control method of an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0067] like Figure 5As shown, the electronic device includes: one or more processors 501, a memory 502, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 501 is taken as an example.

[0068] The memory 502 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable at least one processor to execute the resource control method provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to execute the resource control method provided in the present application.

[0069] The memory 502 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the resource control method in the embodiment of the present application (for example, the attached Figure 4 The processor 501 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 502, that is, implements the resource control method in the above method embodiment.

[0070] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the resource control electronic device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 502 may optionally include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to the resource control electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0071] The electronic device of the resource control method may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0072] The input device 503 can receive input digital or character information, and generate key signal input related to user settings and function control of the resource control electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a track ball, a joystick and other input devices. The output device 504 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0073] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0074] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0075] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0076] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0077] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0078] According to the technical solution of the embodiment of the present application, in response to receiving a deployment request for a service and the service deployment is not the first time, the state information of each service unit in the resource pool corresponding to the service is obtained, wherein the state information is represented by an information set consisting of the usage of resources required by the service and the call information of the service, and all the obtained state information is input into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage and call information of the resource based on each duration, and based on the prediction array corresponding to each duration, the scaling strategy corresponding to the deployment request of the service is determined, which solves the problem that the prior art only makes decisions based on the current state and the execution of the strategy is often not predictable. For example, the number of service units is increased according to the need to determine the current state, and the service may have reached a bottleneck before the expansion action is completed. The resources are predicted by the pre-trained resource prediction model, which improves the accuracy of resource prediction. By predicting the resource usage of different durations in the future, an accurate scaling strategy is determined for the service unit, and the execution efficiency of automatic scaling is improved. The method is applicable to the deployment of any software service, including but not limited to algorithm models, general backend services, front-end services, etc., and realizes the formulation of corresponding scaling strategies for various types of services, with high scalability and universality.

[0079] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0080] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A resource control method, the method comprising: In response to receiving a deployment request for a service and the deployment of the service is not the first time, obtaining status information of each service unit in a resource pool corresponding to the service, wherein the status information is represented by an information set consisting of a usage amount of resources required by the service and call information of the service; Input all the acquired state information into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage of the resource and the call information based on each duration, and the prediction information in the prediction array corresponds to each information in the state information, and each duration includes: a short duration measured in hours and a long duration measured in weeks or months; Determining a scaling policy corresponding to the deployment request of the service based on the prediction arrays corresponding to the respective durations, wherein the scaling policy is used to control the number of service units in the resource pool, including: Determining, based on the prediction array corresponding to the short duration, a first scaling policy corresponding to the deployment request of the service, where the first scaling policy is used to create or destroy the service unit; Determining, based on the prediction array corresponding to the long duration, a second scaling strategy corresponding to the deployment request of the service, wherein the second scaling strategy is used to occupy the resources of each of the service units in the resource pool; The scaling policy corresponding to the deployment request of the service is determined according to the first scaling policy and the second scaling policy.

2. The method according to claim 1, wherein: The resource prediction model is trained in the following way: Acquire a training sample set, wherein the training samples in the training sample set include status information of each service unit in the resource pool and a prediction array corresponding to each duration of each service; Using a deep learning method, the status information of each service unit in the resource pool included in the training samples in the training sample set is used as input data, and the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool is used as expected output data to train a resource prediction model.

3. The method according to claim 1, further comprising: In response to the service being deployed for the first time, using a pre-trained first prediction model to predict the usage of resources required by the service, to obtain predicted resource usage of the service, wherein the first prediction model is used to characterize the adjustment of the usage of resources required by the service based on an optimization goal, wherein the optimization goal is to balance the allocation of resources required by the service and / or find the boundaries of each resource usage; Based on the resource usage of the service, each of the service units corresponding to the predicted resource usage in the resource pool is updated.

4. The method according to claim 3, wherein: The using of the pre-trained first prediction model to predict the usage of the resources required by the service to obtain the predicted resource usage of the service includes: Based on the preset usage of the resource required by the service, constructing a first service unit corresponding to the preset usage of the resource in the resource pool, wherein the construction is used to represent setting of state information of the first service unit; Using an optimization algorithm, optimizing the usage of resources required for the service to obtain an optimized resource usage of the service, wherein the optimization algorithm is used to represent an adjustment of the usage of resources required for the service based on the first service unit and the optimization target; The first service unit is deleted.

5. The method according to claim 1, wherein: The resources include: GPU resources, CPU resources, memory resources, disk resources, network bandwidth resources and various resources required for the service; the call information includes: the number of calls, the call time point, the call cycle and various information corresponding to the service call.

6. The method according to claim 1, further comprising: Execute operations corresponding to the scaling policy.

7. A resource control device, comprising: an acquisition unit, configured to, in response to receiving a deployment request for a service and the deployment of the service is not the first time, acquire state information of each service unit in a resource pool corresponding to the service, wherein the state information is represented by an information set consisting of a usage amount of resources required by the service and call information of the service; A first prediction unit is configured to input all the acquired state information into a pre-trained resource prediction model to generate a prediction array corresponding to each duration of the service, wherein the resource prediction model is used to characterize the prediction of the usage of the resource and the call information based on the various durations, the prediction information in the prediction array corresponds to each piece of information in the state information, and the various durations in the first prediction unit include: a short duration measured in hours and a long duration measured in weeks or months; a determining unit configured to determine a scaling policy corresponding to the deployment request of the service based on the prediction arrays corresponding to the respective durations, wherein the scaling policy is used to control the number of service units in the resource pool; The determining unit comprises: A first determining module is configured to determine a first scaling policy corresponding to the deployment request of the service based on the prediction array corresponding to the short duration, wherein the first scaling policy is used to create or destroy the service unit; A second determining module is configured to determine a second scaling strategy corresponding to the deployment request of the service based on the prediction array corresponding to the long duration, wherein the second scaling strategy is used to occupy the resources of each of the service units in the resource pool; The third determining module is configured to determine the scaling policy corresponding to the deployment request of the service according to the first scaling policy and the second scaling policy.

8. The device according to claim 7, wherein: The resource prediction model in the first prediction unit is obtained by training the following modules: An acquisition module is configured to acquire a training sample set, wherein the training samples in the training sample set include state information of each service unit in the resource pool and a prediction array corresponding to each duration of each service; The training module is configured to use a deep learning method, taking the status information of each service unit in the resource pool included in the training samples in the training sample set as input data, and taking the prediction array corresponding to each duration of each service corresponding to the status information of each service unit in the resource pool as expected output data, to train a resource prediction model.

9. The device according to claim 7, further comprising: A second prediction unit is configured to predict the usage of resources required by the service using a pre-trained first prediction model in response to the service being deployed for the first time, so as to obtain the predicted resource usage of the service, wherein the first prediction model is used to characterize the adjustment of the usage of resources required by the service based on an optimization goal, wherein the optimization goal is to balance the allocation of resources required by the service and / or find the boundaries of the usage of each resource; The updating unit is configured to update each of the service units corresponding to the predicted resource usage in the resource pool based on the resource usage of the service.

10. The device according to claim 9, wherein: The second prediction unit comprises: a construction module configured to construct, in the resource pool, a first service unit corresponding to the preset usage of the resource required by the service, based on the preset usage of the resource required by the service, wherein the construction is used to represent setting of state information of the first service unit; an optimization module, configured to optimize the usage of resources required by the service by using an optimization algorithm to obtain an optimized resource usage of the service, wherein the optimization algorithm is used to represent an adjustment of the usage of resources required by the service based on the first service unit and the optimization target; The deleting module is configured to delete the first service unit.

11. The device according to claim 7, wherein: The resources include: GPU resources, CPU resources, memory resources, disk resources, network bandwidth resources and various resources required for the service; the call information includes: the number of calls, the call time point, the call cycle and various information corresponding to the service call.

12. The device according to claim 7, further comprising: The execution unit is configured to execute the operation corresponding to the scaling strategy.

13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; 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 to enable the at least one processor to perform the method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for managing resource dynamic allocation

    CN103713955A

  • Method and device for predicting system computing resource based on exponential smoothing prediction

    CN105912436A