Container scheduling method and device, and computer device

By recording and matching node version numbers in container scheduling, and utilizing optimistic concurrency control to achieve multi-threaded concurrent scheduling, the problem of improving scheduling speed without affecting cluster scheduling quality is solved.

CN115576685BActive Publication Date: 2026-04-14JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
Filing Date
2022-09-26
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

How to improve cluster scheduling speed without affecting cluster scheduling quality, especially in business computing scenarios that schedule a large number of container pods in a short period of time.

Method used

By obtaining the container pods in the queue to be scheduled, recording the version number of the cluster nodes, and matching the version number of the candidate nodes based on the attribute information of the pods and nodes, scheduling is performed when the version number matches, and multi-threaded concurrent scheduling is achieved using optimistic concurrency control.

Benefits of technology

It improves cluster scheduling speed without affecting cluster scheduling quality, and does not require changes to how users use the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115576685B_ABST
    Figure CN115576685B_ABST
Patent Text Reader

Abstract

The disclosure provides a container scheduling method and device and computer equipment, and relates to the technical field of computers. The method comprises the following steps: obtaining N to-be-scheduled container pods from a to-be-scheduled queue; recording a first version number corresponding to each schedulable node node in a cluster; based on first attribute information of each to-be-scheduled pod, traversing second attribute information of each node to determine a candidate node corresponding to each to-be-scheduled pod and a second version number corresponding to the candidate node; and in the case that the second version number corresponding to the candidate node of any pod matches the recorded first version number, scheduling and processing the any pod by using the candidate node. Thus, after obtaining N to-be-scheduled pods and corresponding candidate nodes, the version number of the candidate node can be verified, and in the case that the version number of the candidate node corresponding to any pod matches, the pod can be scheduled and processed by using the candidate node, thereby improving the cluster scheduling speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a container scheduling method, apparatus, and computer device. Background Technology

[0002] With the rapid development of computer technology, clusters are becoming increasingly widely used. Typically, in scenarios such as mixed online and offline deployments and offline tasks, there may be situations where a large number of container pods need to be scheduled for business computation in a short period. Related technologies can use pruning and scoring strategies to achieve this, but while these strategies improve scheduling speed, they may affect scheduling quality. Therefore, improving cluster scheduling speed without compromising scheduling quality is crucial. Summary of the Invention

[0003] This disclosure aims to at least partially address one of the technical problems in the related art.

[0004] The first aspect of this disclosure provides a container scheduling method, comprising:

[0005] Get N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1;

[0006] Record the first version number currently corresponding to each schedulable node in the cluster;

[0007] Based on the first attribute information of each pod to be scheduled, the second attribute information of each node is traversed to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node;

[0008] If the second version number of any candidate node corresponding to a pod matches the first version number of the record, the candidate node is used to schedule the pod.

[0009] A second aspect of this disclosure provides a container scheduling apparatus, comprising:

[0010] The acquisition module is used to acquire N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1;

[0011] A recording module is used to record the first version number currently corresponding to each schedulable node in the cluster.

[0012] The traversal module is used to traverse the second attribute information of each node based on the first attribute information of each pod to be scheduled, so as to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node.

[0013] The processing module is used to schedule any pod using the candidate node if the second version number of the candidate node corresponding to any pod matches the first version number of the record.

[0014] A third aspect of this disclosure provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements a container scheduling method as proposed in a first aspect of this disclosure.

[0015] A fourth aspect of this disclosure provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements a container scheduling method as proposed in a first aspect of this disclosure.

[0016] A fifth aspect of this disclosure provides a computer program product that, when executed by an instruction processor, performs a container scheduling method according to a first aspect of this disclosure.

[0017] The container scheduling method, apparatus, computer device, and storage medium disclosed herein first obtain N pods to be scheduled from a queue of pods to be scheduled. Then, it records the first version number of each schedulable node in the cluster. Based on the first attribute information of each pod to be scheduled, it iterates through the second attribute information of each node to determine the candidate node and its corresponding second version number. If the second version number of any candidate node matches the recorded first version number, the candidate node is used to schedule that pod. Therefore, after obtaining N pods to be scheduled and their corresponding candidate nodes, the version number of the candidate node can be checked. If the version numbers of two consecutive candidate nodes match, the candidate node is used to schedule the pod. This optimistic concurrency control enables multi-threaded concurrent pod scheduling, thereby improving cluster scheduling speed without affecting the cluster scheduling quality.

