Resource scheduling method, device, electronic device and readable storage medium

By allocating resources and cyclically scheduling target tasks in a multi-tenant environment, the problem of low resource utilization in a multi-tenant environment is solved, and resource utilization and scheduling efficiency are improved.

CN119739513APending Publication Date: 2025-04-01CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411796655.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

In a multi-tenant environment, resource scheduling becomes complicated, resulting in problems such as low cluster resource utilization, unbalanced resource utilization among tenants, and scheduling blockage.

Method used

By allocating part of the resources of the second user to the first user when the resource required by the user to be scheduled is greater than the allocated resource, and prioritizing the dependencies between tasks is determined, the target task is scheduled to improve resource utilization.

Benefits of technology

It improves resource utilization, alleviates scheduling blockage, and improves the response timeliness and scheduling efficiency of user scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739513A_ABST
    Figure CN119739513A_ABST
Patent Text Reader

Abstract

The present application provides a resource scheduling method, device, electronic device and readable storage medium. The method comprises: when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of the second user that meets the first condition are allocated to the first user; for each user to be scheduled, according to the dependency relationship between tasks, the task with the highest first priority is determined as the target task; according to the second priority of the target task, all target tasks to be scheduled are sorted; according to the sorting, the target task is cyclically scheduled. The present application improves resource utilization by adjusting resource allocation. In each round of scheduling, only one high-priority task is scheduled for each user, which not only solves the scheduling priority problem within the same user, but also superimposes cyclic scheduling, which can greatly improve the response time of user scheduling, alleviate scheduling congestion, and improve scheduling efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of resource scheduling, and in particular to a resource scheduling method, device, electronic device and readable storage medium. Background Art

[0002] With the rapid development of cloud computing, more and more enterprises and users choose to deploy services on cloud platforms, which have the advantages of simple and fast deployment, low overhead, and higher computing resource utilization. In order to automatically manage applications and use containers for expansion, many container cluster management systems have emerged, such as Docker SwarmKit and Kubernetes. At present, Kubernetes has become a large-scale cloud computing cluster management platform based on containers with its outstanding container orchestration, automated deployment, resource scheduling and other capabilities.

[0003] In Kubernetes, cluster task scheduling is usually a complex online decision-making problem, especially cluster scheduling under multi-tenancy. This mode in which multiple tenants share a set of Kubernetes cluster resources can centrally manage all tenant services and achieve resource sharing. However, in a multi-tenant environment, resource scheduling becomes very complicated. Unreasonable resource allocation and scheduling can lead to problems such as low cluster resource utilization, uneven resource utilization among tenants, and scheduling blockage, reducing the overall resource utilization of the cluster. Summary of the invention

[0004] The purpose of the present application is to provide a resource scheduling method, device, electronic device and readable storage medium to solve the problem of low resource utilization in a multi-tenant environment.

[0005] To achieve the above object, an embodiment of the present application provides a resource scheduling method, including:

[0006] In a case where the scheduling resources required by the first user to be scheduled are greater than the allocated resources, allocating at least part of the allocated resources of the second user that meets the first condition to the first user;

[0007] For each user to be scheduled, determine the task with the highest priority as the target task based on the dependencies between tasks;

[0008] According to the second priority of the target task, all target tasks to be scheduled are sorted;

[0009] According to the sequence, the target tasks are cyclically scheduled.

[0010] Optionally, the method further includes:

[0011] determining a second user according to the first condition;

[0012] The first condition includes: the resource utilization rate is less than the resource utilization rate of the first user, and the resource borrowing score is the lowest.

[0013] Optionally, determining the second user according to the first condition includes:

[0014] Determining a list of first users whose weight is less than the weight of the first user;

[0015] In the first user list, filter users whose resource utilization rate is less than a first threshold;

[0016] Among the users whose resource utilization is less than the first threshold, a second user list is obtained by screening, wherein the users in the second user list are: users whose resource utilization is less than the initial value of the resource utilization of the first user; and the first threshold is greater than the initial value of the resource utilization;

[0017] Calculating resource secondment scores of users in the second user list;

[0018] The user with the lowest resource borrowing score is determined to be the second user.

[0019] Optionally, the method further includes:

[0020] If there is no user whose resource utilization is less than the initial resource utilization value among the users whose resource utilization is less than the first threshold, the initial resource utilization value is adjusted to a second threshold, which is greater than the initial resource utilization value and less than the first threshold.

[0021] Optionally, calculating the resource secondment score of the user in the second user list includes:

[0022] The resource borrowing score of the user is calculated according to the user's weight and the user's resource utilization rate.

[0023] Optionally, for each user to be scheduled, determining the task with the highest first priority as the target task according to the dependency relationship between tasks includes:

[0024] For each user to be scheduled, according to the dependency relationship between tasks, the task with the highest dependency value is determined to have the highest first priority;

[0025] The task with the highest first priority is determined as the target task, where the target task is a task that is scheduled to be executed first among at least one task of the same user.

[0026] Optionally, the sorting of all target tasks to be scheduled according to the second priority of the target task includes:

[0027] For each target task, the mean square error of resource utilization and the dominant resource ratio are determined according to the resource utilization; the mean square error is used to indicate the balance of resource utilization among various resources, and the dominant resource ratio is used to indicate the resource type with the highest resource utilization;

[0028] Determining an optimal solution and a worst solution according to the mean square error of the resource utilization and the dominant resource ratio;

[0029] Determining the Euclidean distances between the target task and the optimal solution and the worst solution respectively;

[0030] Determining a second priority of the target task according to the Euclidean distance;

[0031] All target tasks to be scheduled are sorted according to the second priority of the target task.

