Resource Allocation Method, Model Training Method, Device, and Electronic Device

By entering the region, time period, required resource capacity and available resource capacity of the service deployment in the target model, the target resource allocation strategy is generated, and the problem of single resource allocation method and low resource utilization in the existing technology is solved, and flexible and real-time resource allocation and automated management are achieved.

CN113220452BActive Publication Date: 2025-05-27BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110507565.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-10
Publication Date
2025-05-27
Estimated Expiration
2041-05-10

AI Technical Summary

Technical Problem

The resource allocation method in the prior art is relatively single, not flexible enough, and has a low resource utilization rate, making it difficult to meet the service resource needs in different regions and time periods.

Method used

By obtaining the region and time period of the service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period, and entering this information into the target model, the target model allocates resources for the service. This method combines region, time period, required resource capacity and available resource capacity to generate target resource allocation strategies to achieve dynamic and real-time allocation of resources.

Benefits of technology

It improves the flexibility and real-time resource allocation, realizes automatic resource allocation of services, saves labor costs, and improves resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113220452B_ABST
    Figure CN113220452B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a resource allocation method, a model training method, an apparatus, and an electronic device, relating to the field of artificial intelligence technologies, and particularly to the fields of cloud computing and deep learning technologies. The specific implementation solution is as follows: obtaining the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period; inputting the region, time period, required resource capacity, and available resource capacity into a target model, and allocating resources for the service by the target model. Thus, the region, time period, required resource capacity, and available resource capacity of service deployment can be input into the target model, and the target model can allocate resources for the service, comprehensively considering the influence of the region, time period, required resource capacity, and available resource capacity on resource allocation, improving the flexibility and real-time performance of resource allocation, and the target model can allocate resources for the service, realizing automatic resource allocation for the service and saving labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and in particular, to a resource allocation method, a model training method, an apparatus, an electronic device, a storage medium, and a computer program product. Background Art

[0002] Currently, with the development of network technologies, there are many types of network services, such as shopping, ordering food, chatting and making friends, reading, etc., which enrich people's lives. Most of the existing resource allocation methods allocate resources according to the maximum resource capacity required by the service. The resource allocation methods are relatively single, not flexible enough, and the resource utilization rate is low. Summary of the Invention

[0003] A resource allocation method, a model training method, an apparatus, an electronic device, a storage medium, and a computer program product are provided.

[0004] According to a first aspect, a resource allocation method is provided, including: obtaining the region and time period where the service is deployed, the required resource capacity of the service in each time period, and the available resource capacity in each time period; inputting the region, the time period, the required resource capacity, and the available resource capacity into a target model, and the target model allocates resources for the service.

[0005] According to a second aspect, a model training method is provided, including: obtaining the deployment region and deployment time period of a sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation strategy of the sample service; training the model according to the deployment region, the deployment time period, the sample required resource capacity, the sample available resource capacity, and the reference resource allocation strategy until a model training end condition is reached, and generating a target model.

[0006] According to a third aspect, a resource allocation apparatus is provided, including: an obtaining module, configured to obtain the region and time period where the service is deployed, the required resource capacity of the service in each time period, and the available resource capacity in each time period; an allocation module, configured to input the region, the time period, the required resource capacity, and the available resource capacity into a target model, and the target model allocates resources for the service.

[0007] According to a fourth aspect, a model training device is provided. An acquisition module is configured to acquire the deployment region and deployment time period of a sample service, the resource capacity required for samples in each deployment time period of the sample service, the available resource capacity for samples in each deployment time period, and a reference resource allocation policy of the sample service. A training module is configured to train the model according to the deployment region, deployment time period, the resource capacity required for samples, the available resource capacity for samples, and the reference resource allocation policy until a model training end condition is reached, and generate a target model.

[0008] According to a fifth aspect, an electronic device is provided, including: 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 when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the resource allocation method described in the first aspect of the present disclosure, or execute the model training method described in the second aspect of the present disclosure.

[0009] According to a sixth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, and the computer instructions are used to cause the computer to execute the resource allocation method described in the first aspect of the present disclosure, or execute the model training method described in the second aspect of the present disclosure.

[0010] According to a seventh aspect, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the resource allocation method described in the first aspect of the present disclosure is implemented, or the model training method described in the second aspect of the present disclosure is executed.

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

[0012] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0013] Figure 1 is a flowchart of the resource allocation method according to the first embodiment of the present disclosure;

[0014] Figure 2 is a flowchart of the process of the target model allocating resources in the resource allocation method according to the second embodiment of the present disclosure;

[0015] Figure 3 is a flowchart of the process of generating a target resource allocation policy in the resource allocation method according to the third embodiment of the present disclosure;

