WO2024066380A1 - 容器的调度方法、装置及计算机设备 - Google Patents
容器的调度方法、装置及计算机设备 Download PDFInfo
- Publication number
- WO2024066380A1 WO2024066380A1 PCT/CN2023/093927 CN2023093927W WO2024066380A1 WO 2024066380 A1 WO2024066380 A1 WO 2024066380A1 CN 2023093927 W CN2023093927 W CN 2023093927W WO 2024066380 A1 WO2024066380 A1 WO 2024066380A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- scheduled
- pod
- version number
- pods
- node
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 16
- 102100033121 Transcription factor 21 Human genes 0.000 description 29
- 101150109289 tcf21 gene Proteins 0.000 description 28
- 230000006870 function Effects 0.000 description 12
- 230000008569 process Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- 101100491335 Caenorhabditis elegans mat-2 gene Proteins 0.000 description 6
- 101100495256 Caenorhabditis elegans mat-3 gene Proteins 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 101100438971 Caenorhabditis elegans mat-1 gene Proteins 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 3
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 3
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 101100327310 Caenorhabditis elegans emb-27 gene Proteins 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 101100352764 Mus musculus Podn gene Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 101710119687 Transcription factor 21 Proteins 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- -1 pod2 Proteins 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
Definitions
- the present disclosure relates to the field of computer technology, and in particular to a container scheduling method, device and computer equipment.
- clusters are being used more and more widely.
- a large number of container pods may be scheduled in a short time for business computing.
- a large number of pods can be scheduled in a short time by cutting and scoring strategies.
- the cutting and scoring strategies improve the scheduling speed, they may affect the scheduling quality. Therefore, it is very important to improve the cluster scheduling speed without affecting the cluster scheduling quality.
- the present disclosure aims to solve one of the technical problems in the related art at least to some extent.
- the first embodiment of the present disclosure provides a method for scheduling a container, including:
- the candidate node is used to schedule the any pod.
- the second aspect of the present disclosure provides a container scheduling device, including:
- the acquisition module is used to obtain N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1;
- a recording module used to record the first version number currently corresponding to each schedulable node node in the cluster
- a traversal module configured to traverse the second attribute information of each of the nodes based on the first attribute information of each of the pods to be scheduled, so as to determine a candidate node corresponding to each of the pods to be scheduled and a 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 corresponding to the candidate node corresponding to any pod matches the first version number of the record.
- the third aspect of the present disclosure provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor.
- the processor executes the program, the container scheduling method provided in the first aspect of the present disclosure is implemented.
- the fourth aspect embodiment of the present disclosure 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 first aspect embodiment of the present disclosure.
- the fifth aspect of the present disclosure provides a computer program product.
- an instruction processor in the computer program product is executed, the container scheduling method provided by the first aspect of the present disclosure is executed.
- the container scheduling method, device, computer equipment and storage medium provided by the present disclosure can first obtain N container pods to be scheduled from the queue to be scheduled, and then record the first version number currently corresponding to each schedulable node node in the cluster, and based on the first attribute information of each pod to be scheduled, traverse the second attribute information of each node to be scheduled to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node, and use the candidate node to schedule any pod when the second version number corresponding to the candidate node corresponding to any pod matches the recorded first version number.
- the version number of the candidate node can be checked, and when the two version numbers of the candidate node match, the candidate node can be used to schedule the pod, that is, through optimistic concurrency control, multi-threaded concurrent pod scheduling is realized, so that the cluster scheduling speed can be improved without affecting the cluster scheduling quality.
- FIG1 is a schematic diagram of a flow chart of a method for scheduling containers provided in an embodiment of the present disclosure
- FIG2 is a schematic diagram of a flow chart of a method for scheduling containers provided in an embodiment of the present disclosure
- FIG3 is a schematic diagram of a container scheduling process provided by an embodiment of the present disclosure.
- FIG4 is a schematic diagram of the structure of a scheduling device for containers provided in one embodiment of the present disclosure.
- FIG5 shows a block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure.
- the embodiment of the present disclosure takes the container scheduling method being configured in a container scheduling device as an example.
- the container scheduling device can be applied to any computer device so that the computer device can execute the container scheduling function.
- the computer device can be a personal computer (PC), a cloud device, a mobile device, etc.
- the mobile device can be, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a car device, etc., which are hardware devices with various operating systems, touch screens and/or display screens.
- FIG1 is a schematic flow chart of a method for scheduling containers according to an embodiment of the present disclosure.
- the container scheduling method may include the following steps:
- Step 101 Obtain N container pods to be scheduled from a queue to be scheduled, where N is any integer greater than 1.
- 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., which is not limited in this disclosure.
- a pod may be the smallest scheduling unit in a cluster, which may include one or more containers, etc., which is not limited in the present disclosure.
- N may be a pre-set value, such as 3, 5, 10, etc., or may be adjusted as needed, etc., and the present disclosure does not limit this.
- scheduling can be understood as binding a pod to a node, allocating an Internet Protocol address (IP) address, central processing unit (CPU) resources, memory resources, etc. to the pod, and the present disclosure does not limit this.
- IP Internet Protocol address
- CPU central processing unit
- the N pods to be scheduled obtained from the queue to be scheduled can be scheduled by different threads respectively. For example, thread 1 schedules pod 1, thread 2 schedules pod 2, thread 3 schedules pod 3, and so on. Therefore, in the embodiments of the present disclosure, multi-threaded concurrent pod scheduling can be implemented, thereby providing conditions for improving the pod scheduling speed.
- Step 102 Record the first version number currently corresponding to each schedulable node in the cluster.
- the schedulable node node may be a node in a cluster that can satisfy a pod scheduling request, etc., and the present disclosure does not limit this.
- the version number can be the value of a specific field in a node, which can be used to represent the status information of the node. For example, by parsing a specific field in node1, it can be determined that the first version number of node1 is "1"; or, by parsing a specific field in node2, it can be determined that the first version number of node2 is "0", etc., and this disclosure does not limit this.
- the first version number corresponding to the schedulable node node can be determined by parsing a specific field in the schedulable node node, and the first version number can be recorded, and the present disclosure does not limit this.
- Step 103 Based on the first attribute information of each pod to be scheduled, traverse the second attribute information of each node to determine a candidate node corresponding to each pod to be scheduled and a second version number corresponding to the candidate node.
- the first attribute information of the pod may be information such as the target resource amount required by the pod; the second attribute information of the node may be information such as the resource amount currently available at the node, which is not limited in the present disclosure.
- the number of candidate nodes corresponding to any pod to be scheduled may be one, or may be multiple, etc., which is not limited in the present disclosure.
- each pod to be scheduled can be compared with each node based on the first attribute information and the second attribute information.
- the target resource amount of pod1 to be scheduled is X
- the available resource amount of node1 is Y
- Y is greater than X
- node1 can be determined as the candidate node corresponding to pod1 to be scheduled.
- the target resource amount of pod2 to be scheduled is X
- the available resource amount of node2 is Y
- the available resource amount of node3 is Z
- both Y and Z are greater than X
- a specific field in the candidate node can be parsed to determine the corresponding second version number, which will not be described in detail here.
- Step 104 When the second version number corresponding to the candidate node corresponding to any pod matches the recorded first version number, the candidate node is used to schedule any pod.
- the second version number corresponding to the candidate node corresponding to any pod is the same as and consistent with the recorded first version number, it can be considered that the second version number corresponding to the candidate node matches the recorded first version number.
- the candidate node can be used to schedule and process any pod, etc. This disclosure does not limit this.
- the second version number of the candidate node corresponding to any pod may also be updated.
- the candidate node can be used to schedule any pod and the second version number of the candidate node can be updated, for example, it can be updated to "1", etc. This disclosure does not limit this.
- optimistic concurrency control can be used to implement multi-threaded concurrent pod scheduling, thereby improving the pod cluster scheduling speed without affecting the cluster scheduling quality and without changing the user usage mode.
- N container pods to be scheduled can be first obtained from the queue to be scheduled, and then the first version number currently corresponding to each schedulable node node in the cluster can be recorded, and 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 to be scheduled and the second version number corresponding to the candidate node.
- the candidate node can be used to schedule any pod.
- the version number of the candidate node can be checked.
- the candidate node can be used to schedule the pod, that is, through optimistic concurrency control, multi-threaded concurrent pod scheduling can be achieved, so that the cluster scheduling speed can be improved without affecting the cluster scheduling quality.
- FIG. 2 is a flow chart of a method for scheduling containers according to an embodiment of the present disclosure.
- the container scheduling method may include the following steps:
- Step 201 determine the first N pods with high priorities in the queue to be scheduled as pods to be scheduled.
- the priority of the pod can be determined according to the type of task to be processed. For example, for a computing-intensive task, it can be determined as a high priority; for a common task, it can be determined as a low priority, etc., which is not limited in the present disclosure.
- N may be a pre-set value, such as 3, 5, 10, etc., which is not limited in the present disclosure.
- pod1, pod3 and pod4 can be determined as pods to be scheduled, and the present disclosure does not limit this.
- the first N pods with the longest waiting time in the to-be-scheduled queue may also be determined as the pods to be scheduled.
- the waiting time may be the time that the pod enters the queue to be scheduled and waits for scheduling.
- pod1 enters the queue to be scheduled at 09:01
- pod2 enters the queue to be scheduled at 09:03
- pod3 enters the queue to be scheduled at 09:05
- pod4 enters the queue to be scheduled at 09:07
- pod5 enters the queue to be scheduled at 09:08.
- the value of N is 4, if the current time is 09:10, the waiting time of pod1 is 9 minutes, the waiting time of pod2 is 7 minutes, the waiting time of pod3 is 5 minutes, the waiting time of pod4 is 3 minutes, and the waiting time of pod5 is 2 minutes. Then pod1, pod2, pod3 and pod4 can be determined as pods to be scheduled, etc., and the present disclosure does not limit this.
- Step 202 Obtain N container pods to be scheduled from the queue to be scheduled, where N is any integer greater than 1.
- Step 203 Record the first version number currently corresponding to each schedulable node in the cluster.
- step 202 and step 203 can refer to the description of other embodiments of the present disclosure and will not be repeated here.
- Step 204 parse the first attribute information of each pod to be scheduled to determine the target resource amount required by each pod to be scheduled.
- the first attribute information may represent attribute characteristics of the pod to be scheduled, such as the amount of resources, number of CPU cores, network bandwidth, graphics card, hard disk, etc. required for scheduling the pod, which is not limited in the present disclosure.
- first attribute information of each pod to be scheduled may be parsed in any desirable manner to determine the target resource amount required for each pod to be scheduled, and the present disclosure does not limit this.
- Step 205 parse the second attribute information of each node to determine the available resource amount of each node.
- the second attribute information may represent the attribute characteristics of the node, such as the amount of resources that the node can provide, the number of CPU cores, network bandwidth, graphics card, hard disk, etc., which is not limited in the present disclosure.
- the second attribute information of each node may be parsed in any desirable manner to determine the amount of resources and computing power that each node can provide, etc., and the present disclosure does not limit this.
- Step 206 When the available resource amount of any node is greater than the target resource amount of the pod to be scheduled, any node is determined as a candidate node corresponding to the pod to be scheduled.
- the target resource amount of pod1 to be scheduled is X
- the available resource amount of node1 is Y
- Y is greater than X. Then node1 can be determined as the candidate node corresponding to pod1 to be scheduled.
- the number of CPU cores of the pod1 to be scheduled is 12, the number of CPU cores of node1 is 13, and the number of CPU cores of node2 is 10, where 13 is greater than 12.
- node1 can be determined as the candidate node corresponding to the pod1 to be scheduled.
- Step 207 When the second version number corresponding to the candidate node corresponding to any pod matches the recorded first version number, the candidate node is used to schedule any pod.
- Step 208 Update the second version number of the candidate node corresponding to any pod.
- step 207 and step 208 can refer to the description of other embodiments of the present disclosure and will not be repeated here.
- Step 209 When 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 recorded first version number, any pod is placed at the end of the queue to be scheduled.
- the compare and swap (CAS) strategy can be used to verify that the second version number corresponding to the candidate node matches the recorded first version number.
- CAS operation is an optimistic concurrency strategy, which usually means that it can maintain an optimistic attitude and believe that the concurrent execution process will not cause competition problems for shared data. It only checks whether there is competition problem for shared data when modifying the data. If other threads have not modified the shared data during the modification, the modification is successful.
- the second version number corresponding to any candidate node matches the recorded first version number, it can be considered 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 corresponding to any candidate node does not match the recorded first version number, it can be considered that other threads have modified the candidate node, that is, the candidate node may be occupied and may not be able to provide the resources required by the pod, so the pod cannot be bound to the candidate node, then the pod can be put back to the end of the queue to be scheduled to wait for scheduling.
- the specific field in node1 can be parsed to determine the second version number of node1, such as "1". If the first version number recorded in node1 is "0", which does not match the second version number "1" corresponding to node1, it can indicate that node1 may have changed and pod1 may not be scheduled, so pod1 can be put back to the end of the queue to be scheduled.
- the candidate nodes corresponding to pod1 and pod2 are both: node1, and the recorded first version number of node1 is "0".
- the candidate nodes corresponding to pod1 and pod2 are both: node1, and the recorded first version number of node1 is "0".
- the candidate nodes corresponding to pod1 and pod2 are both: node1, and the recorded first version number of node1 is "0".
- the candidate nodes corresponding to pod1 and pod2 are both: node1, and the recorded first version number of node1 is "0".
- the candidate nodes corresponding to pod1 and pod2 are both: node1, and the recorded first version number of node1 is "0".
- Step 210 Update the waiting time for any pod to enter the queue to be scheduled.
- the waiting time for the pod to enter the queue to be scheduled can be updated.
- the candidate node corresponding to each pod to be scheduled can be determined, and then the second version number and the first version number of each candidate node can be matched. If the two match, the pod corresponding to the candidate node is scheduled; if the two do not match, the pod corresponding to the candidate node is put back into the queue to be scheduled. Therefore, through optimistic concurrency control, multi-threaded concurrent pod scheduling can be performed, so that the cluster scheduling speed can be improved without affecting the cluster scheduling quality and without the user changing the method.
- each thread can schedule a corresponding pod.
- N pods to be scheduled can be obtained from the queue to be scheduled, where pod1 is scheduled by thread 1, pod2 is scheduled by thread 2, and podN is scheduled by thread N. Then, a batch of nodes with sufficient resources can be filtered and selected in the cluster, and the first version number of each node can be recorded.
- the second attribute information of each node can be traversed to determine the candidate node corresponding to each pod to be scheduled. Then, the second version number of each candidate node can be detected, and it can be determined whether the second version number of each candidate node matches the first version number, that is, 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 any candidate node is updated, and the corresponding pod is bound to the node; if the second version number of any candidate node does not match the first version number and has changed, the corresponding pod is put back into the queue to be scheduled.
- pod1 corresponding to candidate node1 is put back into the queue to be scheduled; 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 is completed.
- the scheduling process of the above-mentioned pod1 to be scheduled can be referred to, and will not be repeated here.
- the first N pods with high priority in the queue to be scheduled can be determined as the pods to be scheduled, and then N container pods to be scheduled can be obtained from the queue to be scheduled, and the first version number currently corresponding to each schedulable node node in the cluster can be recorded, and the first attribute information of each pod to be scheduled can be parsed to determine the target resource amount required for each pod to be scheduled. Then, the second attribute information of each node can be parsed to determine the available resource amount of each node. When the available resource amount of any node is greater than the target resource amount of the pod to be scheduled, any node can be determined as a candidate node corresponding to the pod to be scheduled.
- any pod can be scheduled using the candidate node, and the second version number of the candidate node corresponding to any pod can be updated; or when 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 recorded first version number, any pod can be placed at the end of the queue to be scheduled, and the waiting time for any pod to enter the queue to be scheduled can be updated.
- the version number of the candidate nodes can be checked.
- the pod corresponding to the candidate node is put into the queue to be scheduled. That is, through optimistic concurrency control, multi-threaded concurrent pod scheduling can be achieved, thereby improving the cluster scheduling speed without affecting the cluster scheduling quality and changing the user operation mode.
- the present disclosure also proposes a container scheduling device.
- FIG. 4 is a schematic diagram of the structure of a scheduling device for a container provided in an embodiment of the present disclosure.
- the container scheduling device 100 may include: an acquisition module 110 , a recording module 120 , a traversal module 130 , and a processing module 140 .
- 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.
- the recording module 120 is used to record the first version number currently corresponding to each schedulable node node in the cluster.
- the traversal module 130 is used to traverse the second attribute information of each of the nodes based on the first attribute information of each of the pods to be scheduled, so as to determine a candidate node corresponding to each of the pods to be scheduled and a second version number corresponding to the candidate node.
- the processing module 140 is used to schedule any pod using the candidate node when the second version number corresponding to the candidate node corresponding to any pod matches the first version number of the record.
- processing module 140 is further configured to:
- the second version number of the candidate node corresponding to any pod is updated.
- processing module 140 is further configured to:
- the any pod is placed at the end of the queue to be scheduled;
- the waiting time for any pod to enter the queue to be scheduled is updated.
- the traversal module 130 is specifically used to:
- the any node is determined as a candidate node corresponding to the pod to be scheduled.
- the acquisition module 110 is specifically used to:
- the first N pods with high priorities in the to-be-scheduled queue are determined as the pods to be scheduled.
- the container scheduling device of the embodiment of the present disclosure can first obtain N container pods to be scheduled from the queue to be scheduled, and then record the first version number currently corresponding to each schedulable node node in the cluster, and 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.
- the second version number corresponding to the candidate node corresponding to any pod matches the recorded first version number
- the candidate node is used to schedule any pod. Therefore, after obtaining N pods to be scheduled and the corresponding candidate nodes, the version number of the candidate node can be checked. When the two version numbers of the candidate node match, the candidate node is used to schedule the pod. That is, through optimistic concurrency control, multi-threaded concurrent pod scheduling is achieved, thereby improving the cluster scheduling speed without affecting the cluster scheduling quality.
- the present disclosure further proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor.
- a computer device including: a memory, a processor, and a computer program stored in the memory and executable on the processor.
- the processor executes the program, the scheduling method for the container proposed in the above embodiments of the present disclosure is implemented.
- the present disclosure further 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 above embodiments of the present disclosure.
- the present disclosure further proposes a computer program product.
- an instruction processor in the computer program product is executed, the container scheduling method proposed in the above embodiments of the present disclosure is executed.
- Fig. 5 shows a block diagram of an exemplary computer device suitable for implementing the embodiments of the present disclosure.
- the computer device 12 shown in Fig. 5 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
- the computer device 12 is 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, a system memory 28, and a bus 18 connecting various system components (including the system memory 28 and the processing unit 16).
- Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures.
- these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
- ISA Industry Standard Architecture
- MAC Micro Channel Architecture
- VESA Video Electronics Standards Association
- PCI Peripheral Component Interconnection
- the computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
- the memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (Random Access Memory; hereinafter referred to as: RAM) 30 and/or cache memory 32.
- RAM random access memory
- the computer device 12 may further include other removable/non-removable, volatile/non-volatile computer system storage media.
- the storage system 34 may be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 5, usually referred to as a "hard drive").
- each drive may be connected to the bus 18 via one or more data medium interfaces.
- the memory 28 may include at least one program product having a set (for example, at least one) of program modules, which are configured to execute various embodiments of the present disclosure. Example function.
- a program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
- the program modules 42 generally perform the functions and/or methods of the embodiments described in the present disclosure.
- the computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input/output (I/O) interface 22.
- the computer device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer device 12 through a bus 18.
- LAN local area network
- WAN wide area network
- public network such as the Internet
- 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 above embodiments.
- the technical solution disclosed in the present invention can first obtain N container pods to be scheduled from the queue to be scheduled, and then record the first version number currently corresponding to each schedulable node node in the cluster, and based on the first attribute information of each pod to be scheduled, traverse the second attribute information of each node to be scheduled to determine the candidate node corresponding to each pod to be scheduled and the second version number corresponding to the candidate node.
- the second version number corresponding to the candidate node corresponding to any pod matches the recorded first version number, use the candidate node to schedule any pod. Therefore, after obtaining N pods to be scheduled and the corresponding candidate nodes, the version number of the candidate node can be checked.
- the candidate node can be used to schedule the pod, that is, through optimistic concurrency control, multi-threaded concurrent pod scheduling is realized, so that the cluster scheduling speed can be improved without affecting the cluster scheduling quality.
- first and second are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as “first” or “second” may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality” is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
- Any process or method description in a flowchart or otherwise described herein may be understood to mean a process that includes one or more More modules, fragments or portions of code of executable instructions for implementing steps of customized logical functions or processes, and the scope of the preferred embodiments of the present disclosure includes additional implementations, in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.
- the logic and/or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses.
- "computer-readable medium” can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses.
- computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM).
- the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
- any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
- PGA programmable gate array
- FPGA field programmable gate array
- each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
- the above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
- the storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种容器的调度方法包括:从待调度队列中获取N个待调度的容器pod;记录集群中每个可调度节点node当前对应的第一版本号;基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node及候选node对应的第二版本号;在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对所述任一pod进行调度处理。
Description
相关申请的交叉引用
本申请基于申请号为202211174579.4、申请日为2022年9月26日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
本公开涉及计算机技术领域,尤其涉及一种容器的调度方法、装置及计算机设备。
随着计算机技术的快速发展,集群也应用的越来越广泛。通常,在离在线混部、离线任务等场景下,可能存在短时间调度大量容器pod进行业务计算的情况。相关技术中,可以通过裁剪打分策略,来实现短时间调度大量pod,虽然通过裁剪打分策略提高了调度速度,但可能会影响调度质量。由此,在不影响集群调度质量的情况下,如何提高集群调度速度,显得至关重要。
发明内容
本公开旨在至少在一定程度上解决相关技术中的技术问题之一。
本公开第一方面实施例提出了一种容器的调度方法,包括:
从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数;
记录所述集群中每个可调度节点node当前对应的第一版本号;
基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号;
在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理。
本公开第二方面实施例提出了一种容器的调度装置,包括:
获取模块,用于从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数;
记录模块,用于记录所述集群中每个可调度节点node当前对应的第一版本号;
遍历模块,用于基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号;
处理模块,用于在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理。
本公开第三方面实施例提出了一种计算机设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时,实现如本公开第一方面实施例提出的容器的调度方法。
本公开第四方面实施例提出了一种非临时性计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现如本公开第一方面实施例提出的容器的调度方法。
本公开第五方面实施例提出了一种计算机程序产品,当所述计算机程序产品中的指令处理器执行时,执行本公开第一方面实施例提出的容器的调度方法。
本公开提供的容器的调度方法、装置、计算机设备及存储介质,可以先从待调度队列中获取N个待调度的容器pod,之后可以记录集群中每个可调度节点node当前对应的第一版本号,并基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node及候选node对应的第二版本号,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。由此,在获取N个待调度pod及对应的候选node之后,可以对候选node的版本号进行检验,在候选node前后两次版本号匹配的情况,利用该候选node对该pod进行调度处理,也即通过乐观并发控制,实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,提高集群调度速度。
本公开附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本公开的实践了解到。
本公开上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:
图1为本公开一实施例所提供的容器的调度方法的流程示意图;
图2为本公开一实施例所提供的容器的调度方法的流程示意图;
图3为本公开一实施例所提供的容器的调度过程的示意图;
图4为本公开一实施例所提供的容器的调度装置的结构示意图;
图5示出了适于用来实现本公开实施方式的示例性计算机设备的框图。
下面详细描述本公开的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本公开,而不能理解为对本公开的限制。
下面参考附图描述本公开实施例的容器的调度方法、装置、计算机设备和存储介质。
本公开实施例以该容器的调度方法被配置于容器的调度装置中来举例说明,该容器的调度装置可以应用于任一计算机设备中,以使该计算机设备可以执行容器的调度功能。
其中,计算机设备可以为个人电脑(Personal Computer,简称PC)、云端设备、移动设备等,移动设备例如可以为手机、平板电脑、个人数字助理、穿戴式设备、车载设备等具有各种操作系统、触摸屏和/或显示屏的硬件设备。
图1为本公开实施例所提供的容器的调度方法的流程示意图。
如图1所示,该容器的调度方法可以包括以下步骤:
步骤101,从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数。
其中,待调度队列中可以包含一个或多个pod,该待调度队列可以为容器集群管理系统(kubernetes,k8s)中的队列,或者也可以为其他任意集群中的队列等等,本公开对此不做限定。
另外,pod可以为集群中最小的调度单元,其中可以包含一个或多个容器等等,本公开对此不做限定。
另外,N可以为提前设定的数值,比如可以为3、5、10等等,或者也可以根据需要进行调整等等,本公开对此不做限定。
另外,调度可以理解为将pod绑定到node,给pod分配网际协议地址(internet protocol address,IP)地址、中央处理器(central processing unit,CPU)资源、内存资源等等,本公开对此不做限定。
在一些实施例中,待调度队列中获取的N个待调度pod,可以分别由不同的线程调度。比如,线程1调度pod1、线程2调度pod2、线程3调度pod3等等。从而,本公开实施例中,可以实现多线程并发进行pod调度,从而为提高pod调度速度提供了条件。
步骤102,记录集群中每个可调度节点node当前对应的第一版本号。
其中,可调度节点node,可以为在一个集群中,可以满足pod调度请求的节点等,本公开对此不做限定。
另外,版本号,可以为node中特定字段的取值,其可以用于表征node的状态信息。比如,通过对node1中的特定字段进行解析,可以确定该node1的第一版本号为“1”;或者,通过对node2中的特定字段进行解析,可以确定该node2的第一版本号为“0”等等,本公开对此不做限定。
从而,本公开实施例中,可以通过对可调度节点node中的特定字段进行解析,以确定可调度节点node对应的第一版本号,并将其进行记录,本公开对此不做限定。
步骤103,基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node及候选node对应的第二版本号。
其中,pod的第一属性信息,可以为pod所需的目标资源量等信息;node的第二属性信息,可以为node当前可提供的资源量等,本公开对此不做限定。
另外,任一待调度pod对应的候选node的数量,可以为一个,或者也可以为多个等等,本公开对此不做限定。
举例来说,在确定出每个待调度pod的第一属性信息及每个node的第二属性信息,可以基于第一属性信息、第二属性信息,将各个待调度pod与各个node进行比对。比如,待调度pod1的目标资源量为X,node1的可用资源量为Y,Y大于X,那么可以将node1确定为该待调度pod1对应的候选node。或者,待调度pod2的目标资源量为X,node2的可用资源量为Y,node3的可用资源量为Z,Y和Z均大于X,那么可以将node2、node3确定为该待调度pod2对应的候选node。
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中待调度pod的第一属性信息、node的第二属性信息以及候选node等的限定。
可以理解的是,在确定出待调度pod对应的候选node之后,可以对该候选node中的特定字段进行解析,以确定对应的第二版本号,此处不再赘述。
步骤104,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。
可以理解的是,若任一pod对应的候选node对应的第二版本号与记录的第一版本号相同、保持一致,可以认为该候选node对应的第二版本号与记录的第一版本号匹配。
举例来说,若任一pod对应的候选node对应的第二版本号为“1”,该候选node记录的第一版本号也为“1”,那么可以表明该候选node当前处于可用状态,可以利用该候选node对该任一pod进行调度处理等等,本公开对此不做限定。
在一些实施例中,在利用候选node对任一pod进行调度处理之后,还可以将任一pod对应的候选node的第二版本号进行更新。
其中,将候选node的第二版本号进行更新的方式有多种,比如可以将第二版本号进行加一,以作为更新后的版本号;或者还可以按照特定规则,将第二版本号进行更新等等,本公开对此不做限定。
举例来说,若任一pod对应的候选node对应的第二版本号为“0”,该候选node记录的第一版本号也为“0”,那么可以利用该候选node对该任一pod进行调度处理,并将该候选node的第二版本号进行更新,比如可以将其更新为“1”等等,本公开对此不做限定。
从而,本公开实施例中,可以通过乐观并发控制,实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,也不需要改变用户使用方式,提高pod集群调度速度。
本公开实施例,可以先从待调度队列中获取N个待调度的容器pod,之后可以记录集群中每个可调度节点node当前对应的第一版本号,并基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node及候选node对应的第二版本号,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。由此,在获取N个待调度pod及对应的候选node之后,可以对候选node的版本号进行检验,在任一pod对应的候选node前后两次版本号匹配的情况下,可以利用该候选node对该pod进行调度处理,也即通过乐观并发控制,实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,提高集群调度速度。
图2为本公开实施例所提供的容器的调度方法的流程示意图。
如图2所示,该容器的调度方法可以包括以下步骤:
步骤201,将待调度队列中优先级高的前N个pod确定为待调度的pod。
其中,pod的优先级,可以根据待处理的任务类型确定。比如,对于计算密集型任务,可以确定其为高优先级;对于普通型任务,可以确定其为低优先级等等,本公开对此不做限定。
另外,N可以为提前设定的数值,比如可以为3、5、10等等,本公开对此不做限定。
举例来说,在N的取值为3的情况下,若待调度队列中共有7个待调度pod,其中,pod1和pod3为高优先级,pod4为中优先级,pod2、pod5、pod6和pod7均为低优先级,可以将pod1、pod3以及pod4确定为待调度pod等等,本公开对此不做限定。
在一些实施例中,也可以将待调度队列中等待时长最长的前N个pod确定为待调度的pod。
其中,等待时长,可以为pod在进入待调度队列中、等待调度的时长。
举例来说,pod1在09:01进入待调度队列中,pod2在09:03进入待调度队列中,pod3在09:05进入待调度队列中,pod4在09:07进入待调度队列中,pod5在09:08进入待调度队列中。在N的取值为4的情况下,若当前时刻为09:10,那么pod1的等待时长为9分钟,pod2的等待时长为7分钟,pod3的等待时长为5分钟,pod4的等待时长为3分钟,pod5的等待时长为2分钟,那么可以将pod1、pod2、pod3以及pod4确定为待调度pod等等,本公开对此不做限定。
步骤202,从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数。
步骤203,记录集群中每个可调度节点node当前对应的第一版本号。
需要说明的是,步骤202和步骤203的具体内容及实现方式,可以参照本公开其他各实施例的说明,此处不再赘述。
步骤204,将每个待调度pod的第一属性信息进行解析,以确定每个待调度pod所需的目标资源量。
其中,第一属性信息,可以表征待调度pod的属性特征,比如可以为调度该pod所需的资源量、CPU核数、网络带宽、显卡、硬盘等等,本公开对此不做限定。
需要说明的是,可以采用任何可取的方式将每个待调度pod的第一属性信息进行解析,以确定每个待调度pod所需的目标资源量,本公开对此不做限定。
步骤205,将每个node的第二属性信息进行解析,以确定每个node的可用资源量。
其中,第二属性信息,可以表征node的属性特征,比如可以为node可提供的资源量、CPU核数、网络带宽、显卡、硬盘等等,本公开对此不做限定。
需要说明的是,可以采用任何可取的方式将每个node的第二属性信息进行解析,以确定每个node可提供的资源量、可提供的计算量等等,本公开对此不做限定。
步骤206,在任一node的可用资源量大于待调度pod的目标资源量的情况下,将任一node确定为待调度pod对应的候选node。
举例来说,待调度pod1的目标资源量为X,node1的可用资源量为Y,Y大于X,那么可以将node1确定为该待调度pod1对应的候选node。
或者,待调度pod1的CPU核数为12,node1的CPU核数为13,node2的CPU核数为10,其中13大于12,那么可以将node1确定为该待调度pod1对应的候选node。
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中待调度pod的第一属性信息、node的第二属性信息以及候选node等的限定。
步骤207,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。
步骤208,将任一pod对应的候选node的第二版本号进行更新。
需要说明的是,步骤207和步骤208的具体内容及实现方式,可以参照本公开其他各实施例的说明,此处不再赘述。
步骤209,在任一pod对应的候选node的数量为一个、且候选node对应的第二版本号与记录的第一版本号不匹配的情况下,将任一pod放至待调度队列的末尾位置。
在一些实施例中,可以通过比较并交换策略(compare and swap,CAS)对候选node对应的第二版本号与记录的第一版本号匹配进行检验。
其中,CAS操作是一种乐观的并发策略,通常指的是它可以保持乐观的态度,认为并发执行过程不会对共享数据出现竞争问题,只在修改数据的时候检查共享数据是否出现竞争问题,如果在修改的时候其他的线程没有修改过该共享数据,则修改成功。
从而,若任一候选node对应的第二版本号与记录的第一版本号匹配,可以认为没有其他线程修改过该候选node,可以将候选node与对应的pod进行绑定。若任一候选node对应的第二版本号与记录的第一版本号不匹配时,可以认为有其他线程已经对该候选node进行修改,也即该候选node可能已被占用、其可能无法提供pod所需的资源,从而pod无法与该候选node进行绑定,那么可以将该pod重新放回待调度队列的末尾位置,以等待调度。
举例来说,若任一pod1对应的候选node为:node1,之后可以对node1中的特定字段进行解析,以确定该node1的第二版本号,比如可以为“1”。若该node1记录的第一版本号为“0”,其与node1对应的第二版本号“1”不匹配,那么可以表明node1可能已经发生改变,可能无法对pod1进行调度,那么可以将pod1放回待调度队列的末尾位置。
或者,pod1和pod2对应的候选node均为:node1、且记录的node1的第一版本号均为“0”。比如,先获取pod1对应的node1当前的第二版本号,其为“0”,与记录的第一版本号“0”匹配,那么可以将pod1与node1进行绑定,以利用node1对pod1进行调度处理;并将node1的第二版本号进行更新,比如可以更新为“1”。之后对于pod2,此时可以通过对node1进行解析,获取当前的第二版本号“1”,其与记录的第一版本号“0”不匹配,那么可以将pod2放至待调度队列的末尾位置。
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中候选node的第二版本号及第一版本号等的限定。
步骤210,将任一pod进入待调度队列的等待时长进行更新。
可以理解的是,若任一pod被重新放回待调度队列,此时可以对该任一pod进入待调度队列的等待时长进行更新。
举例来说,pod1在重新进入待调度队列之前的等待时长为:T1,在该pod1被重新放至待调度队列的末尾位置后,可以继续在T1的基础上确定其等待时间。比如,pod1第一次在待调度队列中的等待时长为T1,在t0时刻被重新放至待调度队列的末尾位置,若当前时刻为t1时刻,那么当前时刻pod1的等待时长为:T1+(t1-t0)等等,本公开对此不做限定。
从而,本公开实施例中,在获取N个待调度pod后,可以确定每个待调度pod对应的候选node,之后可以对每个候选node的第二版本号及第一版本号进行匹配,在二者匹配的情况下,对该候选node对应的pod进行调度处理;在二者不匹配的情况下,将该候选node对应的pod放回待调度队列中。由此,通过乐观并发控制,可以多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,也无需用户改变方式,即可提高集群调度速度。
需要说明的是,本公开提供的容器的调度方法,可以适用于任意容器调度场景中。
下面结合图3对本公开提供的容器的调度过程进行说明。
可以理解的是,在多线程场景下,每个线程可以对应调度一个pod。如图3所示,可以先从待调度队列中获取N个待调度pod,其中,pod1由线程1调度、pod2由线程2调度、……、podN由线程N调度,之后可以在集群中过滤选取资源足够的一批node,并记录每个node的第一版本号。
之后可以基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node。之后可以检测每个候选node的第二版本号,并判断每个候选node的第二版本号是否与第一版本号匹配,也即候选node的版本号是否发生变化。在任一候选node的第二版本号与第一版本号匹配、未发生变化的情况下,更新该任一候选node的第二版本号,并将对应的pod与该任一node进行绑定;在任一候选node的第二版本号与第一版本号不匹配、发生变化的情况下,将对应的pod放回待调度队列。
比如,候选node1的第二版本号与第一版本号不匹配,那么将该候选node1对应的pod1重新放入待调度队列中;若候选node1的第二版本号与第一版本号匹配,那么可以将该候选node1对应的第二版本号进行更新,并将该候选node1对应的pod1与其进行绑定,以利用候选node1对该pod1进行调度处理,pod1调度结束。
可以理解的是,对于其余各个待调度pod,可以参照上述待调度pod1的调度过程,此处不再赘述。
需要说明的是,上述示例只是示意性说明,不能作为对本公开实施例中对容器的调度过程等的限定。
本公开实施例,可以先将待调度队列中优先级高的前N个pod确定为待调度的pod,之后从待调度队列中获取N个待调度的容器pod,并记录集群中每个可调度节点node当前对应的第一版本号,将每个待调度pod的第一属性信息进行解析,以确定每个待调度pod所需的目标资源量,之后可以将每个node的第二属性信息进行解析,以确定每个node的可用资源量,在任一node的可用资源量大于待调度pod的目标资源量的情况下,将任一node确定为待调度pod对应的候选node,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理,并将任一pod对应的候选node的第二版本号进行更新;或者在任一pod对应的候选node的数量为一个、且候选node对应的第二版本号与记录的第一版本号不匹配的情况下,将任一pod放至待调度队列的末尾位置,并将任一pod进入待调度队列的等待时长进行更新。由此,在获取N个待调度pod及对应的候选node之后,可以对候选node的版本号进行检验,在候选node版本号匹配的
情况,利用该候选node对该pod进行调度处理,在候选node的版本号发生变化的情况下,将该候选node对应的pod放入待调度队列,也即通过乐观并发控制,可以实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,无需改变用户操作方式,即可提高集群调度速度。
为了实现上述实施例,本公开还提出一种容器的调度装置。
图4为本公开实施例所提供的容器的调度装置的结构示意图。
如图4所示,该容器的调度装置100可以包括:获取模块110、记录模块120、遍历模块130、及处理模块140。
其中,获取模块110,用于从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数。
记录模块120,用于记录所述集群中每个可调度节点node当前对应的第一版本号。
遍历模块130,用于基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号。
处理模块140,用于在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理。
在一些实施例中,所述处理模块140,还用于:
将所述任一pod对应的候选node的第二版本号进行更新。
在一些实施例中,所述处理模块140,还用于:
在任一pod对应的候选node的数量为一个、且所述候选node对应的第二版本号与所述记录的第一版本号不匹配的情况下,将所述任一pod放至所述待调度队列的末尾位置;
将所述任一pod进入所述待调度队列的等待时长进行更新。
在一些实施例中,所述遍历模块130,具体用于:
将每个所述待调度pod的第一属性信息进行解析,以确定每个所述待调度pod所需的目标资源量;
将每个所述node的第二属性信息进行解析,以确定每个所述node的可用资源量;
在任一node的可用资源量大于所述待调度pod的目标资源量的情况下,将所述任一node确定为所述待调度pod对应的候选node。
在一些实施例中,所述获取模块110,具体用于:
将所述待调度队列中等待时长最长的前N个pod确定为待调度的pod;或者,
将所述待调度队列中优先级高的前N个pod确定为待调度的pod。
本公开实施例中的上述各模块的功能及具体实现原理,可参照上述各方法实施例,此处不再赘述。
本公开实施例的容器的调度装置,可以先从待调度队列中获取N个待调度的容器pod,之后可以记录集群中每个可调度节点node当前对应的第一版本号,并基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node
及候选node对应的第二版本号,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。由此,在获取N个待调度pod及对应的候选node之后,可以对候选node的版本号进行检验,在候选node前后两次版本号匹配的情况,利用该候选node对该pod进行调度处理,也即通过乐观并发控制,实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,提高集群调度速度。
为了实现上述实施例,本公开还提出一种计算机设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时,实现如本公开前述实施例提出的容器的调度方法。
为了实现上述实施例,本公开还提出一种非临时性计算机可读存储介质,存储有计算机程序,计算机程序被处理器执行时实现如本公开前述实施例提出的容器的调度方法。
为了实现上述实施例,本公开还提出一种计算机程序产品,当计算机程序产品中的指令处理器执行时,执行如本公开前述实施例提出的容器的调度方法。
图5示出了适于用来实现本公开实施方式的示例性计算机设备的框图。图5显示的计算机设备12仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图5所示,计算机设备12以通用计算设备的形式表现。计算机设备12的组件可以包括但不限于:一个或者多个处理器或者处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry Standard Architecture;以下简称:ISA)总线,微通道体系结构(Micro Channel Architecture;以下简称:MAC)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association;以下简称:VESA)局域总线以及外围组件互连(Peripheral Component Interconnection;以下简称:PCI)总线。
计算机设备12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被计算机设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
存储器28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(Random Access Memory;以下简称:RAM)30和/或高速缓存存储器32。计算机设备12可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(图5未显示,通常称为“硬盘驱动器”)。尽管图5中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如:光盘只读存储器(Compact Disc Read Only Memory;以下简称:CD-ROM)、数字多功能只读光盘(Digital Video Disc Read Only Memory;以下简称:DVD-ROM)或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本公开各实施
例的功能。
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如存储器28中,这样的程序模块42包括但不限于操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本公开所描述的实施例中的功能和/或方法。
计算机设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该计算机设备12交互的设备通信,和/或与使得该计算机设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口22进行。并且,计算机设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(Local Area Network;以下简称:LAN),广域网(Wide Area Network;以下简称:WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与计算机设备12的其它模块通信。应当明白,尽管图中未示出,可以结合计算机设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。
处理单元16通过运行存储在系统存储器28中的程序,从而执行各种功能应用以及数据处理,例如实现前述实施例中提及的方法。
本公开的技术方案,可以先从待调度队列中获取N个待调度的容器pod,之后可以记录集群中每个可调度节点node当前对应的第一版本号,并基于每个待调度pod的第一属性信息,遍历每个node的第二属性信息,以确定每个待调度pod对应的候选node及候选node对应的第二版本号,在任一pod对应的候选node对应的第二版本号与记录的第一版本号匹配的情况下,利用候选node对任一pod进行调度处理。由此,在获取N个待调度pod及对应的候选node之后,可以对候选node的版本号进行检验,在候选node前后两次版本号匹配的情况,利用该候选node对该pod进行调度处理,也即通过乐观并发控制,实现多线程并发进行pod调度,从而可以在不影响集群调度质量的情况下,提高集群调度速度。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本公开的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本公开的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或
更多个用于实现定制逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本公开的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本公开的实施例所属技术领域的技术人员所理解。
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。
应当理解,本公开的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。如,如果用硬件来实现和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。
此外,在本公开各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。尽管上面已经示出和描述了本公开的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本公开的限制,本领域的普通技术人员在本公开的范围内可以对上述实施例进行变化、修改、替换和变型。
Claims (13)
- 一种容器的调度方法,包括:从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数;记录集群中每个可调度节点node当前对应的第一版本号;基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号;在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理。
- 如权利要求1所述的方法,其中,在所述在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理之后,还包括:将所述任一pod对应的候选node的第二版本号进行更新。
- 如权利要求1或2所述的方法,其中,在所述遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号之后,还包括:在任一pod对应的候选node的数量为一个、且所述候选node对应的第二版本号与所述记录的第一版本号不匹配的情况下,将所述任一pod放至所述待调度队列的末尾位置;将所述任一pod进入所述待调度队列的等待时长进行更新。
- 如权利要求1-3中任一项所述的方法,其中,所述基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号,包括:将每个所述待调度pod的第一属性信息进行解析,以确定每个所述待调度pod所需的目标资源量;将每个所述node的第二属性信息进行解析,以确定每个所述node的可用资源量;在任一node的可用资源量大于所述待调度pod的目标资源量的情况下,将所述任一node确定为所述待调度pod对应的候选node。
- 如权利要求1-4中任一项所述的方法,其中,所述从待调度队列中获取N个待调度的容器pod,包括:将所述待调度队列中等待时长最长的前N个pod确定为待调度的pod;或者,将所述待调度队列中优先级高的前N个pod确定为待调度的pod。
- 一种容器的调度装置,包括:获取模块,用于从待调度队列中获取N个待调度的容器pod,其中,N为大于1的任意整数;记录模块,用于记录所述集群中每个可调度节点node当前对应的第一版本号;遍历模块,用于基于每个所述待调度pod的第一属性信息,遍历每个所述node的第二属性信息,以确定每个所述待调度pod对应的候选node及所述候选node对应的第二版本号;处理模块,用于在任一pod对应的候选node对应的第二版本号与所述记录的第一版本号匹配的情况下,利用所述候选node对所述任一pod进行调度处理。
- 如权利要求6所述的装置,其中,所述处理模块,还用于:将所述任一pod对应的候选node的第二版本号进行更新。
- 如权利要求6或7所述的装置,其中,所述处理模块,还用于:在任一pod对应的候选node的数量为一个、且所述候选node对应的第二版本号与所述记录的第一版本号不匹配的情况下,将所述任一pod放至所述待调度队列的末尾位置;将所述任一pod进入所述待调度队列的等待时长进行更新。
- 如权利要求6-8中任一项所述的装置,其中,所述遍历模块,具体用于:将每个所述待调度pod的第一属性信息进行解析,以确定每个所述待调度pod所需的目标资源量;将每个所述node的第二属性信息进行解析,以确定每个所述node的可用资源量;在任一node的可用资源量大于所述待调度pod的目标资源量的情况下,将所述任一node确定为所述待调度pod对应的候选node。
- 如权利要求6-9中任一项所述的装置,其中,所述获取模块,具体用于:将所述待调度队列中等待时长最长的前N个pod确定为待调度的pod;或者,将所述待调度队列中优先级高的前N个pod确定为待调度的pod。
- 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时,实现如权利要求1-5中任一项所述的容器的调度方法。
- 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1-5中任一项所述的容器的调度方法。
- 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现如权利要求1-5中任一项所述的容器的调度方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211174579.4A CN115576685A (zh) | 2022-09-26 | 2022-09-26 | 容器的调度方法、装置及计算机设备 |
CN202211174579.4 | 2022-09-26 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024066380A1 true WO2024066380A1 (zh) | 2024-04-04 |
Family
ID=84582329
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/093927 WO2024066380A1 (zh) | 2022-09-26 | 2023-05-12 | 容器的调度方法、装置及计算机设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115576685A (zh) |
WO (1) | WO2024066380A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115576685A (zh) * | 2022-09-26 | 2023-01-06 | 京东科技信息技术有限公司 | 容器的调度方法、装置及计算机设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727512A (zh) * | 2019-09-30 | 2020-01-24 | 星环信息科技(上海)有限公司 | 集群资源调度方法、装置、设备及储存介质 |
CN112783613A (zh) * | 2019-11-07 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | 一种单元调度的方法和装置 |
US20210303344A1 (en) * | 2020-03-25 | 2021-09-30 | EMC IP Holding Company LLC | Task processing method, electronic device, and computer program product |
US20220188192A1 (en) * | 2020-12-10 | 2022-06-16 | International Business Machines Corporation | Identifying harmful containers |
CN115576685A (zh) * | 2022-09-26 | 2023-01-06 | 京东科技信息技术有限公司 | 容器的调度方法、装置及计算机设备 |
-
2022
- 2022-09-26 CN CN202211174579.4A patent/CN115576685A/zh active Pending
-
2023
- 2023-05-12 WO PCT/CN2023/093927 patent/WO2024066380A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727512A (zh) * | 2019-09-30 | 2020-01-24 | 星环信息科技(上海)有限公司 | 集群资源调度方法、装置、设备及储存介质 |
CN112783613A (zh) * | 2019-11-07 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | 一种单元调度的方法和装置 |
US20210303344A1 (en) * | 2020-03-25 | 2021-09-30 | EMC IP Holding Company LLC | Task processing method, electronic device, and computer program product |
US20220188192A1 (en) * | 2020-12-10 | 2022-06-16 | International Business Machines Corporation | Identifying harmful containers |
CN115576685A (zh) * | 2022-09-26 | 2023-01-06 | 京东科技信息技术有限公司 | 容器的调度方法、装置及计算机设备 |
Also Published As
Publication number | Publication date |
---|---|
CN115576685A (zh) | 2023-01-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7987160B2 (en) | Status tool to expose metadata read and write queues | |
JP5344460B2 (ja) | 編集装置、編集プログラム、および編集方法 | |
JPH09505191A (ja) | 複数データ・ストリームおよび実時間タスクの同期およびスケジューリングの方法および装置 | |
WO2024066380A1 (zh) | 容器的调度方法、装置及计算机设备 | |
CN113886162B (zh) | 一种计算设备性能测试方法、计算设备及存储介质 | |
US20060107261A1 (en) | Providing Optimal Number of Threads to Applications Performing Multi-tasking Using Threads | |
CN110389957A (zh) | 基于分库分表的文件生成方法、装置、存储介质及设备 | |
US20230251979A1 (en) | Data processing method and apparatus of ai chip and computer device | |
CN114827048B (zh) | 一种动态可配高性能队列调度方法、系统、处理器及协议 | |
CN112163038A (zh) | 跨集群数据同步方法、装置、设备及存储介质 | |
JPH10232824A (ja) | 可搬形記録媒体アクセス方法 | |
WO2024103927A1 (zh) | 混合部署场景下的作业调度方法、装置及电子设备 | |
US10198784B2 (en) | Capturing commands in a multi-engine graphics processing unit | |
US20150089167A1 (en) | Tracking ownership of memory in a data processing system through use of a memory monitor | |
US8060885B2 (en) | Creating task queries for concrete resources using alias selection fields specifying formal resources and formal relationships | |
WO2024119930A1 (zh) | 调度方法、装置、计算机设备和存储介质 | |
CN113535087A (zh) | 数据迁移过程中的数据处理方法、服务器及存储系统 | |
CN116670661A (zh) | 图形处理器的缓存访问方法、图形处理器及电子设备 | |
CN116893854A (zh) | 指令资源的冲突检测方法、装置、设备及存储介质 | |
US20080281576A1 (en) | Interface board, simulator, synchronization method, and synchronization program | |
CN104750547B (zh) | 虚拟机的输入输出io请求处理方法及装置 | |
CN112181737B (zh) | 消息处理方法、装置、电子设备及介质 | |
CN117093335A (zh) | 分布式存储系统的任务调度方法及装置 | |
US11977917B2 (en) | Apparatus for data processing for simultaneously preforming artificial intelligence function processing and data collection and method therefor | |
US9251100B2 (en) | Bitmap locking using a nodal lock |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23869635 Country of ref document: EP Kind code of ref document: A1 |