[0032] Optionally, the optimal solution is: a minimum mean square error of resource utilization and a minimum dominant resource ratio;

[0033] The worst solution is: the maximum value of the mean square error of resource utilization and the maximum value of the dominant resource ratio.

[0034] Optionally, determining the second priority of the target task according to the Euclidean distance includes:

[0035] Calculating the Euclidean distance between the target task and the optimal solution and the sum of the Euclidean distances between the target task and the worst solution to obtain a first value;

[0036] The ratio of the Euclidean distance between the target task and the worst solution to the first value is calculated to obtain the priority of the target task.

[0037] Optionally, the cyclically scheduling the target tasks according to the order includes:

[0038] Determine whether the target task is in the scheduled list;

[0039] If the target task is not in the scheduled list, the target task is pushed to the container cluster management system for scheduling;

[0040] If the target task is in the scheduled list, determining whether the target task is the last target task to be scheduled;

[0041] If the target task is not the last target task to be scheduled, then continue to determine whether the next target task of the target task is in the scheduled list.

[0042] Optionally, the method further includes:

[0043] If the target task is the last target task to be scheduled, or the scheduling times is equal to the total number of target tasks, the scheduled times is reset to 1 and the scheduled list is cleared.

[0044] To achieve the above object, an embodiment of the present application provides a resource scheduling device, including:

[0045] A first processing module, configured to allocate at least part of the allocated resources of a second user that meets a first condition to the first user when the scheduling resources required by the first user to be scheduled are greater than the allocated resources;

[0046] A first determination module is used to determine, for each user to be scheduled, the task with the highest first priority as the target task according to the dependency relationship between tasks;

[0047] A sorting module, used for sorting all target tasks to be scheduled according to the second priority of the target task;

[0048] The scheduling module is used to cyclically schedule the target tasks according to the sequence.

[0049] To achieve the above-mentioned purpose, an embodiment of the present application provides an electronic device, including a transceiver, a processor, a memory, and a program or instruction stored in the memory and executable on the processor; when the processor executes the program or instruction, the steps of the above-mentioned resource scheduling method are implemented.

[0050] To achieve the above-mentioned purpose, an embodiment of the present application provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the above-mentioned resource scheduling method are implemented.

[0051] To achieve the above-mentioned purpose, an embodiment of the present application provides a computer program product on which a program or instruction is stored, including computer instructions, which implement the steps of the above-mentioned resource scheduling method when executed by a processor.

[0052] The beneficial effects of the above technical solution of the present application are as follows:

[0053] In the embodiment of the present application, when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of the second user that meets the first condition are allocated to the first user, and the resource utilization rate is improved by adjusting the resource allocation, so that the first user task scheduling can be realized as soon as possible without affecting the second user. For each user, the target task with the highest priority is determined based on the dependency relationship for secondary scheduling. In each round of scheduling, only one high-priority task is scheduled for each user, which not only solves the scheduling priority problem within the same user, but also superimposes cyclic scheduling, which can greatly improve the response time of user scheduling, alleviate scheduling congestion, and improve scheduling efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 This is one of the flowcharts of the resource scheduling method according to an embodiment of the present application;

[0055] Figure 2 This is a second flow chart of the resource scheduling method according to an embodiment of the present application;

[0056] Figure 3 This is a third flowchart of the resource scheduling method according to an embodiment of the present application;

[0057] Figure 4 A schematic diagram of a method for determining a target task in an embodiment of the present application;

[0058] Figure 5 This is a fourth flowchart of the resource scheduling method according to an embodiment of the present application;

[0059] Figure 6 A schematic diagram of the structure of a resource scheduling device according to an embodiment of the present application;

[0060] Figure 7 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0061] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0062] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0063] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0064] Additionally, the terms "system" and "network" are often used interchangeably herein.

[0065] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0066] like Figure 1 As shown, an embodiment of the present application provides a resource scheduling method, including:

[0067] Step 101: when the scheduling resources required by a first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of a second user that meets a first condition is allocated to the first user;

[0068] Step 102: for each user to be scheduled, determine the task with the highest first priority as the target task according to the dependency relationship between tasks;

[0069] Step 103: sort all target tasks to be scheduled according to the second priority of the target task;

[0070] Step 104: cyclically schedule the target tasks according to the sequence.

[0071] In this embodiment, each user may include one or more tasks to be scheduled, and multiple users form a user queue. Each user may pre-set a weight, which may be determined based on the importance of the business, the priority of the business, etc. For example, the more important the business, the higher the weight. The lower the weight, the lower the importance of the user's business, and the greater the possibility that resources will be seconded in the subsequent resource adjustment algorithm. The highest weight value indicates that the user has exclusive resources and will not be seconded by other users. The resource allocation ratio corresponding to each user may be the same or different.

[0072] like Figure 2 As shown in the figure, in the multi-user scheduling process, each user corresponds to a logical namespace, and each namespace is allocated corresponding resources. Different users can set the same or different weights, such as Figure 2As shown in the figure, the weight of namespace1 (the first user) is 8, and the resource allocation ratio is 25%; the weight of namespace2 (the second user) is 10, and the resource allocation ratio is 30%. This user has exclusive resources; the weight of namespace3 (the third user) is 7, and the resource allocation ratio is 20%; the weight of namespace4 (the fourth user) is 5, and the resource allocation ratio is 15%; the weight of namespace5 (the fifth user) is 6, and the resource allocation ratio is 10%.