[0016] Figure 4 It is a schematic flow chart after allocating resources for a service according to the target resource capacity allocated within a time period in the resource allocation method according to the fourth embodiment of the present disclosure;

[0017] Figure 5 It is a schematic flow chart of the model training method according to the first embodiment of the present disclosure;

[0018] Figure 6 It is a schematic flow chart of training a model in the model training method according to the second embodiment of the present disclosure;

[0019] Figure 7 It is a block diagram of the resource allocation device according to the first embodiment of the present disclosure;

[0020] Figure 8 It is a block diagram of the model training device according to the first embodiment of the present disclosure;

[0021] Figure 9 It is a block diagram of an electronic device for implementing the resource allocation method and / or the model training method of the embodiments of the present disclosure. Detailed implementation manners

[0022] The following makes an explanation of the exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to help understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted below.

[0023] AI (Artificial Intelligence) is a technical science that studies, develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. Currently, AI technology has the advantages of high automation, high precision and low cost, and has been widely applied.

[0024] Cloud Computing is a type of distributed computing. It can decompose a data computing and processing program into countless small programs, and process and analyze these small programs through a system composed of multiple servers to obtain results and return them to users. It has strong scalability and demand, enabling users to obtain unlimited resources through the network, and the resources obtained are not restricted by time and space.

[0025] DL (Deep Learning) is a new research direction in the field of ML (Machine Learning). It is about learning the internal laws and representation levels of sample data, enabling machines to have the ability to analyze and learn like humans, and being a science that can recognize data such as text, images, and sounds, widely applied in speech and image recognition.

[0026] Figure 1 It is a schematic flowchart of the resource allocation method according to the first embodiment of the present disclosure.

[0027] As Figure 1 shown, the resource allocation method of the first embodiment of the present disclosure includes:

[0028] S101, obtaining the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period.

[0029] It should be noted that the execution subject of the resource allocation method in the embodiments of the present disclosure can be a hardware device with data information processing capabilities and / or the necessary software for driving the hardware device to work. Optionally, the execution subject may include workstations, servers, computers, user terminals, and other intelligent devices. Among them, user terminals include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, intelligent home appliances, vehicle-mounted terminals, etc.

[0030] In the embodiments of the present disclosure, the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period can be obtained.

[0031] Among them, the number of regions where the same service is deployed can be one or more.

[0032] Among them, the number of time periods for the same service deployment can be one or more. The time periods for service deployment include the time periods of the service in each region. It can be understood that the time periods for the same service deployed in different regions may be different. For example, the time period for service C deployed in region A is 11:00 - 13:00, and the time period for service C deployed in region B is 9:00 - 11:00.

[0033] Among them, the required resource capacity of the service in each time period includes the required resource capacity of the service in each time period in each region.

[0034] It can be understood that since users in different regions are in different time zones, and the demand for services by users is affected by the time zone. For example, at the same time, it is daytime in region A and nighttime in region B, then the required resource capacity of the same service in the same time period in different regions may be different.

[0035] It can be understood that since the user's demand for services is also affected by time. For example, the user has a greater demand for the services of the takeaway APP during the dining period (such as 11:00 - 13:00), and a smaller demand for the services of the takeaway APP (Application) during the non-dining period (such as 9:00 - 11:00). Then the required resource capacity of the same service in different time periods in the same region may be different.

[0036] Among them, the available resource capacity of the service in each time period includes the available resource capacity of the service in each region in each time period.

[0037] It can be understood that due to factors such as the possible differences in the available resource capacity deployed in different regions, the available resource capacity of the same service in the same time period in different regions may be different.

[0038] It can be understood that due to factors such as the possible differences in the resource usage of the same region at different times, the available resource capacity of the same service in different time periods in the same region may be different.

[0039] In one implementation, the number of services can be one or more, and different services can correspond to different deployed regions, time periods, required resource capacities, and available resource capacities.

[0040] It should be noted that in the embodiments of the present disclosure, the types of services and resources are not limited. For example, services include but are not limited to chat APPs, takeaway APPs, and shopping web pages, and resources include but are not limited to CPUs (Central Processing Units), memories, and disks.

[0041] S102. Input the region, time period, required resource capacity, and available resource capacity into the target model, and the target model allocates resources for the service.

[0042] In the embodiments of the present disclosure, the region, time period, required resource capacity, and available resource capacity can be input into the target model, and the target model allocates resources for the service. That is to say, the target model can allocate resources for the service according to the region, time period, required resource capacity, and available resource capacity.

[0043] In one implementation, the target model can be set according to the actual situation.