[0018] Additional aspects and advantages of this disclosure will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this disclosure. Attached Figure Description

[0019] The above and / or additional aspects and advantages of this disclosure will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, in which:

[0020] Figure 1 This is a schematic flowchart illustrating a container scheduling method provided in an embodiment of the present disclosure;

[0021] Figure 2 A schematic flowchart illustrating a container scheduling method provided in another embodiment of this disclosure;

[0022] Figure 2A This is a schematic diagram of the container scheduling process provided in an embodiment of the present disclosure;

[0023] Figure 3 This is a schematic diagram of the structure of a container scheduling device provided in an embodiment of the present disclosure;

[0024] Figure 4 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation

[0025] Embodiments of this disclosure are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure.

[0026] The following description, with reference to the accompanying drawings, describes a container scheduling method, apparatus, computer device, and storage medium according to embodiments of the present disclosure.

[0027] This disclosure illustrates an example where the container scheduling method is configured in a container scheduling device. This container scheduling device can be applied to any computer device so that the computer device can perform container scheduling functions.

[0028] Among them, computer equipment can be personal computers (PCs), cloud devices, mobile devices, etc. Mobile devices can be hardware devices with various operating systems, touch screens and / or displays, such as mobile phones, tablets, personal digital assistants, wearable devices, and in-vehicle devices.

[0029] Figure 1 This is a flowchart illustrating the container scheduling method provided in an embodiment of the present disclosure.

[0030] like Figure 1 As shown, the scheduling method for this container may include the following steps:

[0031] Step 101: Obtain N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1.

[0032] The queue to be scheduled may contain one or more pods. The queue to be scheduled may be a queue in a container cluster management system (Kubernetes, k8s) or a queue in any other cluster, etc. This disclosure does not limit this.

[0033] Additionally, a pod can be the smallest scheduling unit in a cluster, which may contain one or more containers, etc., and this disclosure does not limit this.

[0034] In addition, N can be a pre-set value, such as 3, 5, 10, etc., or it can be adjusted as needed, etc. This disclosure does not limit it.

[0035] Additionally, scheduling can be understood as binding a pod to a node and allocating an internet protocol address (IP) address, central processing unit (CPU) resources, memory resources, etc. to the pod. This disclosure does not limit this.

[0036] Optionally, the N pods to be scheduled in the scheduling queue can be scheduled by different threads. For example, thread 1 schedules pod 1, thread 2 schedules pod 2, thread 3 schedules pod 3, and so on. Thus, in this embodiment of the disclosure, multi-threaded concurrent pod scheduling can be achieved, thereby providing conditions for improving pod scheduling speed.

[0037] Step 102: Record the first version number corresponding to each schedulable node in the cluster.

[0038] The schedulable node can be any node in a cluster that can fulfill pod scheduling requests, and this disclosure does not limit this.

[0039] Additionally, the version number can be a value of a specific field in a node, which can be used to represent the node's state information. For example, by parsing a specific field in node1, we can determine that the first version number of node1 is "1"; or by parsing a specific field in node2, we can determine that the first version number of node2 is "0", and so on. This disclosure does not limit this.

[0040] Therefore, in this embodiment of the disclosure, the first version number corresponding to the schedulable node can be determined by parsing specific fields in the schedulable node and recorded thereon. This disclosure does not limit this.

[0041] Step 103: Based on the first attribute information of each pod to be scheduled, traverse the second attribute information of each node to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node.

[0042] The first attribute information of the pod can be information such as the target amount of resources required by the pod; the second attribute information of the node can be information such as the amount of resources that the node can currently provide. This disclosure does not limit this information.

[0043] In addition, the number of candidate nodes corresponding to any pod to be scheduled can be one or more, etc., and this disclosure does not limit this.

[0044] For example, after determining the first attribute information of each pod to be scheduled and the second attribute information of each node, the pods to be scheduled can be compared with the nodes based on the first and second attribute information. For instance, if the target resource amount of pod1 to be scheduled is X, and the available resource amount of node1 is Y, where Y is greater than X, then node1 can be identified as the candidate node corresponding to pod1. Or, if the target resource amount of pod2 to be scheduled is X, the available resource amount of node2 is Y, and the available resource amount of node3 is Z, where both Y and Z are greater than X, then node2 and node3 can be identified as candidate nodes corresponding to pod2.

