Container resource allocation method and device
By generating a task queue and determining the task type, priority and container type, and allocating resources based on preset models, the problem of unreasonable allocation of container resources in cloud computing is solved and resource utilization is improved.
Patent Information
- Application Number
- CN202411121246.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-22
AI Technical Summary
The unreasonable allocation of container resources in the prior art in cloud computing leads to low resource utilization and fails to effectively match task requirements and container resources.
By generating a task queue, determine the task type, priority and container type, allocate resources based on preset models, and improve resource utilization.
The rationality and resource utilization of container resource allocation are improved, ensuring the matching of task requirements with container resources.
Smart Images

Figure CN119003173A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a container resource allocation method and device. Background Art
[0002] With the development of digital economy and the demand for digital transformation, cloud computing and big data technologies are becoming more and more popular. In the cloud computing environment, cloud container technology, as a supporting technology between cloud service providers and cloud service users, is also being used more and more frequently. For example, cloud resources and tasks in cloud services are cloudified using cloud orchestration engines such as Docker, Mesospherre or Kubernetes. In the process of using cloud container technology, it is inevitable to allocate container resources.
[0003] At present, when allocating resources, cloud service providers usually allocate container resources based on a preset container resource allocation plan. This resource allocation method has the defect of unreasonable allocation leading to low resource utilization. At the same time, failure to consider the matching degree between task requirements and container resources will also lead to unreasonable container resource allocation, resulting in low resource utilization. Therefore, how to reasonably allocate container resources to improve resource utilization is still an urgent problem to be solved. Summary of the invention
[0004] The present application provides a container resource allocation method and device to solve the technical problem of low resource utilization caused by unreasonable container allocation in the prior art.
[0005] According to a first aspect of an embodiment of the present application, a container resource allocation method is provided, comprising:
[0006] In response to a task request submitted by a user, a task queue is generated; wherein the task queue is composed of a plurality of tasks;
[0007] Determining, according to the plurality of tasks, a task type of each of the plurality of tasks;
[0008] Determining the priorities of the tasks according to the dependencies between the tasks;
[0009] Determine, based on a preset first prediction model, a container type of each of the plurality of tasks;
[0010] Container resources are allocated to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
[0011] The present application first generates a task queue in response to a user task request, and then determines the task types of multiple tasks, and can select different container allocation methods for different types of tasks; and determines the priorities of multiple tasks according to dependencies, and can improve the rationality of container resource allocation scheduling; at the same time, the container types of multiple tasks are determined based on the first prediction model, and the container types corresponding to different tasks can be determined, thereby improving the matching degree between task requirements and container resources, and then improving the rationality of container allocation when allocating container resources according to task type, priority and container type, thereby improving resource utilization.
[0012] In certain embodiments of the present application, generating a task queue in response to a task request submitted by a user specifically includes:
[0013] In response to a task request submitted by a user, obtaining configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode;
[0014] A task queue is generated according to the configuration data of each of the plurality of tasks.
[0015] This application first obtains the configuration data of multiple tasks according to the user task request, and then generates a task queue according to the configuration data, which can provide a prerequisite for the subsequent determination of the task type, priority and container type, thereby improving the rationality of container allocation.
[0016] In certain implementations of the present application, determining the task type of each of the multiple tasks according to the multiple tasks specifically includes:
[0017] Selecting one task in turn as the current first task, and determining the task type of the current first task according to a preset task type determination method, until the task types of the plurality of tasks are determined;
[0018] The task type determination method includes:
[0019] Calculate the task type score according to the configuration data of the current first task;
[0020] The task type of the current first task is determined according to the task type score and a preset first threshold.
[0021] The present application first selects tasks in sequence as the current first task, then calculates the task type score according to the configuration data of the current first task, and determines the task type according to the task type score and a preset first threshold value. The task type of the current first task can be reasonably determined based on the configuration data, thereby improving the rationality of container resource allocation by task type.
[0022] In certain embodiments of the present application, determining the container type of each of the plurality of tasks based on a preset first prediction model specifically includes:
[0023] Selecting one task in turn as the current second task, and determining the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined;
[0024] Wherein, the container type determination method includes:
[0025] Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task;
[0026] The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
[0027] The present application first selects tasks in sequence as the current second task, then inputs the configuration data of the current second task into the first prediction model to obtain a predicted container and a corresponding predicted probability, and determines the container type according to a preset second threshold value. The container type of the current second task can be reasonably determined based on the configuration data and the first prediction model, thereby improving the rationality of container resource allocation by container type.
[0028] In certain implementations of the present application, determining the priorities of the multiple tasks according to the dependencies of the multiple tasks specifically includes:
[0029] Generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks;
[0030] Determining a total number of priority categories based on the depth of the dependency graph;
[0031] The priorities of the plurality of tasks are determined according to the total number of priority categories and corresponding to the levels of the plurality of tasks in the dependency graph.
[0032] This application first generates a dependency graph based on the dependencies of multiple tasks, and determines the total number of priority categories based on the depth of the dependency graph, and then determines the priority corresponding to the level of the task in the dependency graph. This priority allocation takes into account the dependencies between tasks and can reasonably determine the priority of the task based on the dependencies, thereby improving the rationality of container resource allocation through priority.
[0033] In certain embodiments of the present application, allocating container resources to the multiple tasks according to the task types, container types, and priorities of the multiple tasks specifically includes:
[0034] According to the task types of the multiple tasks, predicting the resource requirements of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements;
[0035] generating a resource allocation decision based on the predicted resource requirements and priorities of each of the plurality of tasks;
[0036] Container resources are allocated to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
[0037] The present application first predicts the resource requirements according to the task types of multiple tasks to obtain multiple predicted resource requirements, and then generates a resource allocation decision according to the multiple predicted resource requirements and priorities. It can reasonably determine the overall resource allocation decision according to the multiple predicted resource requirements and priorities, thereby improving the rationality of container resource allocation when allocating container resources for multiple tasks according to the resource allocation decision and container type.
[0038] According to a second aspect of the implementation of the present application, there is provided a container resource allocation device, including a task queue generation module, a task type determination module, a priority determination module, a container type determination module and a container resource allocation module;
[0039] The task queue generation module is used to generate a task queue in response to a task request submitted by a user; wherein the task queue is composed of a plurality of tasks;
[0040] The task type determination module is used to determine the task type of each of the multiple tasks according to the multiple tasks;
[0041] The priority determination module is used to determine the priority of each of the multiple tasks according to the dependency relationship of the multiple tasks;
[0042] The container type determination module is used to determine the container type of each of the plurality of tasks based on a preset first prediction model;
[0043] The container resource allocation module is used to allocate container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
[0044] In certain embodiments of the present application, the task queue generation module includes a configuration acquisition unit and a queue generation unit;
[0045] The configuration acquisition unit is used to respond to the task request submitted by the user and acquire the configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode;
[0046] The queue generating unit is used to generate a task queue according to the respective configuration data of the plurality of tasks.
[0047] In certain embodiments of the present application, the task type determination module includes a task type determination unit;
[0048] The task type determination unit is used to select one task as the current first task in turn, and determine the task type of the current first task according to a preset task type determination method, until the task types of the plurality of tasks are determined;
[0049] The task type determination method includes:
[0050] Calculate the task type score according to the configuration data of the current first task;
[0051] The task type of the current first task is determined according to the task type score and a preset first threshold.
[0052] In certain embodiments of the present application, the container type determination module includes a container type determination unit;
[0053] The container type determination unit is used to select one task in turn as the current second task, and determine the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined;
[0054] Wherein, the container type determination method includes:
[0055] Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task;
[0056] The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
[0057] In certain embodiments of the present application, the priority determination module includes a relationship graph generation unit, a total number of categories determination unit, and a priority determination unit;
[0058] The relationship graph generating unit is used to generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks;
[0059] The total number of categories determining unit is used to determine the total number of priority categories according to the depth of the dependency graph;
[0060] The priority determination unit is used to determine the respective priorities of the multiple tasks according to the total number of priority categories and corresponding to the levels of the multiple tasks in the dependency graph.
[0061] In certain embodiments of the present application, the container resource allocation module includes a demand prediction unit, a decision generation unit, and a resource allocation unit;
[0062] The demand prediction unit is used to predict the resource requirements of the multiple tasks according to the task types of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements;
[0063] The decision generating unit is used to generate a resource allocation decision according to the predicted resource requirements and priorities of each of the plurality of tasks;
[0064] The resource allocation unit is used to allocate container resources to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
[0065] The present application first generates a task queue in response to a user task request, and then determines the task types of multiple tasks, and can select different container allocation methods for different types of tasks; and determines the priorities of multiple tasks according to dependencies, and can improve the rationality of container resource allocation scheduling; at the same time, the container types of multiple tasks are determined based on the first prediction model, and the container types corresponding to different tasks can be determined, thereby improving the matching degree between task requirements and container resources, and then improving the rationality of container allocation when allocating container resources according to task type, priority and container type, thereby improving resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 : A flowchart of a container resource allocation method shown in certain embodiments of the present application;
[0067] Figure 2 : A module structure diagram of a container resource allocation device shown in certain embodiments of the present application. DETAILED DESCRIPTION
[0068] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below in conjunction with the accompanying drawings are exemplary and are only used to explain some embodiments of the present application, and should not be construed as limitations on the embodiments of the present application. Based on the embodiments shown in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0069] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, unless otherwise clearly and specifically defined, "multiple" and "several" mean two or more.
[0070] The existing method of allocating container resources usually takes the preset container resource allocation plan as the first priority, which has the defect of unreasonable allocation leading to low resource utilization. At the same time, this allocation method does not consider the matching degree between task requirements and container resources, which also leads to low resource utilization. Therefore, the technical problem of unreasonable allocation of containers in the existing technology leading to low resource utilization still needs to be solved.
[0071] Based on the above technical background, please refer to Figure 1 The embodiment of the present application provides a container resource allocation method, including steps S101 to S105, each of which is specifically as follows:
[0072] Step S101: generating a task queue in response to a task request submitted by a user; wherein the task queue is composed of a plurality of tasks.
[0073] In certain embodiments of the present application, generating a task queue in response to a task request submitted by a user specifically includes:
[0074] In response to a task request submitted by a user, obtaining configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode;
[0075] A task queue is generated according to the configuration data of each of the plurality of tasks.
[0076] This application first obtains the configuration data of multiple tasks according to the user task request, and then generates a task queue according to the configuration data, which can provide a prerequisite for the subsequent determination of the task type, priority and container type, thereby improving the rationality of container allocation.
[0077] Step S102: determining the task type of each of the multiple tasks according to the multiple tasks.
[0078] In certain implementations of the present application, determining the task type of each of the multiple tasks according to the multiple tasks specifically includes:
[0079] Selecting one task in turn as the current first task, and determining the task type of the current first task according to a preset task type determination method, until the task types of the plurality of tasks are determined;
[0080] The task type determination method includes:
[0081] Calculate the task type score according to the configuration data of the current first task;
[0082] The task type of the current first task is determined according to the task type score and a preset first threshold.
[0083] In some optional implementations of the present application, the task type score is calculated according to the configuration data of the current first task, specifically:
[0084] Corresponding to the initial resource requirement, execution time, security requirement and data access mode of the current first task, a resource requirement score, a time score, a security requirement score and an access mode score are obtained by searching in a preset task type score dictionary;
[0085] The task type score of the current first task is obtained by weighted calculation according to the resource requirement score, the time score, the security requirement score and the access mode score.
[0086] In some optional implementations of the present application, the preferred scheme for the classification number of the task types is two categories, first-category tasks and second-category tasks.
[0087] In some optional implementations of the present application, determining the task type of the current first task according to the task type score and a preset first threshold value is specifically:
[0088] When the task type score is greater than a preset first threshold, determining the task type of the current first task as a first category task;
[0089] When the task type score is not greater than a preset first threshold, the task type score of the current first task is determined as a second type task.
[0090] The task types of multiple tasks are determined by considering the task type scores calculated by the initial resource requirements, execution time, security requirements and data access patterns of multiple tasks, because there are objective differences among multiple tasks, and these differences will affect the allocation of container resources, including the allocation method and scheduling process. If the task type of the task is not considered and the container resources are allocated, it may lead to insufficient container resources to complete the task, resulting in the need to reschedule the task, reducing the efficiency of task execution, or excessive allocation of container resources, resulting in a large number of unused container resources after the task is completed, resulting in waste of container resources and reduced resource utilization, both of which are not conducive to the execution of tasks after the container resources are allocated. Therefore, by dividing the task type to affect the allocation of container resources, the container resources can be more reasonably matched to the task type of the task.
[0091] The present application first selects tasks in sequence as the current first task, then calculates the task type score according to the configuration data of the current first task, and determines the task type according to the task type score and a preset first threshold value. The task type of the current first task can be reasonably determined based on the configuration data, thereby improving the rationality of container resource allocation by task type.
[0092] Step S103: determining respective priorities of the multiple tasks according to the dependency relationship of the multiple tasks.
[0093] In certain implementations of the present application, determining the priorities of the multiple tasks according to the dependencies of the multiple tasks specifically includes:
[0094] Generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks;
[0095] Determining a total number of priority categories based on the depth of the dependency graph;
[0096] The priorities of the plurality of tasks are determined according to the total number of priority categories and corresponding to the levels of the plurality of tasks in the dependency graph.
[0097] Specifically, based on the generality of the dependency relationship and the progressiveness of the tasks, the dependency relationship graph is a directed acyclic graph.
[0098] The reason why we consider determining the priorities of multiple tasks through dependencies is that there is a sequential execution relationship between tasks. The execution of the second task may depend on the completion of the first task. In this case, the priority of the first task must be higher than that of the second task, and the container resource allocation of the first task must also take precedence over the container resource allocation of the second task. Otherwise, it will cause unreasonable container resource allocation, thereby reducing task execution efficiency and resource utilization.
[0099] This application first generates a dependency graph based on the dependencies of multiple tasks, and determines the total number of priority categories based on the depth of the dependency graph, and then determines the priority corresponding to the level of the task in the dependency graph. This priority allocation takes into account the dependencies between tasks and can reasonably determine the priority of the task based on the dependencies, thereby improving the rationality of container resource allocation through priority.
[0100] Step S104: determining the container type of each of the plurality of tasks based on a preset first prediction model.
[0101] In certain embodiments of the present application, determining the container type of each of the plurality of tasks based on a preset first prediction model specifically includes:
[0102] Selecting one task in turn as the current second task, and determining the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined;
[0103] Wherein, the container type determination method includes:
[0104] Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task;
[0105] The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
[0106] In certain optional embodiments of the present application, the preferred scheme for the classification number of the container types is two categories, first category containers and second category containers; wherein the container validity period of the first category containers is greater than the container validity period of the second category containers.
[0107] In certain optional embodiments of the present application, preferred schemes of the first prediction model include but are not limited to a decision tree model, a random forest model and / or a support vector machine model.
[0108] The reason for considering dividing the container types of multiple tasks through the prediction model is that in addition to the initial resource requirements and execution time of the task, the security requirements and data access patterns of the task will also affect the allocation of container resources. However, the impact of security requirements and data access patterns on container types is difficult to quantify. Therefore, predictive division through the prediction model can improve the rationality and accuracy of container type selection, improve the matching degree between tasks and the selected container types, and then improve the rationality of container resource allocation, thereby improving resource utilization.
[0109] The present application first selects tasks in sequence as the current second task, then inputs the configuration data of the current second task into the first prediction model to obtain a predicted container and a corresponding predicted probability, and determines the container type according to a preset second threshold value. The container type of the current second task can be reasonably determined based on the configuration data and the first prediction model, thereby improving the rationality of container resource allocation by container type.
[0110] Step S105: Allocate container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
[0111] In certain embodiments of the present application, allocating container resources to the multiple tasks according to the task types, container types, and priorities of the multiple tasks specifically includes:
[0112] According to the task types of the multiple tasks, predicting the resource requirements of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements;
[0113] generating a resource allocation decision based on the predicted resource requirements and priorities of each of the plurality of tasks;
[0114] Container resources are allocated to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
[0115] In some optional implementations of the present application, before allocating container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks, the method further includes:
[0116] Based on the clustering idea, the task types and container types of the multiple tasks are classified into two categories to obtain the task request tendencies of users corresponding to the multiple tasks;
[0117] The task request tendency and user information of the users corresponding to the multiple tasks are stored to obtain a user task request tendency table.
[0118] In some optional embodiments of the present application, it also includes:
[0119] If the currently processed user matches the user task request tendency table, the task request tendency of the currently processed user is extracted, and container resources are allocated to the currently processed multiple tasks according to the task type, container type, priority and task request tendency of the currently processed multiple tasks.
[0120] Specifically, allocating container resources to the multiple tasks currently being processed according to the task type, container type, priority, and task request tendency of the multiple tasks currently being processed includes:
[0121] According to the task types and task request tendencies of the multiple tasks currently being processed, resource requirements of the multiple tasks currently being processed are predicted based on a preset second prediction model to obtain multiple predicted resource requirements;
[0122] Generate resource allocation decisions based on the predicted resource requirements and priorities of multiple tasks currently being processed;
[0123] Container resources are allocated to the multiple tasks currently being processed according to the resource allocation decision and the container types of the multiple tasks currently being processed.
[0124] The present application first predicts the resource requirements according to the task types of multiple tasks to obtain multiple predicted resource requirements, and then generates a resource allocation decision according to the multiple predicted resource requirements and priorities. It can reasonably determine the overall resource allocation decision according to the multiple predicted resource requirements and priorities, thereby improving the rationality of container resource allocation when allocating container resources for multiple tasks according to the resource allocation decision and container type.
[0125] Compared with the prior art, the present application first generates a task queue in response to a user task request, and then determines the task types of multiple tasks, and can select different container allocation methods for different types of tasks; and determines the priorities of multiple tasks according to dependencies, which can improve the rationality of container resource allocation scheduling; at the same time, the container types of multiple tasks are determined based on the first prediction model, and the container types corresponding to different tasks can be determined, thereby improving the matching degree between task requirements and container resources, and then improving the rationality of container allocation when allocating container resources according to task type, priority and container type, thereby improving resource utilization.
[0126] Corresponding to the previous method, see Figure 2 , the embodiment of the present application provides a container resource allocation device, including a task queue generation module 210, a task type determination module 220, a priority determination module 230, a container type determination module 240 and a container resource allocation module 250;
[0127] The task queue generation module 210 is used to generate a task queue in response to a task request submitted by a user; wherein the task queue is composed of a plurality of tasks;
[0128] The task type determination module 220 is used to determine the task type of each of the multiple tasks according to the multiple tasks;
[0129] The priority determination module 230 is used to determine the priority of each of the multiple tasks according to the dependency relationship of the multiple tasks;
[0130] The container type determination module 240 is used to determine the container type of each of the plurality of tasks based on a preset first prediction model;
[0131] The container resource allocation module 250 is used to allocate container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
[0132] In certain embodiments of the present application, the task queue generation module 210 includes a configuration acquisition unit 211 and a queue generation unit 212;
[0133] The configuration acquisition unit 211 is used to respond to the task request submitted by the user and acquire the configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode;
[0134] The queue generating unit 212 is configured to generate a task queue according to the respective configuration data of the plurality of tasks.
[0135] In some embodiments of the present application, the task type determination module 220 includes a task type determination unit 221;
[0136] The task type determination unit 221 is used to select one task as the current first task in turn, and determine the task type of the current first task according to a preset task type determination method, until the task types of the multiple tasks are determined;
[0137] The task type determination method includes:
[0138] Calculate the task type score according to the configuration data of the current first task;
[0139] The task type of the current first task is determined according to the task type score and a preset first threshold.
[0140] In certain embodiments of the present application, the container type determination module 240 includes a container type determination unit 241;
[0141] The container type determination unit 241 is used to select one task in turn as the current second task, and determine the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined;
[0142] Wherein, the container type determination method includes:
[0143] Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task;
[0144] The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
[0145] In certain embodiments of the present application, the priority determination module 230 includes a relationship graph generation unit 231, a total number of categories determination unit 232, and a priority determination unit 233;
[0146] The relationship graph generating unit 231 is used to generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks;
[0147] The total number of categories determining unit 232 is used to determine the total number of priority categories according to the depth of the dependency graph;
[0148] The priority determination unit 233 is configured to determine the priorities of the multiple tasks according to the total number of priority categories and corresponding to the levels of the multiple tasks in the dependency graph.
[0149] In certain embodiments of the present application, the container resource allocation module 250 includes a demand prediction unit 251, a decision generation unit 252, and a resource allocation unit 253;
[0150] The demand prediction unit 251 is used to predict the resource requirements of the multiple tasks according to the task types of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements;
[0151] The decision generating unit 252 is used to generate a resource allocation decision according to the predicted resource requirements and priorities of the plurality of tasks;
[0152] The resource allocation unit 253 is configured to allocate container resources to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
[0153] The present application first generates a task queue in response to a user task request, and then determines the task types of multiple tasks, and can select different container allocation methods for different types of tasks; and determines the priorities of multiple tasks according to dependencies, and can improve the rationality of container resource allocation scheduling; at the same time, the container types of multiple tasks are determined based on the first prediction model, and the container types corresponding to different tasks can be determined, thereby improving the matching degree between task requirements and container resources, and then improving the rationality of container allocation when allocating container resources according to task type, priority and container type, thereby improving resource utilization.
[0154] Adaptively, the embodiments of the present application also provide a computer device and a computer-readable storage medium.
[0155] The computer device comprises: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor;
[0156] Wherein, when the processor executes the computer program, a container resource allocation method of the present application is implemented.
[0157] The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute a container resource allocation method of the present application.
[0158] The above are some implementation methods of the present application, and the purpose, technical scheme and beneficial effects of the present application are further described in detail. It should be clear that the above-mentioned partial implementation methods of the present application cannot be understood as limiting the present application. It is particularly pointed out that for those skilled in the art, any changes, modifications, equivalent substitutions and variations made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A container resource allocation method, characterized in that: include: In response to a task request submitted by a user, a task queue is generated; wherein the task queue is composed of a plurality of tasks; Determining, according to the plurality of tasks, a task type of each of the plurality of tasks; Determining the priorities of the tasks according to the dependencies between the tasks; Determine, based on a preset first prediction model, a container type of each of the plurality of tasks; Container resources are allocated to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
2. A container resource allocation method according to claim 1, characterized in that: The generating of a task queue in response to a task request submitted by a user specifically includes: In response to a task request submitted by a user, obtaining configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode; A task queue is generated according to the configuration data of each of the plurality of tasks.
3. A container resource allocation method according to claim 2, characterized in that: Determining the task type of each of the multiple tasks according to the multiple tasks specifically includes: Selecting one task in turn as the current first task, and determining the task type of the current first task according to a preset task type determination method, until the task types of the plurality of tasks are determined; The task type determination method includes: Calculate the task type score according to the configuration data of the current first task; The task type of the current first task is determined according to the task type score and a preset first threshold.
4. A container resource allocation method according to claim 2, characterized in that: The determining, based on the preset first prediction model, the container type of each of the plurality of tasks specifically includes: Selecting one task in turn as the current second task, and determining the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined; Wherein, the container type determination method includes: Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task; The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
5. A container resource allocation method according to any one of claims 1 to 4, characterized in that: Determining the priorities of the plurality of tasks according to the dependencies of the plurality of tasks specifically includes: Generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks; Determining a total number of priority categories based on the depth of the dependency graph; The priorities of the plurality of tasks are determined according to the total number of priority categories and corresponding to the levels of the plurality of tasks in the dependency graph.
6. A container resource allocation method according to claim 1, characterized in that: The allocating container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks specifically includes: According to the task types of the multiple tasks, predicting the resource requirements of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements; generating a resource allocation decision based on the predicted resource requirements and priorities of each of the plurality of tasks; Container resources are allocated to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
7. A container resource allocation device, characterized in that: It includes a task queue generation module, a task type determination module, a priority determination module, a container type determination module and a container resource allocation module; The task queue generation module is used to generate a task queue in response to a task request submitted by a user; wherein the task queue is composed of a plurality of tasks; The task type determination module is used to determine the task type of each of the multiple tasks according to the multiple tasks; The priority determination module is used to determine the priority of each of the multiple tasks according to the dependency relationship of the multiple tasks; The container type determination module is used to determine the container type of each of the plurality of tasks based on a preset first prediction model; The container resource allocation module is used to allocate container resources to the multiple tasks according to the task types, container types and priorities of the multiple tasks.
8. A container resource allocation device according to claim 7, characterized in that: The task queue generation module includes a configuration acquisition unit and a queue generation unit; The configuration acquisition unit is used to respond to the task request submitted by the user and acquire the configuration data of each of the multiple tasks in the task request; wherein the configuration data includes initial resource requirements, execution time, security requirements and data access mode; The queue generating unit is used to generate a task queue according to the respective configuration data of the plurality of tasks.
9. A container resource allocation device according to claim 8, characterized in that: The task type determination module includes a task type determination unit; The task type determination unit is used to select one task as the current first task in turn, and determine the task type of the current first task according to a preset task type determination method, until the task types of the plurality of tasks are determined; The task type determination method includes: Calculate the task type score according to the configuration data of the current first task; The task type of the current first task is determined according to the task type score and a preset first threshold.
10. The container resource allocation device according to claim 8, characterized in that: The container type determination module includes a container type determination unit; The container type determination unit is used to select one task in turn as the current second task, and determine the container type of the current second task according to a preset container type determination method, until the plurality of tasks have their respective container types determined; Wherein, the container type determination method includes: Inputting the configuration data of the current second task into the first prediction model to obtain the prediction container and the corresponding prediction probability of the current second task; The container type of the current second task is determined according to the preset second threshold, the predicted container and the corresponding predicted probability.
11. A container resource allocation device according to any one of claims 7 to 10, characterized in that: The priority determination module includes a relationship graph generation unit, a category total number determination unit and a priority determination unit; The relationship graph generating unit is used to generate a dependency graph of the multiple tasks according to the dependency relationships of the multiple tasks; The total number of categories determining unit is used to determine the total number of priority categories according to the depth of the dependency graph; The priority determination unit is used to determine the respective priorities of the multiple tasks according to the total number of priority categories and corresponding to the levels of the multiple tasks in the dependency graph.
12. The container resource allocation device according to claim 7, characterized in that: The container resource allocation module includes a demand prediction unit, a decision generation unit and a resource allocation unit; The demand prediction unit is used to predict the resource requirements of the multiple tasks according to the task types of the multiple tasks based on a preset second prediction model to obtain multiple predicted resource requirements; The decision generating unit is used to generate a resource allocation decision according to the predicted resource requirements and priorities of each of the plurality of tasks; The resource allocation unit is used to allocate container resources to the multiple tasks according to the resource allocation decision and the container types of the multiple tasks.
Citation Information
Cited By
A code execution method and device
CN119781778A