[0044] In summary, according to the resource allocation method of the embodiments of the present disclosure, the region, time period, required resource capacity, and available resource capacity for service deployment can be input into the target model, and the target model allocates resources for the service. Thus, the impacts of region, time period, required resource capacity, and available resource capacity on resource allocation can be comprehensively considered, improving the flexibility and real-time performance of resource allocation. Moreover, since the target model allocates resources for the service, automatic resource allocation for the service can be achieved, saving labor costs.

[0045] Based on any of the above embodiments, as Figure 2 shown, the step S102 of the target model allocating resources for the service includes:

[0046] S201, generating a target resource allocation policy according to the region, time period, required resource capacity, and available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in each region and each time period.

[0047] In the embodiments of the present disclosure, a target resource allocation policy can be generated according to the region, time period, required resource capacity, and available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in each region and each time period.

[0048] In one implementation, a target resource allocation policy can be generated according to the region, time period, required resource capacity, and available resource capacity, with the minimum total resource capacity allocated in each time period as a constraint condition.

[0049] For example, assume that services A, B, and C are deployed in the same region and time period, the time period includes 9:00 - 11:00, and the maximum required resource capacities of services A, B, and C in all deployed time periods are 4, 4, and 5 CPUs respectively, and the required resource capacities of services A, B, and C in the time period 9:00 - 11:00 are 4, 3, and 3 CPUs respectively.

[0050] In the related art, resource allocation is performed according to the maximum total allocated resource capacity of services A, B, and C in all deployed time periods. The maximum total allocated resource capacity in all time periods is 13 CPUs. Then, resource allocation can be performed according to a total allocated resource capacity of 13 CPUs in all time periods, and the resource capacities allocated to services A, B, and C in all time periods are 4, 4, and 5 CPUs respectively.

[0051] In the embodiments of the present disclosure, the target resource allocation policy of the service is generated with the minimum total capacity of the allocated resources in each time period as the constraint condition. That is, with the minimum total capacity of the allocated resources in the time period from 9:00 to 11:00 as the constraint condition, if the minimum total capacity of the allocated resources in the time period from 9:00 to 11:00 is 10 CPUs, then the target resource allocation policy of the service can be generated with the total capacity of the allocated resources in the time period from 9:00 to 11:00 being 10 CPUs as the constraint condition. That is, in the time period from 9:00 to 11:00, the resource capacities allocated to Service A, Service B, and Service C are 4, 3, and 3 CPUs respectively. Thus, the resource capacity allocated to the service in the time period from 9:00 to 11:00 by this method can meet the resource requirements of the service, and compared with the prior art, the total capacity of the resources allocated to the service in the time period from 9:00 to 11:00 is smaller, which helps to save resources.

[0052] S202. In response to the current time reaching the time period, allocate resources to the service according to the target resource capacity allocated in the time period.

[0053] In the embodiments of the present disclosure, in response to the current time reaching the time period, resources can be allocated to the service according to the target resource capacity allocated in the time period, and dynamic allocation and real-time allocation of resources can be achieved.

[0054] For example, the target resource allocation policies of Service A and Service B can be generated respectively. The target resource allocation policy of Service A includes the target resource capacity of Service A in the time period from 9:00 to 11:00 in each region, and the target resource allocation policy of Service B includes the target resource capacity of Service B in the time period from 9:00 to 11:00 in each region. If the current time is 9:00, then in response to the current time reaching the time period from 9:00 to 11:00, resources can be allocated to Service A according to the target resource capacity of Service A in the time period from 9:00 to 11:00 in each region, and resources can be allocated to Service B according to the target resource capacity of Service B in the time period from 9:00 to 11:00 in each region.

[0055] Thus, this method can generate the target resource allocation policy according to the region, time period, required resource capacity, and available resource capacity, and in response to the current time reaching the time period, allocate resources to the service according to the target resource capacity allocated in the time period, and dynamic allocation and real-time allocation of resources can be achieved.

[0056] Based on any of the above embodiments, as Figure 3 shown, in step S201, generating the target resource allocation policy according to the region, time period, required resource capacity, and available resource capacity includes:

[0057] S301. Screen out a first region and a second region from regions according to the required resource capacity and the available resource capacity, where the second region is used to compensate the first region for resources.

[0058] In an embodiment of the present disclosure, a first region and a second region can be screened out from regions according to the required resource capacity and the available resource capacity, where the second region is used to compensate the first region for resources. Here, the number of second regions can be one or more, and no excessive limitation is made here.