[0045] It should be noted that the above examples are merely illustrative and should not be construed as limiting the first attribute information of the pod to be scheduled, the second attribute information of the node, and the candidate node in the embodiments of this disclosure.

[0046] It is understandable that after identifying the candidate node corresponding to the pod to be scheduled, specific fields in the candidate node can be parsed to determine the corresponding second version number, which will not be elaborated here.

[0047] Step 104: If the second version number of any candidate node corresponding to any pod matches the first version number recorded, schedule any pod using the candidate node.

[0048] It is understandable that if the second version number of any candidate node corresponding to a pod is the same as or consistent with the first version number of the record, it can be considered that the second version number of the candidate node matches the first version number of the record.

[0049] For example, if the second version number of the candidate node corresponding to any pod is "1" and the first version number recorded by the candidate node is also "1", then it can be indicated that the candidate node is currently available and can be used to schedule and process any pod, etc. This disclosure does not limit this.

[0050] Optionally, after scheduling any pod using a candidate node, the second version number of the candidate node corresponding to any pod can also be updated.

[0051] There are several ways to update the second version number of a candidate node. For example, the second version number can be incremented by one to become the updated version number; or the second version number can be updated according to specific rules, etc. This disclosure does not limit the specific methods.

[0052] For example, if the second version number of the candidate node corresponding to any pod is "0" and the first version number recorded by the candidate node is also "0", then the candidate node can be used to schedule any pod and update the second version number of the candidate node, for example, it can be updated to "1", etc. This disclosure does not limit this.

[0053] Therefore, in this embodiment of the disclosure, optimistic concurrency control can be used to achieve multi-threaded concurrent pod scheduling, thereby improving the pod cluster scheduling speed without affecting the cluster scheduling quality or changing the user's usage.

[0054] In this embodiment, N pods to be scheduled are first obtained from the scheduling queue. Then, the first version number of each schedulable node in the cluster is recorded. Based on the first attribute information of each pod to be scheduled, the second attribute information of each node is traversed to determine the candidate node and its corresponding second version number. If the second version number of any candidate node matches the recorded first version number, the candidate node is used to schedule that pod. Therefore, after obtaining N pods to be scheduled and their corresponding candidate nodes, the version number of the candidate node can be checked. If the version numbers of any candidate node for a pod match in two consecutive iterations, that candidate node can be used to schedule the pod. This optimistic concurrency control enables multi-threaded concurrent pod scheduling, thereby improving cluster scheduling speed without affecting the cluster scheduling quality.

[0055] Figure 2This is a flowchart illustrating the container scheduling method provided in an embodiment of the present disclosure.

[0056] like Figure 2 As shown, the scheduling method for this container may include the following steps:

[0057] Step 201: Determine the top N pods with the highest priority in the scheduling queue as the pods to be scheduled.

[0058] The priority of a pod can be determined based on the type of task to be processed. For example, computationally intensive tasks can be assigned high priority, while ordinary tasks can be assigned low priority, and so on. This disclosure does not impose any restrictions on this.

[0059] In addition, N can be a pre-set value, such as 3, 5, 10, etc., and this disclosure does not limit it.

[0060] For example, if N is 3, and there are 7 pods to be scheduled in the queue, where pod1 and pod3 are high priority, pod4 is medium priority, and pod2, pod5, pod6 and pod7 are low priority, then pod1, pod3 and pod4 can be identified as pods to be scheduled, etc. This disclosure does not limit this.

[0061] Alternatively, the top N pods with the longest waiting time in the scheduling queue can be selected as the pods to be scheduled.

[0062] The waiting time is the duration a pod spends waiting to be scheduled after entering the scheduling queue.

[0063] For example, pod1 enters the scheduling queue at 09:01, pod2 at 09:03, pod3 at 09:05, pod4 at 09:07, and pod5 at 09:08. With N equal to 4, if the current time is 09:10, then pod1's waiting time is 9 minutes, pod2's is 7 minutes, pod3's is 5 minutes, pod4's is 3 minutes, and pod5's is 2 minutes. Therefore, pod1, pod2, pod3, and pod4 can be identified as pods awaiting scheduling, and so on. This disclosure does not impose any limitations on this.

[0064] Step 202: Obtain N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1.