[0073] Each user can have multiple tasks that need to be scheduled, and each task is a scheduling unit (Pod), such as Figure 2 As shown in the figure, the first user has four tasks: 1, 2, 3, and 4; the second user has two tasks: 5 and 6; the third user has no tasks to be scheduled; the fourth user has three tasks: 7, 8, and 9; and the fifth user has one task 10. "Resource allocation ratio" indicates the ratio of resources pre-allocated to each user. The higher the percentage, the more resources are allocated. "Sorted queue" indicates the queue sorted by the algorithm. According to the order in the queue, it is input into the final container cluster management system (Kubernetes) through the cyclic algorithm to execute the default scheduler.

[0074] The scheduling method of the embodiment of the present application includes three levels of scheduling. The first level of scheduling is: when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of the second user that meets the first condition are allocated to the first user. Through the automatic resource adjustment (Automatic Resource Adjustment, ARA) algorithm between multiple users, when the resources of a certain user cannot meet the scheduling task requirements, resources are borrowed from other users. For example, the first user is user A, and the second user is user B. When user A does not have enough resources, resources will be automatically borrowed from other user B to achieve faster scheduling of user A's tasks to the container cluster management system without affecting user B.

[0075] The second-level scheduling is: for each user to be scheduled, according to the dependency relationship between tasks, determine the task with the highest first priority as the target task; according to the second priority of the target task, sort all the target tasks to be scheduled. In the second-level scheduling, firstly, the task Pod with the highest priority is selected through the dependency relationship to enter the second-level scheduling, and then the tasks entering the second-level scheduling are sorted, and each user's Pod is scheduled in turn through continuous cycles. The third-level scheduling is to cyclically schedule the target task according to the sorting.

[0076] This hierarchical scheduling method not only solves the scheduling priority problem within the same user, but also utilizes scheduling priority to superimpose cyclic scheduling, which can greatly alleviate the problems of scheduling congestion and long response time under multiple users.

[0077] In the embodiment of the present application, when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of the second user that meets the first condition are allocated to the first user, and the resource utilization rate is improved by adjusting the resource allocation, so that the first user task scheduling can be realized as soon as possible without affecting the second user. For each user, the target task with the highest priority is determined based on the dependency relationship for secondary scheduling. In each round of scheduling, only one high-priority task is scheduled for each user, which not only solves the scheduling priority problem within the same user, but also superimposes cyclic scheduling, which can greatly improve the response time of user scheduling, alleviate scheduling congestion, and improve scheduling efficiency.

[0078] As an optional embodiment, the method further includes: determining the second user according to the first condition; wherein the first condition includes: resource utilization is less than that of the first user, and the resource secondment score is the lowest.

[0079] In this embodiment, when the scheduling resources required by the first user are greater than the allocated resources and cannot meet the scheduling requirements, the ARA algorithm is used to loan the resources of the second user who meets the second condition to the first user. By actively adjusting the uneven use of resources of each user and the uneven use of various resources of the cluster as a whole, the cluster resource utilization rate can be greatly improved.

[0080] Optionally, determining the second user according to the first condition includes:

[0081] Determining a list of first users whose weight is less than the weight of the first user;

[0082] In the first user list, filter users whose resource utilization rate is less than a first threshold;

[0083] Among the users whose resource utilization is less than the first threshold, a second user list is obtained by screening, wherein the users in the second user list are: users whose resource utilization is less than the initial value of the resource utilization of the first user; and the first threshold is greater than the initial value of the resource utilization;

[0084] Calculating resource secondment scores of users in the second user list;

[0085] The user with the lowest resource borrowing score is determined to be the second user.

[0086] Optionally, the method also includes: if among the users whose resource utilization is less than the first threshold, there is no user whose resource utilization is less than the initial value of resource utilization, then adjusting the initial value of resource utilization to a second threshold, wherein the second threshold is greater than the initial value of resource utilization and less than the first threshold.

[0087] As an optional embodiment, the calculating of the resource borrowing score of the user in the second user list includes: calculating the resource borrowing score of the user according to the weight of the user and the resource utilization rate of the user.

[0088] The following example illustrates the process of determining the second user and, when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, allocating at least part of the allocated resources of the second user that meets the first condition to the first user.

[0089] The ARA algorithm adjusts the resources between users in the first level scheduling. Figure 3 As shown in the figure, assuming that the first user is user A, when the system finds that a task Pod of a user in the cluster (such as user A) cannot be scheduled because the resource limit is exceeded, it will enter the resource adjustment process between users, including:

[0090] Step 31, filter the users whose weight is smaller than A in the user list Q, obtain the user list Q1, and set the initial resource utilization rate of user A to w=40% to filter the users with low resource utilization rate.

[0091] Step 32, filtering users in the user list Q1 whose resource utilization is lower than 60% (first threshold);