[0059] In one implementation, screening out a first region and a second region from regions according to the required resource capacity and the available resource capacity includes obtaining a region whose available resource capacity is less than the required resource capacity as the first region. It can be understood that if the available resource capacity of the first region is less than the required resource capacity, it indicates that the available resource capacity of the first region cannot meet the resource requirements of the service at this time. In related technologies, generally, the available resource capacity of the first region is expanded to meet the resource requirements of the service, which requires consuming a large amount of regional resources. In an embodiment of the present disclosure, a second region can also be screened out to compensate the first region for resources, that is, there is no need to expand the available resource capacity of the first region, which helps to save regional resources and can also achieve cross-regional resource allocation with high resource utilization.

[0060] In one implementation, screening out a first region and a second region from regions according to the required resource capacity and the available resource capacity includes obtaining the candidate available resource capacity of at least one candidate region, and screening out the second region from the candidate regions according to the difference between the available resource capacity and the required resource capacity corresponding to the first region, and the candidate available resource capacity of the candidate region.

[0061] It can be understood that the difference between the available resource capacity and the required resource capacity corresponding to the first region is the capacity to be compensated for the first region. For example, if the available resource capacity corresponding to the first region is 5 CPUs and the required resource capacity is 8 CPUs, then the capacity to be compensated for the first region is 3 CPUs.

[0062] In one implementation, a candidate region whose candidate available resource capacity is greater than or equal to the above difference can be obtained as the second region. At this time, the number of determined second regions is 1. For example, the difference between the available resource capacity and the required resource capacity corresponding to the first region is 3 CPUs. The candidate regions include candidate region A, candidate region B, and candidate region C, and the candidate available resource capacities of candidate region A, candidate region B, and candidate region C are 5 CPUs, 2 CPUs, and 1 CPU respectively. Then, candidate region A can be used as the second region.

[0063] In one embodiment, multiple candidate regions whose sum of candidate available resource capacities is greater than or equal to the above difference can be obtained as the second regions. At this time, the number of determined second regions is multiple. For example, the difference between the available resource capacity and the required resource capacity corresponding to the first region is 3 CPUs. The candidate regions include candidate region A, candidate region B, and candidate region C. The candidate available resource capacities of candidate region A, candidate region B, and candidate region C are 1 CPU, 1 CPU, and 2 CPUs respectively. Then, candidate region A and candidate region C can be used as the second regions, or candidate region B and candidate region C can be used as the second regions.

[0064] Thus, the method can obtain the region where the available resource capacity is less than the required resource capacity as the first region, and can also screen out the second region from the regions according to the difference between the available resource capacity and the required resource capacity of the first region, and the candidate available resource capacity of the candidate region.

[0065] S302. Generate a target resource allocation policy according to the first region, the second region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service within the time period of the first region and the second region.

[0066] For example, the regions where service C is deployed include the first region A and the second region B. The available resource capacity and the required resource capacity of service C within the time period from 9:00 to 11:00 in the first region A are 5 CPUs and 10 CPUs respectively, and the available resource capacity of service C within the time period from 9:00 to 11:00 in the second region B is 10 CPUs. Then, according to the first region A, the time period from 9:00 to 11:00, the second region B, the required resource capacity of 10 CPUs corresponding to the first region, the available resource capacity of 5 CPUs corresponding to the first region, and the available resource capacity of 10 CPUs corresponding to the second region, the target resource capacity of service C within the time period from 9:00 to 11:00 in the first region A and the second region B can be generated. For example, the generated target resource capacity of service C within the time period from 9:00 to 11:00 in the first region A and the second region B is 5 CPUs.

[0067] Thus, the method can screen out the first region and the second region from the regions according to the required resource capacity and the available resource capacity. The second region is used to compensate the resources of the first region, and generate a target resource allocation policy, which helps to save regional resources, and can also realize cross-regional resource allocation with high resource utilization rate.

[0068] Based on any of the above embodiments, as Figure 4 shown, after allocating resources to the service according to the target resource capacity allocated within the time period in step S202, it includes:

[0069] S401. Obtain the increasing speed of the required resource capacity corresponding to each service.

[0070] In an embodiment of the present disclosure, the increasing speed of the required resource capacity corresponding to each service can be obtained. It can be understood that different services may correspond to different increasing speeds.

[0071] In one implementation, the required resource capacity corresponding to each service can be obtained periodically, and the difference between the required resource capacity corresponding to any service in the current period and the previous period can be obtained, and the increasing speed of the required resource capacity corresponding to any service can be obtained according to the above difference and the acquisition period.

[0072] S402. Identify the first service whose increasing speed is greater than the first preset threshold.

[0073] In an embodiment of the present disclosure, the first service whose increasing speed is greater than the first preset threshold can be identified, that is, the first service with an overly fast increasing speed of the required resource capacity can be obtained from the services. Among them, the first preset threshold can be set according to the actual situation.