[0065] Step 203: Record the first version number corresponding to each schedulable node in the cluster.

[0066] It should be noted that the specific content and implementation of steps 202 and 203 can be found in the descriptions of other embodiments of this disclosure, and will not be repeated here.

[0067] Step 204: Parse the first attribute information of each pod to be scheduled in order to determine the target amount of resources required for each pod to be scheduled.

[0068] The first attribute information can characterize the attribute features of the pod to be scheduled, such as the amount of resources required to schedule the pod, the number of CPU cores, network bandwidth, graphics card, hard disk, etc. This disclosure does not limit this.

[0069] It should be noted that any preferable method can be used to parse the first attribute information of each pod to be scheduled in order to determine the target amount of resources required by each pod to be scheduled, and this disclosure does not limit this.

[0070] Step 205: Parse the second attribute information of each node to determine the amount of available resources for each node.

[0071] The second attribute information can characterize the attribute features of a node, such as the amount of resources a node can provide, the number of CPU cores, network bandwidth, graphics card, hard disk, etc. This disclosure does not limit this.

[0072] It should be noted that any desirable method can be used to parse the second attribute information of each node to determine the amount of resources each node can provide, the amount of computing power it can provide, etc., and this disclosure does not limit this.

[0073] Step 206: If the available resources of any node are greater than the target resources of the pod to be scheduled, then that node is determined as a candidate node for the pod to be scheduled.

[0074] For example, if the target resource quantity of pod1 to be scheduled is X, and the available resource quantity of node1 is Y, and Y is greater than X, then node1 can be identified as the candidate node corresponding to pod1 to be scheduled.

[0075] Alternatively, if the number of CPU cores in pod1 to be scheduled is 12, the number of CPU cores in node1 is 13, and the number of CPU cores in node2 is 10, where 13 is greater than 12, then node1 can be identified as the candidate node corresponding to pod1 to be scheduled.

[0076] It should be noted that the above examples are merely illustrative and should not be construed as limiting the first attribute information of the pod to be scheduled, the second attribute information of the node, and the candidate node in the embodiments of this disclosure.

[0077] Step 207: If the second version number of any candidate node corresponding to any pod matches the first version number recorded, schedule any pod using the candidate node.

[0078] Step 208: Update the second version number of the candidate node corresponding to any pod.

[0079] It should be noted that the specific content and implementation of steps 207 and 208 can be found in the descriptions of other embodiments of this disclosure, and will not be repeated here.

[0080] Step 209: If the number of candidate nodes corresponding to any pod is one and the second version number corresponding to the candidate node does not match the first version number recorded, place any pod at the end of the scheduling queue.

[0081] Optionally, a compare and swap (CAS) strategy can be used to verify that the second version number of the candidate node matches the first version number of the record.

[0082] Among them, CAS operation is an optimistic concurrency strategy, which usually means that it can maintain an optimistic attitude, assuming that the concurrent execution process will not cause competition problems for shared data. It only checks whether there is a competition problem for shared data when modifying data. If no other thread has modified the shared data when it is modified, the modification is successful.

[0083] Therefore, if the second version number of any candidate node matches the first version number recorded, it can be assumed that no other thread has modified the candidate node, and the candidate node can be bound to the corresponding pod. If the second version number of any candidate node does not match the first version number recorded, it can be assumed that another thread has modified the candidate node, meaning that the candidate node may already be occupied and may not be able to provide the resources required by the pod, thus the pod cannot be bound to the candidate node. In this case, the pod can be placed back at the end of the scheduling queue to wait for scheduling.

[0084] For example, if any candidate node corresponding to pod1 is node1, then a specific field in node1 can be parsed to determine the second version number of node1, which could be "1". If the first version number recorded by node1 is "0", which does not match the second version number "1" corresponding to node1, then it indicates that node1 may have changed and may not be able to schedule pod1. In this case, pod1 can be placed back at the end of the scheduling queue.

[0085] Alternatively, both pod1 and pod2 can have a candidate node: node1, and the first version number of node1 is recorded as "0". For example, first, retrieve the current second version number of node1 corresponding to pod1, which is "0", matching the recorded first version number "0". Then, pod1 can be bound to node1 to schedule pod1; and the second version number of node1 can be updated, for example, to "1". Then, for pod2, by parsing node1, we can obtain the current second version number "1", which does not match the recorded first version number "0". Therefore, pod2 can be placed at the end of the scheduling queue.