[0092] Step 33, among the users whose resource utilization is lower than 60% (the first threshold), screen the users whose resource utilization is lower than w. If there is no user whose resource utilization is lower than w in Q1, add 5% to w (w plus 5% to get the second threshold) and compare again until w is greater than 60%, then exit the program directly (at this time, it is considered that the user's resource utilization is greater than 60%, which is not considered low utilization). At this time, there are no resources in the cluster that can be adjusted for tenant user A.

[0093] Step 34: If there are users whose resource utilization rate is lower than w in the user list Q1, filter out a user list Q2 whose resource utilization rate is lower than w, and calculate the resource loan score of each user in Q2. The calculation formula of the resource loan score is as follows:

[0094]

[0095] Among them, Score i represents the resource loan score of the i-th user in Q, weight iIndicates the user's weight, utilization i Indicates the user's resource utilization rate. The smaller the resource loan score, the lower the user's business importance and resource utilization rate.

[0096] Step 35, the user with the smallest loan score is obtained through the above calculation (assuming it is user B), and finally user A borrows user B's resources to schedule Pods, and the resources owned by user B are relatively reduced. Through the above resource adjustment between users, it is possible to schedule the tasks of user A (when the resources exceed the limit) to Kubernetes more quickly without affecting user B, while improving the overall resource utilization of the cluster.

[0097] As an optional embodiment, for each user to be scheduled, determining the task with the highest first priority as the target task according to the dependency relationship between tasks includes:

[0098] For each user to be scheduled, according to the dependency relationship between tasks, the task with the highest dependency value is determined to have the highest first priority;

[0099] The task with the highest first priority is determined as the target task, where the target task is a task that is scheduled to be executed first among at least one task of the same user.

[0100] In this embodiment, the PRS algorithm is used in the first-level scheduling to prioritize the scheduling of task Pods with high dependency values ​​(the higher the dependency value, the higher the degree to which the task is dependent on other tasks) within each user. Figure 4 As shown in the figure, suppose a user currently has three task Pods A, B, and C. A depends on B and C, and C depends on B. At this time, B has the highest dependency value and A has the lowest dependency value. If the default scheduler schedules Pod A first, but A depends on B and C, even if A is scheduled first, it will be blocked and cannot start normally. However, when the PRS algorithm schedules internally, Pod B will be scheduled first in the first-level scheduling and enter the second-level scheduling. Finally, PodB will be scheduled and started before A and C, which complies with the startup order and avoids the blocking of task Pod startup.

[0101] If Pods are scheduled one by one in chronological order, when many users submit tasks at the same time, there will be many Pods queued for scheduling in the scheduling queue. Then, for the user who submits the task later, all the task Pods under it will be blocked, and there will be no scheduling response, causing the user to wait too long. At the same time, the priority of task scheduling within each user is not taken into account. For example, the backend service depends on the database service. According to the default scheduling system strategy, the backend service and the data service are scheduled according to the task deployment time. If the backend service is scheduled first at this time, but because it depends on the database service, its startup time is also later than the database service, the final result is that the startup time of the user task Pod is increased. In response to the above problems, this embodiment proposes a priority-based round-robin scheduling (PRS) algorithm. The algorithm first calculates the priority in the first-level scheduling and gives priority to the Pods in the second-level scheduling. Secondly, the Pods in the second-level scheduling will be scheduled in a cyclic manner. Through the above algorithm, one Pod in each user will be scheduled in each round of scheduling, and the dependent services in each user can be scheduled and started first. The dependent services are scheduled and started after the dependent services, which alleviates the problems of scheduling blocking and long response time when scheduling a large number of task Pods.

[0102] As an optional embodiment, the step of sorting all target tasks to be scheduled according to the second priority of the target task includes:

[0103] For each target task, the mean square error of resource utilization and the dominant resource ratio are determined according to the resource utilization; the mean square error is used to indicate the balance of resource utilization among various resources, and the dominant resource ratio is used to indicate the resource type with the highest resource utilization;

[0104] Determining an optimal solution and a worst solution according to the mean square error of the resource utilization and the dominant resource ratio;

[0105] Determining the Euclidean distances between the target task and the optimal solution and the worst solution respectively;

[0106] Determining a second priority of the target task according to the Euclidean distance;

[0107] All target tasks to be scheduled are sorted according to the second priority of the target task.

[0108] Optionally, the optimal solution is: the minimum mean square error of resource utilization and the minimum value of the dominant resource ratio; the worst solution is: the maximum mean square error of resource utilization and the maximum value of the dominant resource ratio.

[0109] Optionally, determining the second priority of the target task according to the Euclidean distance includes:

[0110] The Euclidean distance between the target task and the optimal solution and the sum of the Euclidean distance between the target task and the worst solution are calculated to obtain a first value; and the ratio of the Euclidean distance between the target task and the worst solution to the first value is calculated to obtain the priority of the target task.

[0111] In this embodiment, the ARA algorithm is used to adjust the balance of the overall resources of the cluster in the second-level scheduling. When the task Pod in each user namespace enters the total queue in the second-level scheduling, the sorted second-level scheduling total queue is obtained by calculating the task Pod priority, and the overall balance of the cluster resources is adjusted by adjusting the task Pod scheduling order. Assume that the current i-th task Pod is scheduled to the cluster:

[0112] (1) First, calculate the average utilization of n resources in the cluster as a whole

[0113]

[0114] Among them, U ij Indicates the utilization of the jth resource (such as CPU or memory) after the i-th task Pod is scheduled to the cluster.

[0115] (2) Calculate the mean square error (MSE) of all resource utilization after the i-th task Pod is scheduled to the cluster i To evaluate the utilization balance among the overall resources of the cluster after the task Pod is scheduled, MSE i The smaller the value, the more balanced the overall resource utilization of the cluster is after the task Pod is scheduled. The calculation formula is as follows:

[0116]

[0117] (3) MSE above i It only indicates the overall balance between the utilization rates of various resources. In order to prevent the barrel effect, that is, most resource utilization rates are relatively balanced and only one resource utilization rate is very high, the dominant resource ratio DS is calculated. i To avoid this phenomenon, the dominant resource refers to the resource type with the highest utilization rate after the Pod is scheduled to the cluster. i The smaller the value, the more it indicates that after Pod scheduling, no resource in the cluster as a whole has a much higher utilization rate than all other resources. The calculation formula is as follows:

[0118]

[0119] (4) The above MSE i and DS iThe smaller it is, the more balanced the utilization of resources in the cluster as a whole is, and no resource has a much higher utilization rate than all other resources. Therefore, the optimal solution of the algorithm is determined as A. + And the worst solution A- is as follows:

[0120] A + ={MSE + , DS +}={mmin(MSE i |i=1,2,…,m),min(DS i |i

[0121] =1,2,…,m)}

[0122] A - ={MSE - , DS -}={max(MSE i |i=1,2,…,m),max(DS i |i=1,2,…,m)}

[0123] (5) Calculate the Euclidean distance ED of each task Pod to be scheduled to the optimal solution and the worst solution respectively. The calculation formula is as follows:

[0124]

[0125] (6) Calculate the priority Pi of each Pod to be scheduled. The calculation formula is as follows. Finally, the priority list P of all Pods in the secondary scheduling can be obtained.

[0126]

[0127] P={P1,P2,…,P m}

[0128] After the priority list P is calculated by the above formula, P i Pods with larger values ​​are scheduled first, ensuring that the utilization of various resources in the cluster after scheduling is relatively balanced, so that the subsequent cluster can schedule more task Pods. This solves the problem of uneven utilization of various resources in the cluster as a whole after task Pod scheduling and improves the overall resource utilization of the cluster.

[0129] As an optional embodiment, the cyclically scheduling the target tasks according to the sequence includes:

[0130] Determine whether the target task is in the scheduled list;

[0131] If the target task is not in the scheduled list, the target task is pushed to the container cluster management system for scheduling;

[0132] If the target task is in the scheduled list, determining whether the target task is the last target task to be scheduled;

[0133] If the target task is not the last target task to be scheduled, then continue to determine whether the next target task of the target task is in the scheduled list.

[0134] Optionally, the method further includes: if the target task is the last target task to be scheduled, or the number of scheduling times is equal to the total number of target tasks, resetting the number of scheduled times to 1 and clearing the scheduled list.

[0135] In this embodiment, the PRS algorithm will cyclically schedule all tasks in the total queue in the second-level scheduling, the process is as follows: Figure 5 As shown:

[0136] In the second level scheduling, a loop scheduling algorithm is always running. The algorithm has an outer loop and an inner loop. Figure 5 The inside of the dotted box is the inner loop, and the outside is the outer loop.

[0137] In the outer loop, the number of scheduled times a in the inner loop is first reset to 1, and the list of scheduled users S is cleared. Then, it is continuously determined whether there are any task Pods to be scheduled in the total queue G. If not, it is continuously determined in a loop until there are task Pods to be scheduled in G. At this time, it enters the inner loop. The overall principle of the inner loop is to schedule b (the number of users in the cluster that enter the second-level scheduling, which is also the number of tasks that enter the second-level scheduling) times in a loop, to ensure that each tenant can be scheduled with a Pod in one round of the inner loop, so as to avoid long waiting times for tenants who submit tasks later.

[0138] In the inner loop, it first determines whether the user of the task Pod to be scheduled is in the list S. If not, that means the current user has not been scheduled with a task Pod in this inner loop, then the current task Pod will be pushed to the third-level scheduling for scheduling. If the user of the current task Pod is in the list S, it means the current user has been scheduled with a task Pod in this inner loop, then the current task Pod will be skipped and the next task Pod will be scheduled. Figure 5 As shown on the left and right sides, when the inner loop has been scheduled b times, or the current task Pod to be scheduled is the last one in G, the inner loop is exited and the outer loop is entered, waiting to enter the next round of inner loop scheduling.

[0139] Through the above-mentioned cyclic scheduling, it can be ensured that in each round of scheduling, each user has and only has one high-priority task Pod scheduled, which effectively alleviates the problem of scheduling blockage and long response time of some users who submit tasks later when scheduling a large number of task Pods.

[0140] The embodiment of the present application proposes an automatic resource adjustment (ARA) algorithm between multiple users. The algorithm first works in the first-level scheduling. When user A does not have enough resources, it will automatically borrow resources from other user B to achieve faster scheduling of user A's tasks to Kubernetes without affecting user B; then in the second-level scheduling, the balance of various resources in the cluster is calculated to improve the overall utilization of various resources in the cluster. The ARA algorithm solves the problem of unbalanced resource utilization between users and unbalanced utilization of various resources in the cluster, and greatly improves the utilization of cluster resources.

[0141] A priority-based round-robin scheduling (PRS) algorithm is proposed. This algorithm first selects the highest priority task Pod in the first-level scheduling through dependency relationships and enters the second-level scheduling; then, in the second-level scheduling, each user's task Pod is scheduled in turn through continuous cycles. In one cycle, if a user has multiple task Pods, only the task Pod at the front of the queue will be scheduled, and the remaining task Pods will participate in the next round of cyclic scheduling. The PRS algorithm not only solves the scheduling priority problem within the same user, but also schedules the priority and superimposes the cyclic scheduling, which greatly alleviates the scheduling congestion and long response time problems under multiple users.

[0142] In an embodiment of the present application, when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, at least part of the allocated resources of the second user that meets the first condition are allocated to the first user through the ARA algorithm. The ARA algorithm can improve the utilization rate of various resources by adjusting the resource allocation between users and adjusting the balance of various resources in the cluster, solve the problem of uneven resource utilization between users and uneven utilization of various resources in the cluster as a whole, and greatly improve the overall resource utilization rate of the cluster. In the second-level scheduling, based on the PRS algorithm, for each user, the target task with the highest priority is determined based on the dependency relationship for secondary scheduling. The PRS algorithm performs cyclic scheduling by superimposing the priority of task dependencies, so that in each round of scheduling, one and only one high-priority task is scheduled for each user. This algorithm not only solves the scheduling priority problem within the same user, but also uses scheduling priority superimposed cyclic scheduling to greatly alleviate the problems of scheduling congestion and long response time under multiple users.

[0143] The resource scheduling method of this application has a broad market application prospect in the field of cloud native Kubernetes, and provides a very effective solution to the multi-tenant scheduling problem in the industry. This application proposes a Kubernetes multi-user scheduling algorithm based on a three-level scheduling mode, which belongs to the basic application of Kubernetes in the cloud native field, plays a vital role in cloud native deployment, has extremely high practical value, can be used in many capability scenarios, and can also be applied to other Internet industries to realize value realization, with extremely broad market prospects and extensive market applications.

[0144] like Figure 6 As shown, the embodiment of the present application further provides a resource scheduling device 600, including:

[0145] A first processing module 610 is configured to allocate at least part of the allocated resources of a second user that meets a first condition to the first user when the scheduling resources required by the first user to be scheduled are greater than the allocated resources;

[0146] A first determination module 620 is used to determine, for each user to be scheduled, the task with the highest first priority as the target task according to the dependency relationship between tasks;

[0147] A sorting module 630, configured to sort all target tasks to be scheduled according to the second priority of the target task;

[0148] The scheduling module 640 is used to cyclically schedule the target tasks according to the sequence.

[0149] Optionally, the device further comprises:

[0150] A second determining module, configured to determine a second user according to the first condition;

[0151] The first condition includes: the resource utilization rate is less than the resource utilization rate of the first user, and the resource borrowing score is the lowest.

[0152] Optionally, the second determining module is specifically configured to:

[0153] Determining a list of first users whose weight is less than the weight of the first user;

[0154] In the first user list, filter users whose resource utilization rate is less than a first threshold;

[0155] Among the users whose resource utilization is less than the first threshold, a second user list is obtained by screening, wherein the users in the second user list are: users whose resource utilization is less than the initial value of the resource utilization of the first user; and the first threshold is greater than the initial value of the resource utilization;

[0156] Calculating resource secondment scores of users in the second user list;

[0157] The user with the lowest resource borrowing score is determined to be the second user.

[0158] Optionally, the device further comprises:

[0159] The second processing module is used to adjust the initial resource utilization value to a second threshold value if there is no user whose resource utilization is less than the initial resource utilization value among the users whose resource utilization is less than the first threshold value. The second threshold value is greater than the initial resource utilization value and less than the first threshold value.

[0160] Optionally, calculating the resource secondment score of the user in the second user list includes:

[0161] The resource borrowing score of the user is calculated according to the user's weight and the user's resource utilization rate.

[0162] Optionally, the first determining module is specifically configured to:

[0163] For each user to be scheduled, according to the dependency relationship between tasks, the task with the highest dependency value is determined to have the highest first priority;

[0164] The task with the highest first priority is determined as the target task, where the target task is a task that is scheduled to be executed first among at least one task of the same user.

[0165] Optionally, the sorting module is specifically used for:

[0166] For each target task, the mean square error of resource utilization and the dominant resource ratio are determined according to the resource utilization; the mean square error is used to indicate the balance of resource utilization among various resources, and the dominant resource ratio is used to indicate the resource type with the highest resource utilization;

[0167] Determining an optimal solution and a worst solution according to the mean square error of the resource utilization and the dominant resource ratio;

[0168] Determining the Euclidean distances between the target task and the optimal solution and the worst solution respectively;

[0169] Determining a second priority of the target task according to the Euclidean distance;

[0170] All target tasks to be scheduled are sorted according to the second priority of the target task.

[0171] Optionally, the optimal solution is: a minimum mean square error of resource utilization and a minimum dominant resource ratio;

[0172] The worst solution is: the maximum value of the mean square error of resource utilization and the maximum value of the dominant resource ratio.

[0173] Optionally, determining the second priority of the target task according to the Euclidean distance includes:

[0174] Calculating the Euclidean distance between the target task and the optimal solution and the sum of the Euclidean distances between the target task and the worst solution to obtain a first value;

[0175] The ratio of the Euclidean distance between the target task and the worst solution to the first value is calculated to obtain the priority of the target task.

[0176] Optionally, the scheduling module is specifically used for:

[0177] Determine whether the target task is in the scheduled list;

[0178] If the target task is not in the scheduled list, the target task is pushed to the container cluster management system for scheduling;

[0179] If the target task is in the scheduled list, determining whether the target task is the last target task to be scheduled;

[0180] If the target task is not the last target task to be scheduled, then continue to determine whether the next target task of the target task is in the scheduled list.

[0181] Optionally, the device further comprises:

[0182] The third processing module is used to reset the scheduled times to 1 and clear the scheduled list if the target task is the last target task to be scheduled, or the scheduling times is equal to the total number of target tasks.

[0183] It should be noted here that the above-mentioned device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned resource scheduling processing method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0184] like Figure 7 As shown, an electronic device of an embodiment of the present application includes a transceiver 710, a processor 700, a memory 720, and a program or instruction stored in the memory and executable on the processor; when the processor executes the program or instruction, the steps of the above-mentioned resource scheduling method are implemented, and the transceiver 710 is used to receive and send data under the control of the processor 700.