[0074] S403. Obtain the second service corresponding to the minimum required resource capacity, the second resource capacity allocated to the second service, and the first resource capacity allocated to the first service.

[0075] In an embodiment of the present disclosure, the second service corresponding to the minimum required resource capacity, the second resource capacity allocated to the second service, and the first resource capacity allocated to the first service can be obtained.

[0076] In one implementation, based on the target resource allocation strategy, a mapping relationship or mapping table between the service and the allocated target resource capacity can be established, and the mapping relationship or mapping table can be queried to obtain the allocated target resource capacity corresponding to any service.

[0077] S404. Stop allocating resources to the second service according to the second resource capacity, and allocate resources to the first service according to the sum of the first resource capacity and the second resource capacity.

[0078] In an embodiment of the present disclosure, after identifying the first service whose increasing speed is greater than the first preset threshold, resources can be stopped from being allocated to the second service according to the second resource capacity, and resources can be allocated to the first service according to the sum of the first resource capacity and the second resource capacity, which can meet the resource requirements of the first service with an overly fast increasing speed of the required resource capacity, and there is no need to expand the regional resource capacity, which is easy to implement.

[0079] Based on any of the above embodiments, the target model is a GAN (Generative Adversarial Network) model.

[0080] Based on any of the above embodiments, the target model is a model trained according to the model training method of the embodiments of the present disclosure.

[0081] Figure 5 It is a schematic flowchart of the model training method according to the first embodiment of the present disclosure.

[0082] As Figure 5 shown, the model training method of the first embodiment of the present disclosure includes:

[0083] S501, obtain the deployment region and deployment time period of the sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation policy of the sample service.

[0084] It should be noted that the execution subject of the model training method of the embodiments of the present disclosure can be a hardware device with data information processing capabilities and / or the necessary software for driving the hardware device to work. Optionally, the execution subject may include workstations, servers, computers, user terminals, and other intelligent devices. Among them, the user terminal includes but is not limited to mobile phones, computers, intelligent voice interaction devices, intelligent home appliances, vehicle terminals, etc.

[0085] In the embodiments of the present disclosure, the deployment region and deployment time period of the sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation policy of the sample service can be obtained.

[0086] In one implementation, the reference resource allocation policy of the sample service is a resource allocation policy manually calibrated based on the deployment region, deployment time period, sample required resource capacity, and sample available resource capacity of the sample service, with the minimum total resource capacity allocated in each time period as a constraint condition.

[0087] In one implementation, the reference resource allocation policy includes the reference resource capacity of the sample service in each time period of each region.

[0088] S502, train the model according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, and reference resource allocation policy until the model training end condition is reached, and generate a target model.

[0089] In the embodiments of the present disclosure, the model can be trained according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, and reference resource allocation policy until the model training end condition is reached, and a target model is generated.

[0090] In one embodiment, the deployment region, deployment time period, sample required resource capacity, and sample available resource capacity can be input into the model. The model generates a predicted resource allocation strategy, and based on the predicted resource allocation strategy and the reference resource allocation strategy, the model parameters can be updated to train the model until the model training end condition is reached. The model obtained from the last training is used as the target model.

[0091] In one embodiment, the model training end condition can be set according to the actual situation. For example, the model accuracy reaches a preset accuracy threshold, or the number of model training times reaches a preset number threshold.

[0092] In summary, according to the model training method of the present disclosure embodiment, the model can be trained according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, and reference resource allocation strategy of the sample service until the model training end condition is reached to generate a target model.

[0093] Based on any of the above embodiments, as Figure 6 shown, training the model according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, and reference resource allocation strategy in step S502 includes:

[0094] S601, input the deployment region, deployment time period, sample required resource capacity, and sample available resource capacity into the model, and the model generates a predicted resource allocation strategy.

[0095] In the embodiments of the present disclosure, the deployment region, deployment time period, sample required resource capacity, and sample available resource capacity can be input into the model, and the model generates a predicted resource allocation strategy.

[0096] In one embodiment, the predicted resource allocation strategy includes the predicted resource capacity of the sample service in each deployment time period of each deployment region.

[0097] S602, the model obtains the authenticity parameter of the predicted resource allocation strategy according to the predicted resource allocation strategy and the reference resource allocation strategy.

[0098] In the embodiments of the present disclosure, the model obtains the authenticity parameter of the predicted resource allocation strategy according to the predicted resource allocation strategy and the reference resource allocation strategy. Among them, the authenticity parameter is used to characterize the authenticity of the predicted resource allocation strategy. For example, the value range of the authenticity parameter is 0 to 1, and the larger the authenticity parameter, the higher the authenticity of the predicted resource allocation strategy.