[0086] It should be noted that the above examples are merely illustrative and should not be taken as limitations on the second version number and first version number of the candidate node in the embodiments of this disclosure.

[0087] Step 210: Update the waiting time for any pod to enter the scheduling queue.

[0088] Understandably, if any pod is put back into the scheduling queue, the waiting time for that pod to enter the scheduling queue can be updated.

[0089] For example, the waiting time of pod1 before it re-enters the scheduling queue is T1. After pod1 is placed back to the end of the scheduling queue, its waiting time can be determined based on T1. For instance, if the initial waiting time of pod1 in the scheduling queue is T1, and it is placed back to the end of the scheduling queue at time t0, then if the current time is t1, then the current waiting time of pod1 is T1 + (t1 - t0), etc. This disclosure does not limit this.

[0090] Therefore, in this embodiment, after obtaining N pods to be scheduled, a candidate node corresponding to each pod can be determined. Then, the second version number and the first version number of each candidate node can be matched. If they match, the pod corresponding to that candidate node is scheduled; otherwise, the pod corresponding to that candidate node is returned to the scheduling queue. Thus, through optimistic concurrency control, pod scheduling can be performed concurrently by multiple threads, thereby improving cluster scheduling speed without affecting the cluster scheduling quality or requiring users to change their methods.

[0091] It should be noted that the container scheduling method provided in this disclosure can be applied to any container scheduling scenario.

[0092] The following is combined with Figure 2A The scheduling process of the containers provided in this disclosure is described.

[0093] Understandably, in a multi-threaded scenario, each thread can be scheduled to work with one pod. For example... Figure 2A As shown, N pods to be scheduled can be obtained from the queue of pods to be scheduled. pod1 is scheduled by thread 1, pod2 is scheduled by thread 2, ..., podN is scheduled by thread N. Then, a batch of nodes with sufficient resources can be selected from the cluster and the first version number of each node can be recorded.

[0094] Next, based on the first attribute information of each pod to be scheduled, the second attribute information of each node can be traversed to determine the candidate node corresponding to each pod. Then, the second version number of each candidate node can be checked, and it can be determined whether the second version number of each candidate node matches the first version number, i.e., whether the version number of the candidate node has changed. If the second version number of any candidate node matches the first version number and has not changed, the second version number of that candidate node is updated, and the corresponding pod is bound to that node; if the second version number of any candidate node does not match the first version number or has changed, the corresponding pod is put back into the scheduling queue.

[0095] For example, if the second version number of candidate node1 does not match the first version number, then pod1 corresponding to candidate node1 is put back into the scheduling queue; if the second version number of candidate node1 matches the first version number, then the second version number corresponding to candidate node1 can be updated, and pod1 corresponding to candidate node1 can be bound to it, so that candidate node1 can be used to schedule pod1, and pod1 scheduling ends.

[0096] Understandably, the scheduling process for the other pods to be scheduled can be referenced from that of pod1, and will not be repeated here.

[0097] It should be noted that the above examples are merely illustrative and should not be construed as limiting the scheduling process of containers in the embodiments of this disclosure.

[0098] In this embodiment, the top N pods with the highest priority in the scheduling queue are first identified as pods to be scheduled. Then, N container pods to be scheduled are retrieved from the scheduling queue, and the first version number corresponding to each schedulable node in the cluster is recorded. The first attribute information of each pod to be scheduled is parsed to determine the target resource amount required by each pod. Then, the second attribute information of each node is parsed to determine the available resource amount of each node. If the available resource amount of any node is greater than the target resource amount of the pod to be scheduled, that node is identified as a candidate node corresponding to the pod to be scheduled. If the second version number of the candidate node corresponding to any pod matches the recorded first version number, the candidate node is used to schedule the pod, and the second version number of the candidate node corresponding to the pod is updated. Alternatively, if there is only one candidate node corresponding to any pod, and the second version number of the candidate node does not match the recorded first version number, the pod is placed at the end of the scheduling queue, and the waiting time for the pod to enter the scheduling queue is updated. Therefore, after obtaining N pods to be scheduled and their corresponding candidate nodes, the version number of the candidate node can be checked. If the version number of the candidate node matches, the pod is scheduled using that candidate node. If the version number of the candidate node changes, the pod corresponding to that candidate node is put into the scheduling queue. In other words, through optimistic concurrency control, multi-threaded concurrent pod scheduling can be achieved, thereby improving the cluster scheduling speed without affecting the cluster scheduling quality or changing the user operation method.

