A method, device and medium for scheduling server computing resources
Dynamically scheduling server computing resources through the reinforcement learning model solves the problem of low computing resource utilization in the cloud platform and improves resource utilization and computing efficiency.
Patent Information
- Application Number
- CN202210468204.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-04-29
AI Technical Summary
In cloud platform application scenarios, the utilization rate of server computing resources is low, resulting in the inability to schedule computing resources in time when user needs change, resulting in insufficient or redundant computing power, affecting efficiency.
The reinforcement learning model is used to obtain the amount of computing resources allocated by the server to users and their actual usage, calculate the amount of resource scheduling, adjust the allocation of computing resources, and optimize resource utilization.
By dynamically scheduling computing resources, the computing resource utilization of the server and the computing efficiency of user services are improved, and the problem of unreasonable resource allocation is solved.
Smart Images

Figure CN114756352B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the server field, and in particular to a method, device and medium for scheduling server computing resources. Background Art
[0002] Cloud computing and high-performance computing are both popular research and application directions in the Internet field. There are countless products related to them in the software and hardware market, such as "Google Cloud", "Alibaba Cloud" and various supercomputers. In recent years, the boundary between cloud computing and high-performance computing has gradually blurred, and a new concept has emerged. "Cloud-based high-performance computing" combines the form of cloud services with high-performance characteristics, which is bound to have a broader application prospect. Most of the technologies mentioned above are based on the support of a hardware product, a high-performance server with huge computing resources. For a large-scale cloud platform like "Alibaba Cloud", it requires the support of a high-performance server cluster.
[0003] In the current cloud platform application scenarios, there are mainly two modes: one is that the user authenticates and logs in to the platform, and applies to call the service interface provided by the platform. Applications of this mode include "OCR recognition" and "text processing"; the other is that the user applies to the platform for certain computing resources and creates new nodes for personal services. Applications of this mode include "data analysis" and "deep learning". These two modes seem different, but in fact, whether it is providing interfaces or nodes, the computing resources allocated by the platform to user services are basically fixed, which may lead to drawbacks in the utilization of server computing resources. When the computing power required by the service currently being run by the user is low, the computing resources allocated to the user are redundant, reducing the utilization rate of the server computing resources; when the computing power required by the service is high, the computing resources allocated to the user are insufficient, reducing the operating efficiency of the service and causing users to be dissatisfied with the platform performance.
[0004] It can be seen that how to more reasonably schedule server computing resources is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0005] The purpose of this application is to provide a method, device and medium for scheduling server computing resources, which are used to schedule server computing resources more reasonably.
[0006] To solve the above technical problems, the present application provides a method for scheduling server computing resources, including:
[0007] Acquire a first computing resource amount allocated by the server for the user service at the current moment and a second computing resource amount allocated by the server for the user service at a moment next to the current moment;
[0008] Obtaining a first difference between the second computing resource amount and the first computing resource amount;
[0009] Inputting the first difference and the first amount of computing resources allocated by the server to the user service at the current moment into a pre-established reinforcement learning model;
[0010] Outputting the computing resource scheduling amount of the server through the reinforcement learning model;
[0011] The computing resources of the server are scheduled according to the scheduling amount of the computing resources of the server.
[0012] Preferably, establishing the reinforcement learning model includes:
[0013] Obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment;
[0014] Respectively obtaining a second difference between the first computing resource amounts allocated to the user service at two adjacent moments;
[0015] Obtaining actual utilization rate of computing resources of the server at each said moment according to the first computing resource amount allocated by the server to the user service at each said moment and the computing resource amount actually used by the user service at each said moment;
[0016] Obtaining an actual computing resource scheduling amount according to an actual utilization rate of computing resources of the server at each of the times and a computing rate corresponding to the computing resource amount actually used by the user service at each of the times;
[0017] Using the second difference and the first computing resource amount allocated by the server to the user service at each time as inputs of the reinforcement learning model and calculating a theoretical computing resource scheduling amount;
[0018] Obtaining a third difference between the actual computing resource scheduling amount and the theoretical computing resource scheduling amount;
[0019] The training gradient of the reinforcement learning model is adjusted according to the third difference, and the computing parameters used to characterize the reinforcement learning model are updated until the theoretical computing resource scheduling amount and the actual resource scheduling amount meet the preset requirements, thereby completing the construction of the reinforcement learning model.
[0020] Preferably, the reinforcement learning model is a Q-Learning algorithm model, and the updating of the calculation parameters used to characterize the reinforcement learning model includes:
[0021] Adding RNN structure to the Q-Learning algorithm model;
[0022] Recording each of the calculation parameters before updating the current calculation parameters through the RNN structure;
[0023] Determine whether the current calculation parameters have gradient explosion;
[0024] If yes, then determining updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure;
[0025] If not, the current calculation parameters are used as updated calculation parameters for characterizing the reinforcement learning model.
[0026] Preferably, the determining of updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure includes:
[0027] Obtaining the average value of each of the previous calculation parameters recorded by the RNN structure;
[0028] The average value is used as an updated calculation parameter for characterizing the reinforcement learning model.
[0029] Preferably, after obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment, the method further includes:
[0030] The first amount of computing resources and the amount of computing resources actually used by the user service at each time are converted into data in a unified format according to preset rules.
[0031] Preferably, the preset rule is a rule determined according to the user service and the type of information included in the user service.
[0032] Preferably, after outputting the computing resource scheduling amount of the server through the reinforcement learning model, the method further includes:
[0033] Record the user service at the current moment and the computing resource scheduling amount of the server at the current moment.
[0034] In order to solve the above technical problems, the present application also provides a device for scheduling server computing resources, including:
[0035] A first acquisition module, used to acquire a first computing resource amount allocated by the server for the user service at the current moment and a second computing resource amount allocated by the server for the user service at a moment next to the current moment;
[0036] A second acquisition module, used to acquire a first difference between the second computing resource amount and the first computing resource amount;
[0037] An input module, used for inputting the first difference and the first computing resource amount allocated by the server to the user service at the current moment into a pre-established reinforcement learning model;
[0038] An output module, used to output the computing resource scheduling amount of the server through the reinforcement learning model;
[0039] The scheduling module is used to schedule the computing resources of the server according to the scheduling amount of the computing resources of the server.
[0040] In order to solve the above technical problems, the present application also provides a device for scheduling server computing resources, including:
[0041] Memory for storing computer programs;
[0042] The processor is used to implement the steps of the above-mentioned method for scheduling server computing resources when executing the computer program.
[0043] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method for scheduling server computing resources are implemented.
[0044] The method for scheduling server computing resources provided in the present application includes: obtaining the first computing resource amount allocated by the server for user services at the current moment, and the second computing resource amount allocated by the server for user services at the next moment after the current moment; obtaining the first difference between the second computing resource amount and the first computing resource amount; inputting the first difference and the first computing resource amount allocated by the server for user services at the current moment into a pre-established reinforcement learning model; outputting the computing resource scheduling amount of the server through the reinforcement learning model; and scheduling computing resources according to the computing resource scheduling amount of the server. Compared with the server allocating fixed computing resources to user services, the method of the present application calculates the computing resource scheduling amount of the server through the reinforcement learning model, thereby allocating computing resources to user services according to the computing resource scheduling amount of the server, so that the computing resources allocated by the server to the user services are maximized as much as possible, optimizing the computing efficiency of the user services to a certain extent, and improving the computing resource utilization of the server.
[0045] In addition, the present application also provides a device for scheduling server computing resources and a computer-readable storage medium, which have the same or corresponding technical features as the above-mentioned method for scheduling server computing resources and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 A flowchart of a method for scheduling server computing resources provided in this application;
[0048] Figure 2 A flowchart of the nth iteration of a Q-Learning algorithm provided in an embodiment of the present application;
[0049] Figure 3 A structural diagram of an apparatus for scheduling server computing resources provided in one embodiment of the present application;
[0050] Figure 4 A structural diagram of an apparatus for scheduling server computing resources provided in another embodiment of the present application;
[0051] Figure 5 An overall flow chart of scheduling server computing resources provided in an embodiment of the present application;
[0052] Figure 6 A specific flowchart for N iterations to train the Q-Learning algorithm model. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] The core of this application is to provide a method, device and medium for scheduling server computing resources, which are used to schedule server computing resources more reasonably.
[0055] For ease of understanding, the hardware structure used in the technical solution of the present application is introduced below. The hardware architecture of the resource scheduling method provided by the present application mainly includes a server. The efficiency of resource scheduling depends largely on the number of servers and the performance of the servers. When there are a large number of high-performance servers, the efficiency of resource scheduling is high. When the number of servers is small and the performance is low, the efficiency of resource scheduling is low.
[0056] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 A flowchart of a method for scheduling server computing resources provided in this application, such as Figure 1 As shown, the method includes:
[0057] S10: Obtain the first computing resource amount allocated by the server for the user service at the current moment and the second computing resource amount allocated by the server for the user service at the next moment after the current moment.
[0058] User services such as OCR recognition, etc. Monitor the amount of computing resources allocated by the server for user services at each moment, and refer to the amount of computing resources allocated by the server for user services at the current moment as the first computing resources, and refer to the amount of computing resources allocated by the server for user services at the next moment after the current moment as the second computing resources. The allocated first computing resources and second computing resources may be data such as the CPU occupancy rate, memory capacity, and network bandwidth.
[0059] S11: Obtain a first difference between the second computing resource amount and the first computing resource amount.
[0060] In the above steps, the first computing resource amount and the second computing resource amount are obtained. Since the data types, units, and value intervals of the first computing resource amount and the second computing resource amount are different, it is necessary to preprocess each computing resource amount after obtaining the first computing resource amount and the second computing resource amount. For example, the computing resource amount is transposed to the corresponding numerical value of the same interval. The difference between the first computing resource amount and the second computing resource amount is obtained, and the difference between the two is the first difference, which can obtain the continuous change of the computing resources allocated by the server.
[0061] S12: Input the first difference and the first amount of computing resources currently allocated by the server to serve the user into a pre-established reinforcement learning model.
[0062] Since the reinforcement learning model can predict the action that obtains the maximum benefit, this embodiment uses the pre-established reinforcement learning model to predict the server computing resources and schedules them according to the prediction results. In the pre-established reinforcement learning model, the difference between the first computing amounts allocated by the server for user services at adjacent moments and the first computing amounts allocated by the server for user services at each moment are used as inputs to the reinforcement learning model, and the theoretical computing resource scheduling amount is calculated and output, that is, the corresponding computing resource allocation amount when the computing resources can be maximized.
[0063] S13: Outputting the computing resource scheduling amount of the server through the reinforcement learning model;
[0064] S14: Scheduling the computing resources of the server according to the scheduling amount of the computing resources of the server.
[0065] The computing resource scheduling amount of the server is output through the reinforcement learning model, so that the computing resources of the server are scheduled according to the computing resource scheduling amount.
[0066] The method for scheduling server computing resources provided in this embodiment includes: obtaining the first computing resource amount allocated by the server for user services at the current moment and the second computing resource amount allocated by the server for user services at the next moment after the current moment; obtaining the first difference between the second computing resource amount and the first computing resource amount; inputting the first difference and the first computing resource amount allocated by the server for user services at the current moment into a pre-established reinforcement learning model; outputting the computing resource scheduling amount of the server through the reinforcement learning model; and scheduling computing resources according to the computing resource scheduling amount of the server. Compared with the server allocating fixed computing resources to user services, the method of this embodiment calculates the computing resource scheduling amount of the server through the reinforcement learning model, thereby allocating computing resources to user services according to the computing resource scheduling amount of the server, so that the computing resources allocated by the server to the user services are maximized as much as possible, optimizing the computing efficiency of the user services to a certain extent, and improving the computing resource utilization of the server.
[0067] In order to accurately predict the server's computing resource scheduling through the reinforcement learning model, in practice, the reinforcement learning model is established including:
[0068] Obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment;
[0069] Respectively obtaining a second difference between the first computing resource amounts allocated to the user service at two adjacent moments;
[0070] Obtaining the actual utilization rate of the computing resources of the server at each moment according to the first computing resource amount allocated by the server to the user service at each moment and the computing resource amount actually used by the user service at each moment;
[0071] The actual computing resource scheduling amount is obtained according to the actual utilization rate of the computing resources of the server at each moment and the computing rate corresponding to the amount of computing resources actually used by the user service at each moment;
[0072] The second difference and the first computing resource amount allocated by the server to the user service at each time are used as inputs of the reinforcement learning model and the theoretical computing resource scheduling amount is calculated;
[0073] Obtaining a third difference between the actual computing resource scheduling amount and the theoretical computing resource scheduling amount;
[0074] The training gradient of the reinforcement learning model is adjusted according to the third difference, and the computing parameters used to characterize the reinforcement learning model are updated until the theoretical computing resource scheduling amount and the actual resource scheduling amount meet the preset requirements, and the reinforcement learning model is constructed.
[0075] When a user service is called, the server starts to dynamically allocate computing resources for it and record them, while monitoring the actual computing resources used by the service in real time, similar to viewing the occupancy of system tasks through the task manager in Windows or monitoring the resource occupancy of each application in a container under virtualization. At the same time, the server also needs to obtain the computing volume of the service in a period of time in real time. The shorter the time period obtained, the more it can reflect the actual computing rate of the user service at a certain moment.
[0076] The collected information is sorted in chronological order, and after a simple division of the various parameters in each piece of information, the data set is preprocessed and transposed into a numerical vector, and finally two two-dimensional vectors are obtained by transposing the computing resource data. The two-dimensional vector formed by transposing the first computing resource amount allocated by the server for the user service at the current moment is represented by S, and the two-dimensional vector formed by transposing the computing resource amount actually used by the user service at the current moment is represented by S'. Assuming that the current moment is moment n, the next moment is moment n+1, S n , S n+1 They represent the first amount of computing resources allocated by the server for user services at time n and the first amount of computing resources allocated by the server for user services at time n+1 respectively. n+1 -S n The continuous change of computing resources allocated by the server is obtained, which is the action A required in the reinforcement learning model. The actual utilization rate of computing resources allocated by the server at each moment can be obtained through S' / S, and then combined with the instantaneous computing rate at each moment, the benefit Q(S, A) of the reinforcement learning model can be obtained, which represents the actual computing resource scheduling amount of the server at each moment.
[0077] When a two-dimensional vector is imported into the reinforcement learning model, a Q' two-dimensional vector will be established and initialized first, with all initial values being 0. The state S and action A are used as input to calculate the value of the theoretical computing resource scheduling amount Q'(S, A). According to the difference between it and the actual computing resource scheduling amount Q(S, A), that is, the error, the training gradient is adjusted and the computing parameters used to characterize the reinforcement learning model are updated. The above process is repeated and iterated continuously until the theoretical computing resource scheduling amount and the actual resource scheduling amount meet the preset requirements, and the reinforcement learning model is constructed. Preferably, the preset requirement is that the calculated theoretical computing resource scheduling amount Q' converges to the actual computing resource scheduling amount Q until they are approximately equal. At this time, the Q' value calculated by the reinforcement learning model can be regarded as the actual Q value.
[0078] The method for establishing a reinforcement learning model provided in this embodiment enables the established reinforcement learning model to more accurately predict the computing resource scheduling amount of the server through multiple iterations.
[0079] Based on the above embodiment, the reinforcement learning model is a Q-Learning algorithm model. In order to minimize the gradient explosion during the iteration process, the preferred implementation method is that updating the calculation parameters used to characterize the reinforcement learning model includes:
[0080] Add a recurrent neural network (RNN) structure to the Q-Learning algorithm model;
[0081] Record each calculation parameter before updating the current calculation parameter through the RNN structure;
[0082] Determine whether the gradient of the current calculation parameters has exploded;
[0083] If yes, then determine the updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure;
[0084] If not, the current calculation parameters are used as updated calculation parameters for characterizing the reinforcement learning model.
[0085] The Q-Learning algorithm is used to build a reinforcement learning model. The four components of Q-Learning are the state table s, the action table a, the benefit table Q(s,a) and the self-update module. The model learning process can be understood as n Make an action when m , get the next state s of the current state n+1 and Q(s n ,a m), and perform the nth parameter update. The algorithm formula is shown in formula (1):
[0086] Q(s,a)←Q(s,a)+α[r+ymax a′ Q(s′, a′)-Q(s, a)] (I)
[0087] In the above formula, α represents the learning rate, γ represents the reward decay coefficient, and Q(s',a') represents the future return. Since the n iterations of the Q-Learning algorithm are relatively independent, that is to say, the gradient of the parameter update in the nth iteration is only determined by the value in this iteration, there may be a risk of gradient explosion after many rounds of iterations. In this embodiment, the reinforcement learning model embeds a layer of RNN structure in the Q-Learning algorithm, and the data of the previous n-1 iterations of Q-Learning are recorded through the RNN structure, and after processing, they are used as reference values for comparison with the nth iteration data. When a parameter in the nth iteration is likely to have a gradient explosion, the corresponding parameter is overwritten with the value recorded in the RNN. Figure 2 This is a flowchart of the nth iteration of a Q-Learning algorithm provided in an embodiment of the present application. The process includes: obtaining the previous profit Q(s n-1 ,a m-1 ), current state s n ; Q(s n-1 ,a m-1 ), s n Input into the RNN structure, where the RNN structure includes an input layer, a hidden layer, and an output layer. The previous n-1 iterations are recorded in the RNN structure. The output result of the RNN structure is self-updated through the RELU activation function, the value function, and the advantage function, and finally the current profit Q(s) is output. n ,a m ), the next state s of the current state n+1 , get the action a corresponding to the current benefit m .
[0088] This embodiment provides a method for reducing the occurrence of gradient explosion by adding an RNN structure to the Q-Learning algorithm model, making the entire reinforcement learning model more stable.
[0089] On the basis of the above embodiment, when updating the calculation parameters for characterizing the reinforcement learning model, a preferred implementation method is that the updated calculation parameters for characterizing the reinforcement learning model are determined according to the previous calculation parameters recorded by the RNN structure, including:
[0090] Get the average value of each previous calculation parameter recorded by the RNN structure;
[0091] The average value is used as the updated calculation parameter for characterizing the reinforcement learning model.
[0092] When a certain calculation parameter in the nth iteration is likely to have a gradient explosion, the average value of the parameters of the first n-1 iterations recorded in the RNN structure is used as the updated calculation parameter for characterizing the reinforcement learning model.
[0093] The method for obtaining updated calculation parameters provided in this embodiment can, on the one hand, reduce the occurrence of gradient explosion as much as possible, making the entire reinforcement learning model more stable; secondly, since the updated calculation parameters are obtained based on the average value of the previously recorded calculation parameters, using the average value can better represent the situation of the calculation parameters.
[0094] In implementation, in order to enable the collected data to be input into the reinforcement learning model as much as possible, a preferred implementation method is that after obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment, it also includes:
[0095] The first computing resource amount and the computing resource amount actually used by the user service at each moment are converted into data in a unified format according to preset rules.
[0096] In this embodiment, the preset rules are not limited, and appropriate preset rules are selected according to actual conditions. For example, for user services such as OCR recognition, the monitored information is the type of image (different types of images have different text amounts), the pixel ratio and size of the image, etc., and the approximate computing amount of the service can be obtained based on this information. For the computing resources of the server, the information monitored by this module is relatively fixed, which can be the CPU computing power allocated by the server (reflected by the number of CPU threads and occupancy rate), memory capacity, disk space size, GPU computing power (reflected by the number of GPU cores and video memory occupancy), network bandwidth and other resources and the actual amount of resources used by the service. Because the information monitored by the data collection module is mostly abstract, they may not be numerical values, or even if they are numerical values, their data types, units and value intervals are different. These data cannot be processed by the reinforcement learning model, so it is necessary to digitize the abstract information and unify the different numerical ranges. For example, for computing resources, the three types of data, CPU occupancy, memory capacity, and network bandwidth, are in units of %, GB, and Mbps, respectively, and the value ranges are roughly [0%, 100%], [2GB, 128GB], and [100Mbps, 10000Mbps]. They can be transposed to an interval of [0, 1]. For example, if the value of the network bandwidth is 1000Mbps, its value range is [100Mbps, 10000Mbps]. Taking the square root and dividing it by 100, we can get the parameter value of the network bandwidth ≈ 0.316. For user services, such as the "OCR recognition" mentioned above, the pixel ratio and size of the image can also be transposed normally, and the information of the image type can be estimated to a certain extent. For example, the text volume of news images is large, which can be estimated as a value > 0.8, and the text volume of advertising images is small, which can be estimated as a value < 0.2. From this, the approximate computing volume of the corresponding user service can be estimated.
[0097] There is no limitation on the unified format of data, and in this embodiment, the data is uniformly converted into a two-dimensional vector. After the obtained data set is processed, it is transposed into multiple groups of two-dimensional numerical vectors and provided to the reinforcement learning model. The computing resource information allocated at each moment is transposed into a one-dimensional vector, and then the computing resource information allocated in the entire data set is transposed into an m*n two-dimensional vector, and the resources actually occupied by the service are also transposed into a two-dimensional vector.
[0098] In addition, for the computing rate corresponding to the amount of computing resources actually used by the user service at each moment, take "OCR recognition" as an example. As mentioned above, for a news image, its estimated text volume is 0.8. If its resolution is 4K, then its number of pixels is about 8.3 million. If its format is .jpg, the image size is about 10MB. Then we estimate that there are about 6640 computing volumes for this image. If the time to process this image is Δt, then the computing resources allocated by the server at each moment in the Δt time period obtain the corresponding computing rate of 6640 / Δt. In fact, the Δt required to process an image is extremely small, so the instantaneous computing rate at a certain moment can be almost obtained.
[0099] The present embodiment provides a method for converting the first computing resource amount and the computing resource amount actually used by the user service at each moment into data in a unified format according to preset rules, so that the acquired data can be input into the reinforcement learning model as much as possible with as many samples as possible, thereby improving the accuracy of the computing resource scheduling amount of the server calculated by the reinforcement learning model.
[0100] In order to convert the collected data sets into a unified format, a preferred implementation method is that the preset rules are rules determined according to user services and the types of information contained in the user services.
[0101] Different user services contain different types of information. For example, the OCR recognition user service mentioned above may obtain information such as the type of image, image pixel ratio, size, etc. by monitoring the user service. The values of image pixel ratio and size can also be transposed normally, and the information of image type can be estimated to a certain extent. For example, news images with a large amount of text can be estimated as a value >0.8, and advertising images with a small amount of text can be estimated as a value <0.2.
[0102] The preset rules provided in this embodiment are rules determined according to user services and the types of information contained in the user services, so that the obtained data can be processed reasonably.
[0103] In order to facilitate users to view and understand the amount of computing resources scheduled by the server for different user services at any time, in implementation, as a preferred implementation method, after outputting the amount of computing resources scheduled by the server through the reinforcement learning model, it also includes:
[0104] Record the current user service and the computing resource scheduling amount of the server at the current moment.
[0105] There is no limitation on the recording method, recording location, recording frequency, etc. You may choose according to the actual situation.
[0106] This embodiment provides that after outputting the computing resource scheduling amount of the server through the reinforcement learning model, it records the user service at the current moment and the computing resource scheduling amount of the server at the current moment, so that the user can check and understand the computing resource scheduling amount of the server for different user services at any time according to the recorded content.
[0107] In the above embodiments, the method for scheduling server computing resources is described in detail, and the present application also provides an embodiment corresponding to the device for scheduling server computing resources. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.
[0108] Figure 3 A structural diagram of an apparatus for scheduling server computing resources provided in an embodiment of the present application. This embodiment is based on the perspective of functional modules and includes:
[0109] A first acquisition module 10 is used to acquire a first computing resource amount allocated by the server for the user service at the current moment and a second computing resource amount allocated by the server for the user service at a moment next to the current moment;
[0110] A second acquisition module 11 is used to acquire a first difference between the second computing resource amount and the first computing resource amount;
[0111] An input module 12, used to input the first difference and the first computing resource amount allocated by the server for the user service at the current moment into a pre-established reinforcement learning model;
[0112] An output module 13, used to output the computing resource scheduling amount of the server through the reinforcement learning model;
[0113] The scheduling module 14 is used to schedule the computing resources of the server according to the computing resource scheduling amount of the server.
[0114] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0115] The device for scheduling server computing resources provided in this embodiment reasonably schedules the computing of the server through the first acquisition module, the second acquisition module, the input module, the output module and the scheduling module. Compared with the server allocating fixed computing resources for user services, the device of this embodiment calculates the computing resource scheduling amount of the server through the reinforcement learning model, and then allocates computing resources to the user service according to the computing resource scheduling amount of the server, so that the computing resources allocated by the server to the user service are maximized as much as possible, optimize the computing efficiency of the user service to a certain extent, and improve the computing resource utilization rate of the server.
[0116] Figure 4 This is a structural diagram of an apparatus for scheduling server computing resources provided by another embodiment of the present application. This embodiment is based on the hardware perspective, such as Figure 4 As shown, the device for scheduling server computing resources includes:
[0117] A memory 20, for storing computer programs;
[0118] The processor 21 is used to implement the steps of the method for scheduling server computing resources mentioned in the above embodiment when executing a computer program.
[0119] The device for scheduling server computing resources provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0120] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0121] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the method for scheduling server computing resources disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the method for scheduling server computing resources mentioned above.
[0122] In some embodiments, the device for scheduling server computing resources may also include a display screen 22 , an input and output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0123] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the apparatus for scheduling server computing resources, and may include more or fewer components than shown in the figure.
[0124] The device for scheduling server computing resources provided in an embodiment of the present application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a method for scheduling server computing resources, with the same effect as above.
[0125] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0126] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0127] The computer-readable storage medium provided in the present application includes the above-mentioned method for scheduling server computing resources, and the effect is the same as above.
[0128] In order to enable those skilled in the art to better understand the technical solution of the present application, Figure 5 And attached Figure 6 Further details of the above application are given. Figure 5 The overall flow chart of scheduling server computing resources provided by the embodiment of the present application. The process includes:
[0129] S15: Collect user service information and server computing resource information;
[0130] S16: Transpose the acquired information into a two-dimensional numerical vector, where the vector includes a state vector S, an action vector A, and a benefit vector Q;
[0131] S17: Build a reinforcement learning model;
[0132] S18: Train the Q-Learning algorithm model for N iterations;
[0133] S19: Predict the action that will get the maximum benefit;
[0134] S20: Scheduling computing resources of the server according to the predicted actions.
[0135] Figure 6 A specific flowchart for training the Q-Learning algorithm model and performing N iterations, step S18 specifically includes:
[0136] S181: Record calculation parameters through RNN structure;
[0137] S182: Calculate Q' according to the state vector S and the action vector A;
[0138] S183: Calculate the error between Q and Q';
[0139] S184: Adjust the training gradient according to the error, update the parameters, and return to step S181.
[0140] The overall method for scheduling server computing resources provided in this embodiment monitors the computing resource scheduling of the user services and servers of the cloud platform, collects data sets and transposes them into operable values according to certain rules, builds a reinforcement learning model based on the Q-Learning algorithm combined with RNN, imports data for analysis and training, and finally obtains a relationship model of "computing resource scheduling-resource utilization and computing performance benefits". The scheduling action that can obtain the maximum benefit is inferred based on the reinforcement learning model, and based on this, the computing resources of the server are dynamically scheduled, so that the computing resources allocated to the service by the server are maximized, the computing efficiency of the user service is optimized to a certain extent, and the computing resource utilization of the server is improved.
[0141] The method, device and medium for scheduling server computing resources provided by the present application are introduced in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0142] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for scheduling server computing resources, characterized in that: include: Acquire a first computing resource amount allocated by the server for the user service at the current moment and a second computing resource amount allocated by the server for the user service at a moment next to the current moment; Obtaining a first difference between the second computing resource amount and the first computing resource amount; Inputting the first difference and the first amount of computing resources allocated by the server to the user service at the current moment into a pre-established reinforcement learning model; Outputting the computing resource scheduling amount of the server through the reinforcement learning model; Scheduling computing resources of the server according to the scheduling amount of computing resources of the server; Establishing the reinforcement learning model includes: Obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment; Respectively obtaining a second difference between the first computing resource amounts allocated to the user service at two adjacent moments; Obtaining the actual utilization rate of the computing resources of the server at each said moment according to the first computing resource amount allocated by the server to the user service at each said moment and the computing resource amount actually used by the user service at each said moment; Obtaining an actual computing resource scheduling amount according to an actual utilization rate of computing resources of the server at each of the times and a computing rate corresponding to the computing resource amount actually used by the user service at each of the times; Using the second difference and the first computing resource amount allocated by the server to the user service at each time as inputs of the reinforcement learning model and calculating a theoretical computing resource scheduling amount; Obtaining a third difference between the actual computing resource scheduling amount and the theoretical computing resource scheduling amount; Adjusting the training gradient of the reinforcement learning model according to the third difference, and updating the computing parameters used to characterize the reinforcement learning model, until the theoretical computing resource scheduling amount and the actual resource scheduling amount meet the preset requirements, thus completing the construction of the reinforcement learning model; The reinforcement learning model is a Q-Learning algorithm model, and the updating of the calculation parameters used to characterize the reinforcement learning model includes: Adding RNN structure to the Q-Learning algorithm model; Recording each of the calculation parameters before updating the current calculation parameters through the RNN structure; Determine whether the current calculation parameters have gradient explosion; If yes, then determining updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure; If not, the current calculation parameters are used as updated calculation parameters for characterizing the reinforcement learning model.
2. The method for scheduling server computing resources according to claim 1, characterized in that: The step of determining updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure includes: Obtaining the average value of each of the previous calculation parameters recorded by the RNN structure; The average value is used as an updated calculation parameter for characterizing the reinforcement learning model.
3. The method for scheduling server computing resources according to claim 1, characterized in that: After acquiring the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment, the method further includes: The first amount of computing resources and the amount of computing resources actually used by the user service at each time are converted into data in a unified format according to preset rules.
4. The method for scheduling server computing resources according to claim 3, characterized in that: The preset rule is a rule determined according to the user service and the type of information included in the user service.
5. The method for scheduling server computing resources according to any one of claims 1 to 4, characterized in that: After outputting the computing resource scheduling amount of the server through the reinforcement learning model, the method further includes: Record the user service at the current moment and the computing resource scheduling amount of the server at the current moment.
6. A device for scheduling server computing resources, characterized in that: include: A first acquisition module, used to acquire a first computing resource amount allocated by the server for the user service at the current moment and a second computing resource amount allocated by the server for the user service at a moment next to the current moment; A second acquisition module, used to acquire a first difference between the second computing resource amount and the first computing resource amount; An input module, used for inputting the first difference and the first computing resource amount allocated by the server to the user service at the current moment into a pre-established reinforcement learning model; An output module, used to output the computing resource scheduling amount of the server through the reinforcement learning model; A scheduling module, used for scheduling the computing resources of the server according to the scheduling amount of the computing resources of the server; Establishing the reinforcement learning model includes: Obtaining the first computing resource amount allocated by the server to the user service at each moment, the computing resource amount actually used by the user service at each moment, and the computing rate corresponding to the computing resource amount actually used by the user service at each moment; Respectively obtaining a second difference between the first computing resource amounts allocated to the user service at two adjacent moments; Obtaining the actual utilization rate of the computing resources of the server at each said moment according to the first computing resource amount allocated by the server to the user service at each said moment and the computing resource amount actually used by the user service at each said moment; Obtaining an actual computing resource scheduling amount according to an actual utilization rate of computing resources of the server at each of the times and a computing rate corresponding to the computing resource amount actually used by the user service at each of the times; Using the second difference and the first computing resource amount allocated by the server to the user service at each time as inputs of the reinforcement learning model and calculating a theoretical computing resource scheduling amount; Obtaining a third difference between the actual computing resource scheduling amount and the theoretical computing resource scheduling amount; Adjusting the training gradient of the reinforcement learning model according to the third difference, and updating the computing parameters used to characterize the reinforcement learning model, until the theoretical computing resource scheduling amount and the actual resource scheduling amount meet the preset requirements, thus completing the construction of the reinforcement learning model; The reinforcement learning model is a Q-Learning algorithm model, and the updating of the calculation parameters used to characterize the reinforcement learning model includes: Adding RNN structure to the Q-Learning algorithm model; Recording each of the calculation parameters before updating the current calculation parameters through the RNN structure; Determine whether the current calculation parameters have gradient explosion; If yes, then determining updated calculation parameters for characterizing the reinforcement learning model according to the previous calculation parameters recorded by the RNN structure; If not, the current calculation parameters are used as updated calculation parameters for characterizing the reinforcement learning model.
7. A device for scheduling server computing resources, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for scheduling server computing resources as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for scheduling server computing resources as described in any one of claims 1 to 5 are implemented.