[0099] In one implementation, according to the predicted resource allocation strategy and the reference resource allocation strategy, obtaining the authenticity parameter of the predicted resource allocation strategy may include obtaining the similarity between the predicted resource allocation strategy and the preset reference resource allocation strategy, and obtaining the authenticity parameter of the predicted resource allocation strategy according to the similarity.

[0100] S603, in response to the authenticity parameter being less than the second preset threshold, training the model according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, predicted resource allocation strategy, and reference resource allocation strategy.

[0101] In an embodiment of the present disclosure, in response to the authenticity parameter being less than the second preset threshold, indicating that the authenticity parameter of the predicted resource allocation strategy is small, the model may be trained according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, predicted resource allocation strategy, and reference resource allocation strategy.

[0102] Among them, the second preset threshold can be set according to the actual situation.

[0103] Thus, the method can train the model according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, predicted resource allocation strategy, and reference resource allocation strategy when the authenticity parameter of the predicted resource allocation strategy is less than the second preset threshold.

[0104] Based on any of the above embodiments, the model is a GAN (Generative Adversarial Network) model.

[0105] In one implementation, the GAN model includes a policy generation layer and a policy discrimination layer. The deployment region, deployment time period, sample required resource capacity, and sample available resource capacity can be input into the policy generation layer in the GAN model. The policy generation layer generates a predicted resource allocation strategy, and the policy discrimination layer obtains the authenticity parameter of the predicted resource allocation strategy according to the predicted resource allocation strategy and the reference resource allocation strategy. In response to the authenticity parameter being less than the second preset threshold, the model is trained according to the deployment region, deployment time period, sample required resource capacity, sample available resource capacity, predicted resource allocation strategy, and reference resource allocation strategy.

[0106] In one implementation, the policy generation layer and the policy discrimination layer are trained separately, that is, when training the policy generation layer, the parameters of the policy discrimination layer are kept unchanged, and when training the policy discrimination layer, the parameters of the policy generation layer are kept unchanged.

[0107] Figure 7 It is a block diagram of a resource allocation device according to the first embodiment of the present disclosure.

[0108] As Figure 7 shown, the resource allocation device 700 according to an embodiment of the present disclosure includes: an acquisition module 701 and an allocation module 702.

[0109] The acquisition module 701 is configured to acquire the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period;

[0110] The allocation module 702 is configured to input the region, the time period, the required resource capacity, and the available resource capacity into a target model, and the target model allocates resources for the service.

[0111] In an embodiment of the present disclosure, the allocation module includes: a generation unit configured to generate a target resource allocation policy according to the region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in each region and each time period; an allocation unit configured to, in response to the current time reaching the time period, allocate resources for the service according to the target resource capacity allocated in the time period.

[0112] In an embodiment of the present disclosure, the generation unit includes: a screening subunit configured to screen out a first region and a second region from the regions according to the required resource capacity and the available resource capacity, where the second region is used to compensate the resources of the first region; a generation subunit configured to generate the target resource allocation policy according to the first region, the second region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in the time periods of the first region and the second region.

[0113] In an embodiment of the present disclosure, the screening subunit is specifically configured to: acquire the region where the available resource capacity is less than the required resource capacity as the first region; acquire the candidate available resource capacity of at least one candidate region; and screen out the second region from the candidate regions according to the difference between the available resource capacity and the required resource capacity corresponding to the first region and the candidate available resource capacity of the candidate region.

[0114] In one embodiment of the present disclosure, the device further includes an adjustment module, which is specifically configured to: obtain the increasing speed of the required resource capacity corresponding to each service; identify the first service whose increasing speed is greater than the first preset threshold; obtain the second service corresponding to the minimum required resource capacity, the second resource capacity allocated to the second service, and the first resource capacity allocated to the first service; stop allocating resources to the second service according to the second resource capacity, and allocate resources to the first service according to the sum of the first resource capacity and the second resource capacity.

[0115] In one embodiment of the present disclosure, the target model is a generative adversarial network (GAN) model.

[0116] In one embodiment of the present disclosure, the target model is a model obtained by the model training device according to the embodiments of the present disclosure.

[0117] In summary, the resource allocation device according to the embodiments of the present disclosure can input the deployment region, time period, required resource capacity, and available resource capacity of the service into the target model, and the target model allocates resources to the service. Thus, the impact of the region, time period, required resource capacity, and available resource capacity on resource allocation can be comprehensively considered, improving the flexibility and real-time performance of resource allocation. Moreover, by allocating resources to the service through the target model, automatic resource allocation of the service can be realized, saving labor costs.