[0099] To implement the above embodiments, this disclosure also proposes a container scheduling device.

[0100] Figure 3 This is a schematic diagram of the structure of the container scheduling device provided in an embodiment of this disclosure.

[0101] like Figure 3 As shown, the scheduling device 100 of the container may include: an acquisition module 110, a recording module 120, a traversal module 130, and a processing module 140.

[0102] The acquisition module 110 is used to acquire N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1.

[0103] The recording module 120 is used to record the first version number corresponding to each schedulable node in the cluster.

[0104] The traversal module 130 is used to traverse the second attribute information of each node based on the first attribute information of each pod to be scheduled, so as to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node.

[0105] The processing module 140 is used to schedule any pod using the candidate node when the second version number of the candidate node corresponding to any pod matches the first version number of the record.

[0106] Optionally, the processing module 140 is further configured to:

[0107] Update the second version number of the candidate node corresponding to any of the pods.

[0108] Optionally, the processing module 140 is further configured to:

[0109] If the number of candidate nodes corresponding to any pod is one, and the second version number corresponding to the candidate node does not match the first version number of the record, then place any pod at the end of the scheduling queue.

[0110] Update the waiting time for any pod to enter the scheduling queue.

[0111] Optionally, the traversal module 130 is specifically used for:

[0112] The first attribute information of each pod to be scheduled is parsed to determine the target amount of resources required by each pod to be scheduled.

[0113] The second attribute information of each node is parsed to determine the amount of available resources for each node;

[0114] If the available resources of any node are greater than the target resources of the pod to be scheduled, then that node is determined as a candidate node for the pod to be scheduled.

[0115] Optionally, the acquisition module 110 is specifically used for:

[0116] The top N pods with the longest waiting times in the scheduling queue are identified as the pods to be scheduled; or,

[0117] The top N pods with the highest priority in the queue to be scheduled are identified as the pods to be scheduled.

[0118] The functions and specific implementation principles of the modules described in this embodiment can be found in the above method embodiments, and will not be repeated here.

[0119] The container scheduling device of this disclosure embodiment can first obtain N pods to be scheduled from the scheduling queue. Then, it can record the first version number of each schedulable node in the cluster. Based on the first attribute information of each pod to be scheduled, it iterates through the second attribute information of each node to determine the candidate node and its corresponding second version number. If the second version number of any candidate node matches the recorded first version number, the candidate node is used to schedule that pod. Therefore, after obtaining N pods to be scheduled and their corresponding candidate nodes, the version number of the candidate node can be checked. If the version numbers of the candidate node match in two consecutive iterations, the candidate node is used to schedule the pod. This optimistic concurrency control enables multi-threaded concurrent pod scheduling, thereby improving cluster scheduling speed without affecting the cluster scheduling quality.

[0120] To implement the above embodiments, this disclosure also proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the container scheduling method proposed in the foregoing embodiments of this disclosure.

[0121] To implement the above embodiments, this disclosure also proposes a non-transitory computer-readable storage medium storing a computer program, which, when executed by a processor, implements the container scheduling method proposed in the foregoing embodiments of this disclosure.

[0122] To implement the above embodiments, this disclosure also proposes a computer program product that, when an instruction processor in the computer program product is executed, performs a container scheduling method as proposed in the foregoing embodiments of this disclosure.

[0123] Figure 4 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Figure 4 The computer device 12 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0124] like Figure 4 As shown, the computer device 12 is represented in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and a bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0125] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0126] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0127] Memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this disclosure.

[0128] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this disclosure.

[0129] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with the computer device 12, and / or with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0130] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the foregoing embodiments.

[0131] The technical solution disclosed herein first obtains N container pods to be scheduled from the scheduling queue. Then, it records the first version number of each schedulable node in the cluster. Based on the first attribute information of each pod to be scheduled, it iterates through the second attribute information of each node to determine the candidate node and its corresponding second version number. If the second version number of any candidate node matches the recorded first version number, the candidate node is used to schedule that pod. Therefore, after obtaining N pods to be scheduled and their corresponding candidate nodes, the version number of the candidate node can be checked. If the version numbers of two consecutive candidate nodes match, the candidate node is used to schedule the pod. This optimistic concurrency control enables multi-threaded concurrent pod scheduling, thereby improving cluster scheduling speed without affecting the cluster scheduling quality.