[0185] The processor 700 is configured to: when the scheduling resources required by the first user to be scheduled are greater than the allocated resources, allocate at least part of the allocated resources of the second user that meets the first condition to the first user;

[0186] For each user to be scheduled, determine the task with the highest priority as the target task based on the dependencies between tasks;

[0187] According to the second priority of the target task, all target tasks to be scheduled are sorted;

[0188] According to the sequence, the target tasks are cyclically scheduled.

[0189] Optionally, the processor 700 is further configured to:

[0190] determining a second user according to the first condition;

[0191] The first condition includes: the resource utilization rate is less than the resource utilization rate of the first user, and the resource borrowing score is the lowest.

[0192] Optionally, the processor 700 determines the second user according to the first condition, including:

[0193] Determining a list of first users whose weight is less than the weight of the first user;

[0194] In the first user list, filter users whose resource utilization rate is less than a first threshold;

[0195] Among the users whose resource utilization is less than the first threshold, a second user list is obtained by screening, wherein the users in the second user list are: users whose resource utilization is less than the initial value of the resource utilization of the first user; and the first threshold is greater than the initial value of the resource utilization;

[0196] Calculating resource secondment scores of users in the second user list;

[0197] The user with the lowest resource borrowing score is determined to be the second user.

[0198] Optionally, the processor 700 is further configured to:

[0199] If there is no user whose resource utilization is less than the initial resource utilization value among the users whose resource utilization is less than the first threshold, the initial resource utilization value is adjusted to a second threshold, which is greater than the initial resource utilization value and less than the first threshold.

[0200] Optionally, the processor 700 calculates the resource secondment score of the user in the second user list, including:

[0201] The resource borrowing score of the user is calculated according to the user's weight and the user's resource utilization rate.

[0202] Optionally, the processor 700 determines, for each user to be scheduled, according to the dependency relationship between tasks, a task with the highest first priority as a target task, including:

[0203] For each user to be scheduled, according to the dependency relationship between tasks, the task with the highest dependency value is determined to have the highest first priority;

[0204] The task with the highest first priority is determined as the target task, where the target task is a task that is scheduled to be executed first among at least one task of the same user.

[0205] Optionally, the processor 700 sorts all target tasks to be scheduled according to the second priority of the target task, including:

[0206] For each target task, the mean square error of resource utilization and the dominant resource ratio are determined according to the resource utilization; the mean square error is used to indicate the balance of resource utilization among various resources, and the dominant resource ratio is used to indicate the resource type with the highest resource utilization;

[0207] Determining an optimal solution and a worst solution according to the mean square error of the resource utilization and the dominant resource ratio;