[0118] Figure 8 It is a block diagram of the model training device according to the first embodiment of the present disclosure.

[0119] As Figure 8 shown, the model training device 800 according to the embodiments of the present disclosure includes an acquisition module 801 and a training module 802.

[0120] The acquisition module 801 is configured to obtain the deployment region and deployment time period of the sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation policy of the sample service.

[0121] The training module 802 is configured to train the model according to the deployment region, deployment time period, the sample required resource capacity, the sample available resource capacity, and the reference resource allocation policy until the model training end condition is reached, and generate a target model.

[0122] In one embodiment of the present disclosure, the training module is specifically configured to: input the deployment region, the deployment time period, the resource capacity required by the sample, and the available resource capacity of the sample into the model, and generate a predicted resource allocation strategy by the model; obtain a authenticity parameter of the predicted resource allocation strategy by the model according to the predicted resource allocation strategy and the reference resource allocation strategy; in response to the authenticity parameter being less than a second preset threshold, train the model according to the deployment region, the deployment time period, the resource capacity required by the sample, the available resource capacity of the sample, the predicted resource allocation strategy, and the reference resource allocation strategy.

[0123] In one embodiment of the present disclosure, the model is a generative adversarial network (GAN) model.

[0124] In summary, the model training device described in the embodiments of the present disclosure can train a model according to the deployment region of the sample service, the deployment time period, the resource capacity required by the sample, the available resource capacity of the sample, and the reference resource allocation strategy until the model training end condition is reached, and generate a target model.

[0125] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0126] Figure 9 FIG. shows a schematic block diagram of an exemplary electronic device 900 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0127] As Figure 9 shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0128] Multiple components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disc, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0129] The computing unit 901 can be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 executes the various methods and processes described above, such as Figures 1 to 4 the resource allocation method described above. For example, in some embodiments, the resource allocation method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the resource allocation method described above can be executed. Alternatively, in other embodiments, the computing unit 901 can be configured to execute the resource allocation method in any other suitable way (e.g., by means of firmware).

[0130] The various embodiments of the systems and technologies described above in this article can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, and the programmable processor can be a dedicated or general programmable processor, can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0131] The program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing device, such that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.

[0132] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0133] In order to provide interaction with a user, the systems and techniques described herein may 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 a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0134] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with embodiments of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

[0135] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS" for short). The server can also be a server of a distributed system, or a server combined with a blockchain.

[0136] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, it implements the resource allocation method described in the above embodiments of the present disclosure.

[0137] It should be understood that various forms of the processes shown above can be used, reordering, adding, or deleting steps. For example, the steps recited in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and no limitation is imposed herein.

[0138] The above specific embodiments do not constitute a limitation to the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims

1. A resource allocation method, where the resources allocated by the method include CPU, memory, and disk, including: Obtain the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period; Input the region, the time period, the required resource capacity, and the available resource capacity into a target model, and the target model allocates resources for the service; The training method of the target model includes: Obtain the deployment region and deployment time period of a sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation policy of the sample service; Train the model according to the deployment region, deployment time period, the sample required resource capacity, the sample available resource capacity, and the reference resource allocation policy until the model training end condition is reached, and generate a target model; Among them, the allocating resources for the service by the target model includes: Generate a target resource allocation policy according to the region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in each region and each time period; In response to the current time reaching the time period, allocate resources for the service according to the target resource capacity allocated in the time period.

2. The method according to claim 1, wherein, The generating a target resource allocation policy according to the region, the time period, the required resource capacity, and the available resource capacity includes: Screen out a first region and a second region from the regions according to the required resource capacity and the available resource capacity, where the second region is used to compensate resources for the first region; Generate the target resource allocation policy according to the first region, the second region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in the time period of the first region and the second region.

3. The method according to claim 2, wherein, The screening out a first region and a second region from the regions according to the required resource capacity and the available resource capacity includes: Obtain the region where the available resource capacity is less than the required resource capacity as the first region; Obtain the candidate available resource capacity of at least one candidate region; Screen out the second region from the candidate regions according to the difference between the available resource capacity and the required resource capacity corresponding to the first region and the candidate available resource capacity of the candidate region.

4. The method according to claim 1, wherein, After allocating resources for the service according to the target resource capacity allocated in the time period, it includes: Obtain the increasing speed of the required resource capacity corresponding to each service; Identify the first service whose increasing speed is greater than a first preset threshold; Obtain the second service corresponding to the minimum required resource capacity, the second allocated resource capacity corresponding to the second service, and the first allocated resource capacity corresponding to the first service; Stop allocating resources to the second service according to the second resource capacity, and allocate resources to the first service according to the sum of the first resource capacity and the second resource capacity.