[0132] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0133] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0134] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of this disclosure includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of this disclosure pertain.

[0135] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0136] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0137] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0138] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0139] The storage medium mentioned above may be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.

Claims

1. A method for scheduling containers, characterized in that, include: Get N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1; Record the first version number of each schedulable node in the cluster; Based on the first attribute information of each container pod to be scheduled, the second attribute information of each node is traversed to determine the candidate node corresponding to each container pod to be scheduled and the second version number corresponding to the candidate node; The second version number corresponding to the candidate node is compared with the first version number of the record by the comparison and exchange strategy CAS. If the second version number of any candidate node corresponding to a pod matches the first version number of the record, the candidate node is used to schedule the pod.

2. The method as described in claim 1, characterized in that, After scheduling the pod using the candidate node when the second version number of the candidate node for any pod matches the first version number of the record, the process further includes: Update the second version number of the candidate node corresponding to any of the pods.

3. The method as described in claim 1, characterized in that, After traversing the second attribute information of each node to determine the candidate node corresponding to each container pod to be scheduled and the second version number corresponding to the candidate node, the process further includes: If the number of candidate nodes corresponding to any pod is one, and the second version number corresponding to the candidate node does not match the first version number of the record, then place any pod at the end of the scheduling queue. Update the waiting time for any pod to enter the scheduling queue.

4. The method as described in claim 1, characterized in that, The step of determining the candidate node and the second version number corresponding to each candidate node by traversing the second attribute information of each node based on the first attribute information of each container pod to be scheduled includes: The first attribute information of each of the container pods to be scheduled is parsed to determine the target amount of resources required by each of the container pods to be scheduled. The second attribute information of each node is parsed to determine the amount of available resources for each node; If the available resources of any node are greater than the target resources of the container pod to be scheduled, then that node is determined as a candidate node corresponding to the container pod to be scheduled.

5. The method according to any one of claims 1-4, characterized in that, The step of obtaining N container pods to be scheduled from the queue includes: The top N pods with the longest waiting times in the scheduling queue are identified as the pods to be scheduled; or, The top N pods with the highest priority in the queue to be scheduled are identified as the pods to be scheduled.

6. A container scheduling device, characterized in that, include: The acquisition module is used to acquire N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1; The recording module is used to record the first version number of each schedulable node in the cluster. The traversal module is used to traverse the second attribute information of each node based on the first attribute information of each container pod to be scheduled, so as to determine the candidate node corresponding to each container pod to be scheduled and the second version number corresponding to the candidate node; The processing module is used to schedule any pod using the candidate node when the second version number of the candidate node corresponding to any pod matches the first version number of the record. The device is also used for: The second version number corresponding to the candidate node is compared with the first version number of the record by the comparison and exchange strategy CAS.

7. The apparatus as claimed in claim 6, characterized in that, The processing module is further configured to: Update the second version number of the candidate node corresponding to any of the pods.

8. The apparatus as claimed in claim 6, characterized in that, The processing module is further configured to: If the number of candidate nodes corresponding to any pod is one, and the second version number corresponding to the candidate node does not match the first version number of the record, then place any pod at the end of the scheduling queue. Update the waiting time for any pod to enter the scheduling queue.

9. The apparatus as claimed in claim 6, characterized in that, The traversal module is specifically used for: The first attribute information of each of the container pods to be scheduled is parsed to determine the target amount of resources required by each of the container pods to be scheduled. The second attribute information of each node is parsed to determine the amount of available resources for each node; If the available resources of any node are greater than the target resources of the container pod to be scheduled, then that node is determined as a candidate node corresponding to the container pod to be scheduled.

10. The apparatus according to any one of claims 6-9, characterized in that, The acquisition module is specifically used for: The top N pods with the longest waiting times in the scheduling queue are identified as the pods to be scheduled; or, The top N pods with the highest priority in the queue to be scheduled are identified as the pods to be scheduled.

11. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the container scheduling method as described in any one of claims 1-5.

12. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the container scheduling method as described in any one of claims 1-5.

13. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the container scheduling method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Resource scheduling method and device, electronic equipment and storage medium

    CN110300130A

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

    CN113110938A