[0208] Determining the Euclidean distances between the target task and the optimal solution and the worst solution respectively;

[0209] Determining a second priority of the target task according to the Euclidean distance;

[0210] All target tasks to be scheduled are sorted according to the second priority of the target task.

[0211] Optionally, the optimal solution is: a minimum mean square error of resource utilization and a minimum dominant resource ratio;

[0212] The worst solution is: the maximum value of the mean square error of resource utilization and the maximum value of the dominant resource ratio.

[0213] Optionally, the processor 700 determines the second priority of the target task according to the Euclidean distance, including:

[0214] Calculating the Euclidean distance between the target task and the optimal solution and the sum of the Euclidean distances between the target task and the worst solution to obtain a first value;

[0215] The ratio of the Euclidean distance between the target task and the worst solution to the first value is calculated to obtain the priority of the target task.

[0216] Optionally, the processor 700 cyclically schedules the target tasks according to the sequence, including:

[0217] Determine whether the target task is in the scheduled list;

[0218] If the target task is not in the scheduled list, the target task is pushed to the container cluster management system for scheduling;

[0219] If the target task is in the scheduled list, determining whether the target task is the last target task to be scheduled;

[0220] If the target task is not the last target task to be scheduled, then continue to determine whether the next target task of the target task is in the scheduled list.

[0221] Optionally, the processor 700 is further configured to:

[0222] If the target task is the last target task to be scheduled, or the scheduling times is equal to the total number of target tasks, the scheduled times is reset to 1 and the scheduled list is cleared.

[0223] Among them, Figure 7 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking together various circuits of one or more processors represented by processor 700 and memory represented by memory 720. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 710 may be a plurality of components, i.e., including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 700 is responsible for managing the bus architecture and general processing, and the memory 720 may store data used by the processor 700 when performing operations.

[0224] A readable storage medium of an embodiment of the present application stores a program or instruction thereon. When the program or instruction is executed by a processor, the steps in the resource scheduling method as described above are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0225] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0226] An embodiment of the present application also provides a computer program product on which programs or instructions are stored, including computer instructions. When the computer instructions are executed by a processor, the steps in the resource scheduling method as described above are implemented and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0227] It should be further explained that the terminal devices described in this specification include but are not limited to smart phones, tablet computers, etc., and many of the functional components described are called modules in order to more particularly emphasize the independence of their implementation methods.

[0228] In the embodiment of the present application, module can be implemented with software so that it can be executed by various types of processors. For example, an executable code module of an identification can include one or more physical or logical blocks of computer instructions, for example, it can be constructed as an object, process or function. Nevertheless, the executable code of the identified module does not need to be physically located together, but can include different instructions stored in different positions, and when these instructions are logically combined together, it constitutes a module and realizes the specified purpose of the module.

[0229] In fact, executable code module can be a single instruction or many instructions, and can even be distributed on a plurality of different code segments, distributed among different programs, and distributed across a plurality of memory devices. Similarly, operating data can be identified in the module, and can be implemented and organized in the data structure of any appropriate type according to any appropriate form. The operating data can be collected as a single data set, or can be distributed in different locations (including on different storage devices), and can only be present on a system or network as an electronic signal at least in part.

[0230] When a module can be implemented by software, considering the level of existing hardware technology, a person skilled in the art can build a corresponding hardware circuit to implement the corresponding function of the module that can be implemented by software without considering the cost. The hardware circuit includes a conventional very large scale integration (VLSI) circuit or gate array and existing semiconductors such as logic chips, transistors, or other discrete components. The module can also be implemented by a programmable hardware device, such as a field programmable gate array, a programmable array logic, a programmable logic device, etc.