5. The method according to any one of claims 1-4, wherein, The target model is a generative adversarial network (GAN) model.

6. The method according to any one of claims 1-4, wherein, The training of the model according to the deployment region, deployment time period, the required resource capacity of the sample, the available resource capacity of the sample, and the reference resource allocation policy includes: Input the deployment region, deployment time period, the required resource capacity of the sample, and the available resource capacity of the sample into the model, and the model generates a predicted resource allocation policy; The model obtains the authenticity parameter of the predicted resource allocation policy according to the predicted resource allocation policy and the reference resource allocation policy; In response to the authenticity parameter being less than a second preset threshold, train the model according to the deployment region, deployment time period, the required resource capacity of the sample, the available resource capacity of the sample, the predicted resource allocation policy, and the reference resource allocation policy.

7. The method according to any one of claims 1-4, wherein, The model is a generative adversarial network (GAN) model.

8. A resource allocation device, where the resources allocated by the device include CPU, memory, and disk, comprising: An acquisition module, configured to acquire the region and time period of service deployment, the required resource capacity of the service in each time period, and the available resource capacity in each time period; An allocation module, configured to input the region, the time period, the required resource capacity, and the available resource capacity into a target model, and the target model allocates resources for the service, and the target model is trained by a model training device; The model training device includes: An acquisition module, configured to acquire the deployment region and deployment time period of a sample service, the sample required resource capacity of the sample service in each deployment time period, the sample available resource capacity in each deployment time period, and the reference resource allocation policy of the sample service; A training module, configured to train the model according to the deployment region, deployment time period, the required resource capacity of the sample, the available resource capacity of the sample, and the reference resource allocation policy until a model training end condition is reached, and generate a target model; wherein, the allocation module includes: A generation unit, configured to generate a target resource allocation policy according to the region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service in each region and each time period; An allocation unit, configured to, in response to the current time reaching the time period, allocate resources for the service according to the target resource capacity allocated in the time period.

9. The device according to claim 8, wherein, The generating unit includes: A screening subunit, configured to screen out a first region and a second region from the regions according to the required resource capacity and the available resource capacity, where the second region is used to compensate resources for the first region; A generating subunit, configured to generate the target resource allocation policy according to the first region, the second region, the time period, the required resource capacity, and the available resource capacity, where the target resource allocation policy includes the target resource capacity of the service within the time period in the first region and the second region.

10. The apparatus according to claim 9, wherein, The screening subunit is specifically configured to: Obtain the region where the available resource capacity is less than the required resource capacity as the first region; Obtain the candidate available resource capacity of at least one candidate region; Screen out the second region from the candidate regions according to the difference between the available resource capacity and the required resource capacity corresponding to the first region, and the candidate available resource capacity of the candidate region.

11. The apparatus according to claim 8, wherein, The apparatus further includes an adjustment module, and the adjustment module is specifically configured to: Obtain the increasing speed of the required resource capacity corresponding to each service; Identify the first service whose increasing speed is greater than a first preset threshold; Obtain the second service corresponding to the minimum required resource capacity, the second resource capacity allocated to the second service, and the first resource capacity allocated to the first service; Stop allocating resources to the second service according to the second resource capacity, and allocate resources to the first service according to the sum value of the first resource capacity and the second resource capacity.

12. The apparatus according to any one of claims 8-11, wherein, The target model is a generative adversarial network (GAN) model.

13. The apparatus according to any one of claims 8-11, wherein, The training module is specifically configured to: Input the deployment region, the deployment time period, the sample required resource capacity, and the sample available resource capacity into the model, and the model generates a predicted resource allocation policy; The model obtains the authenticity parameter of the predicted resource allocation policy according to the predicted resource allocation policy and the reference resource allocation policy; In response to the authenticity parameter being less than a second preset threshold, train the model according to the deployment region, the deployment time period, the sample required resource capacity, the sample available resource capacity, the predicted resource allocation policy, and the reference resource allocation policy.

14. The apparatus according to any one of claims 8-11, wherein, The model is a generative adversarial network (GAN) model.

15. An electronic device, including: 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 resource allocation method according to any one of claims 1-7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein, the computer instructions are for causing the computer to execute the resource allocation method according to any one of claims 1-7.

17. A computer program product comprising a computer program which, when executed by a processor, implements the resource allocation method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Resource allocation method, device, computer equipment and storage medium

    CN108881495A

  • Resource model training method and device, resource gap prediction method and device and electronic equipment

    CN111275229A

  • Resource allocation method and device, computer device and storage medium

    CN112698943A