[0231] The above exemplary embodiments are described with reference to the accompanying drawings, and many different forms and embodiments are feasible without departing from the spirit and teachings of the present application. Therefore, the present application should not be constructed as a limitation of the exemplary embodiments proposed herein. More specifically, these exemplary embodiments are provided so that the present application will be perfect and complete, and the scope of the present application will be conveyed to those who are familiar with the technology. In these figures, the component sizes and relative sizes may be exaggerated for clarity. The terms used here are only based on the purpose of describing specific exemplary embodiments and are not intended to be limiting. As used herein, unless the text clearly indicates otherwise, the singular forms "one", "an" and "the" are intended to include these multiple forms. It will be further understood that the terms "comprising" and / or "including" when used in this specification indicate the presence of the features, integers, steps, operations, components and / or components, but do not exclude the presence or increase of one or more other features, integers, steps, operations, components, components and / or their groups. Unless otherwise indicated, when stated, a range of values ​​includes the upper and lower limits of that range and any subranges therebetween.

[0232] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A resource scheduling method, characterized in that: The method comprises: In a case where the scheduling resources required by the first user to be scheduled are greater than the allocated resources, allocating at least part of the allocated resources of the second user that meets the first condition to the first user; For each user to be scheduled, determine the task with the highest priority as the target task based on the dependencies between tasks; According to the second priority of the target task, all target tasks to be scheduled are sorted; According to the sequence, the target tasks are cyclically scheduled.

2. The method according to claim 1, characterized in that The method further comprises: determining a second user according to the first condition; The first condition includes: the resource utilization rate is less than the resource utilization rate of the first user, and the resource borrowing score is the lowest.

3. The method according to claim 2, characterized in that The determining the second user according to the first condition includes: Determining a list of first users whose weight is less than the weight of the first user; In the first user list, filter users whose resource utilization rate is less than a first threshold; Among the users whose resource utilization is less than the first threshold, a second user list is obtained by screening, wherein the users in the second user list are: users whose resource utilization is less than the initial value of the resource utilization of the first user; and the first threshold is greater than the initial value of the resource utilization; Calculating resource secondment scores of users in the second user list; The user with the lowest resource borrowing score is determined to be the second user.

4. The method according to claim 3, characterized in that The method further comprises: If there is no user whose resource utilization is less than the initial resource utilization value among the users whose resource utilization is less than the first threshold, the initial resource utilization value is adjusted to a second threshold, which is greater than the initial resource utilization value and less than the first threshold.

5. The method according to claim 3, characterized in that: The calculating the resource loan score of the user in the second user list includes: The resource borrowing score of the user is calculated according to the user's weight and the user's resource utilization rate.

6. The method according to claim 1, characterized in that The step of determining, for each user to be scheduled, the task with the highest first priority as the target task according to the dependency relationship between the tasks includes: For each user to be scheduled, according to the dependency relationship between tasks, the task with the highest dependency value is determined to have the highest first priority; The task with the highest first priority is determined as the target task, where the target task is a task that is scheduled to be executed first among at least one task of the same user.

7. The method according to claim 1, characterized in that The step of sorting all target tasks to be scheduled according to the second priority of the target task includes: For each target task, the mean square error of resource utilization and the dominant resource ratio are determined according to the resource utilization; the mean square error is used to indicate the balance of resource utilization among various resources, and the dominant resource ratio is used to indicate the resource type with the highest resource utilization; Determining an optimal solution and a worst solution according to the mean square error of the resource utilization and the dominant resource ratio; Determining the Euclidean distances between the target task and the optimal solution and the worst solution respectively; Determining a second priority of the target task according to the Euclidean distance; All target tasks to be scheduled are sorted according to the second priority of the target task.

8. The method according to claim 7, characterized in that The optimal solution is: the minimum mean square error of resource utilization and the minimum ratio of the dominant resources; The worst solution is: the maximum value of the mean square error of resource utilization and the maximum value of the dominant resource ratio.

9. The method according to claim 7, characterized in that: Determining the second priority of the target task according to the Euclidean distance includes: Calculating the Euclidean distance between the target task and the optimal solution and the sum of the Euclidean distances between the target task and the worst solution to obtain a first value; The ratio of the Euclidean distance between the target task and the worst solution to the first value is calculated to obtain the priority of the target task.

10. The method according to claim 1, characterized in that The step of cyclically scheduling the target tasks according to the sequence includes: Determine whether the target task is in the scheduled list; If the target task is not in the scheduled list, the target task is pushed to the container cluster management system for scheduling; If the target task is in the scheduled list, determining whether the target task is the last target task to be scheduled; If the target task is not the last target task to be scheduled, then continue to determine whether the next target task of the target task is in the scheduled list.

11. The method according to claim 10, characterized in that The method further comprises: If the target task is the last target task to be scheduled, or the scheduling times is equal to the total number of target tasks, the scheduled times is reset to 1 and the scheduled list is cleared.

12. A resource scheduling device, characterized in that: include: A first processing module, configured to allocate at least part of the allocated resources of a second user that meets a first condition to the first user when the scheduling resources required by the first user to be scheduled are greater than the allocated resources; A first determination module is used to determine, for each user to be scheduled, the task with the highest first priority as the target task according to the dependency relationship between tasks; A sorting module, used for sorting all target tasks to be scheduled according to the second priority of the target task; The scheduling module is used to cyclically schedule the target tasks according to the sequence.

13. An electronic device, characterized in that: It comprises a transceiver, a processor, a memory, and a program or instruction stored in the memory and executable on the processor; when the processor executes the program or instruction, the steps of the resource scheduling method as described in any one of claims 1 to 11 are implemented.

14. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the resource scheduling method according to any one of claims 1 to 11 are implemented.

15. A computer program product having a program or instructions stored thereon, characterized in that: The method comprises computer instructions, which, when executed by a processor, implement the steps of the resource scheduling method as claimed in any one of claims 1 to 11.