Resource allocation method, device and system for cluster

By dividing nodes in the cluster into a set of nodes with the same number of asynchronous scheduling threads and allocating resources according to specific conditions, the problem of low resource allocation efficiency in the existing technology is solved, and faster and more efficient resource allocation is achieved.

CN113760502BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110142260.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-02
Publication Date
2025-03-18
Estimated Expiration
2041-02-02

AI Technical Summary

Technical Problem

In the prior art, asynchronous scheduling threads traverse all nodes in the cluster for resource allocation, resulting in long resource allocation time and low efficiency. Especially in the case of resource tightness, it may be necessary to traverse to the last node before knowing whether there are nodes that can meet resource allocation.

Method used

Multiple nodes are divided into a set of nodes with the same number as multiple asynchronous scheduling threads. Each asynchronous scheduling thread corresponds to a set of nodes. After receiving the resource allocation request, each asynchronous scheduling thread is scheduled to determine whether the first resource allocation condition is met, and when the conditions are met, whether the nodes in its corresponding node set meet the second resource allocation condition, and finally allocate resources to the nodes that meet the conditions.

Benefits of technology

Through this method, the resource allocation efficiency of the cluster is improved and the time for resource allocation is reduced. Especially in the case of resource tightness, nodes that meet resource allocation requirements can be found more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760502B_ABST
    Figure CN113760502B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a resource allocation method, device and system for a cluster. The cluster includes multiple nodes, the multiple nodes are divided into multiple node sets that are the same as the total number of multiple asynchronous scheduling threads, and one asynchronous scheduling thread corresponds to one node set. The resource allocation method includes: receiving a resource allocation request, the resource allocation request includes the number of resources to be allocated; according to the resource allocation request, scheduling each asynchronous scheduling thread in the multiple asynchronous scheduling threads to perform the following steps: judging whether each asynchronous scheduling thread meets a first resource allocation condition, and if each asynchronous scheduling thread meets the first resource allocation condition, judging in turn whether each node in the node set corresponding to each asynchronous scheduling thread meets a second resource allocation condition, and for each node in the node set corresponding to each asynchronous scheduling thread, if the node meets the second resource allocation condition, allocating the resources to be allocated to the node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a resource allocation method, device and system for a cluster, and a computer storable medium. Background Art

[0002] In the related art, a Capacity scheduler uses multiple asynchronous scheduling threads to allocate resources, and each asynchronous scheduling thread determines a node to which resources can be allocated by traversing all nodes in the cluster. Summary of the invention

[0003] In the related art, each asynchronous scheduling thread traverses all nodes in the cluster, which takes a long time and is inefficient in resource allocation. Especially in the case of tight resources, it may be necessary to traverse to the last node to know whether there is a node that can meet the resource allocation.

[0004] In view of the above technical problems, the present disclosure proposes a solution to improve the resource allocation efficiency of the cluster.

[0005] According to a first aspect of the present disclosure, a resource allocation method for a cluster is provided, wherein the cluster comprises a plurality of nodes, wherein the plurality of nodes are divided into a plurality of node sets which are equal to the total number of a plurality of asynchronously scheduled threads, and one asynchronously scheduled thread corresponds to one node set, wherein the resource allocation method comprises: receiving a resource allocation request, wherein the resource allocation request comprises the number of resources to be allocated; and scheduling each of the plurality of asynchronously scheduled threads to perform the following steps according to the resource allocation request: determining whether each of the asynchronously scheduled threads satisfies a first resource allocation condition, and if each of the asynchronously scheduled threads satisfies the first resource allocation condition, determining in turn whether each of the nodes in the node set corresponding to each asynchronously scheduled thread satisfies a second resource allocation condition, and for each of the nodes in the node set corresponding to each asynchronously scheduled thread, if the node satisfies the second resource allocation condition, allocating the resources to be allocated to the node.

[0006] In some embodiments, the first resource allocation condition includes that the preset flag bit of each asynchronously scheduled thread is a specified value, the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, and the specified storage space for storing resource allocation results is not full, and the specified value indicates that each asynchronously scheduled thread is currently in a scheduled state.

[0007] In some embodiments, the second resource allocation condition includes that the number of remaining allocatable resources on each node is greater than or equal to the number of resources to be allocated.

[0008] In some embodiments, the resource allocation method for a cluster further includes: initializing the multiple asynchronous scheduling threads; initializing the multiple node sets; and establishing a corresponding relationship between the asynchronous scheduling threads and the node sets.

[0009] In some embodiments, a node set has a set identifier, a node has a node identifier, and multiple nodes are divided into multiple node sets equal to the number of multiple asynchronously scheduled threads, including: hashing the node identifier of each node to obtain a hash value; determining the set identifier of the node set corresponding to each node based on the hash value and the total number of the multiple asynchronously scheduled threads; and dividing each node into the node set corresponding to the determined set identifier.

[0010] In some embodiments, the node set has a set identifier, and the node has a node identifier. The resource allocation method for the cluster also includes: based on a node addition or deletion event message, hashing the node identifier of the node to obtain a hash value; determining the set identifier of the node set corresponding to the node based on the hash value and the total number of the multiple asynchronous scheduling threads; and performing an operation corresponding to the addition or deletion event message on the node based on the set identifier of the node set corresponding to the node.

[0011] In some embodiments, determining the set identifier of the node set corresponding to the current node includes: using the hash value to perform a modulo operation on the total number of the multiple asynchronous scheduling threads to obtain the set identifier of the node set corresponding to the current node.

[0012] In some embodiments, when the add / delete event message is about adding a node, performing the operation corresponding to the add / delete event message on the node includes: adding the node to the node set corresponding to the node according to the set identifier of the node set corresponding to the node; when the add / delete event message is about deleting a node, performing the operation corresponding to the add / delete event message on the node includes: deleting the node from the node set corresponding to the node according to the set identifier of the node set corresponding to the node.

[0013] In some embodiments, the resource allocation method is executed by a scheduler with an asynchronous scheduling function enabled.

[0014] In some embodiments, the node has a node identifier, the resource to be allocated has a resource identifier, and allocating the resource to be allocated to the node includes: storing the correspondence between the resource identifier of the resource to be allocated and the node identifier of the node as a resource allocation result in a designated storage space.

[0015] According to a second aspect of the present disclosure, a resource allocation device for a cluster is provided, wherein the cluster comprises a plurality of nodes, wherein the plurality of nodes are divided into a plurality of node sets which are equal to the total number of a plurality of asynchronously scheduled threads, and one asynchronously scheduled thread corresponds to one node set, wherein the resource allocation device comprises: a receiving module, configured to receive a resource allocation request, wherein the resource allocation request comprises the number of resources to be allocated; and a scheduling module, configured to schedule each of the plurality of asynchronously scheduled threads to perform the following steps according to the resource allocation request: determining whether each of the asynchronously scheduled threads satisfies a first resource allocation condition, and if each of the asynchronously scheduled threads satisfies the first resource allocation condition, determining in turn whether each of the nodes in the node set corresponding to each asynchronously scheduled thread satisfies a second resource allocation condition, and for each of the nodes in the node set corresponding to each asynchronously scheduled thread, if the node satisfies the second resource allocation condition, allocating the resources to be allocated to the node.

[0016] According to a third aspect of the present disclosure, a resource allocation device for a cluster is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the resource allocation method for a cluster described in any of the above embodiments based on instructions stored in the memory.

[0017] According to a fourth aspect of the present disclosure, a resource allocation system for a cluster is provided, comprising: a scheduler configured to execute the resource allocation method for a cluster described in any one of the above embodiments.

[0018] In some embodiments, the resource allocation system for a cluster also includes: a resource manager, configured to: send a resource allocation request including the number of resources to be allocated to the scheduler; upon receiving a deregistration request from one of the multiple nodes in the cluster, send a deletion event message of the node to the scheduler; upon receiving a registration request from a newly added node other than the multiple nodes in the cluster, send an addition event message of the node to the scheduler.

[0019] According to a fifth aspect of the present disclosure, a computer storable medium is provided, on which computer program instructions are stored, and when the instructions are executed by a processor, the resource allocation method for a cluster described in any of the above embodiments is implemented.

[0020] In the above embodiment, the resource allocation efficiency of the cluster can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0022] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0023] Figure 1 is a flow chart illustrating a resource allocation method for a cluster according to some embodiments of the present disclosure;

[0024] Figure 2 is a flow chart showing a resource allocation method for a cluster according to some other embodiments of the present disclosure;

[0025] Figure 3 is a block diagram illustrating a resource allocation apparatus for a cluster according to some embodiments of the present disclosure;

[0026] Figure 4 is a block diagram showing a resource allocation device for a cluster according to some other embodiments of the present disclosure;

[0027] Figure 5 is a block diagram illustrating a resource allocation system for a cluster according to some embodiments of the present disclosure;

[0028] Figure 6 is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0029] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.

[0030] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0031] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0032] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.

[0033] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0034] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0035] Figure 1 is a flow chart illustrating a resource allocation method for a cluster according to some embodiments of the present disclosure.

[0036] like Figure 1 As shown, the resource allocation method for a cluster includes steps S110-S123. The cluster includes multiple nodes. The multiple nodes are divided into multiple node sets that are the same as the total number of multiple asynchronous scheduling threads. One asynchronous scheduling thread corresponds to one node set. The node set can also be called a node partition. In some embodiments, the node has a node identifier.

[0037] In some embodiments, multiple nodes in the set have been registered with a resource manager (RM). Multiple nodes can be divided into multiple node sets by a node manager (NM). For example, the following method can be used to divide multiple nodes into multiple node sets.

[0038] First, the node representation of each node is hashed to obtain a hash value.

[0039] Then, according to the hash value and the total number of the multiple asynchronously scheduled threads, the set identifier of the node set corresponding to each node is determined. In some embodiments, the hash value obtained by hashing is used to perform a modulo operation on the total number of multiple asynchronously scheduled threads to obtain the set identifier of the node set corresponding to the current node. For example, the hash value of a node is 1234567, the total number of asynchronously scheduled threads is 20, and the modulo operation is 123456%20=7. The set identifier of the node is 7.

[0040] Finally, each node is divided into a node set corresponding to the determined set identifier.

[0041] For example, the resource allocation method is executed by a scheduler that turns on the asynchronous scheduling function. In some embodiments, the caller can also turn off the asynchronous scheduling function, and the scheduler performs resource allocation based on the heartbeat information of the node. For example, the asynchronous scheduling function of the scheduler can be turned on or off by configuring the function identification bit of the scheduler in the configuration file. For example, when the function identification bit is true or 1, the asynchronous scheduling function is turned on. When the function identification bit is false or 0, the asynchronous scheduling function is turned off.

[0042] In step S110, a resource allocation request is received. The resource allocation request includes the number of resources to be allocated. For example, the resources to be allocated include containers. The container encapsulates software and hardware resources such as CPU (Central Processing Unit), memory, network and hard disk.

[0043] In step S120, each asynchronous scheduling thread in the plurality of asynchronous scheduling threads is scheduled according to the resource allocation request. Each asynchronous scheduling thread executes the following steps: Figure 1 Steps S121 to S123 are shown.

[0044] In step S121, it is determined whether each asynchronously scheduled thread satisfies the first resource allocation condition. The first resource allocation condition includes that the preset flag of each asynchronously scheduled thread is a specified value, the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, and the specified storage space for storing resource allocation results is not full. The specified value indicates that each asynchronously scheduled thread is currently in a scheduled state. For example, the specified storage space may be at least a part of the memory of the scheduler. For another example, the specified storage space may also be an external memory connected to the scheduler.

[0045] In some embodiments, a backlogs data structure may be used to store resource allocation results. For example, a LinkedBlockingQueue type in Java is used to represent the backlogs data structure. When the backlogs data structure is used to store resource allocation results, the size of the storage space is the maximum value of data that can be stored in the backlogs data structure.

[0046] In step S122, when each asynchronous scheduling thread satisfies the first resource allocation condition, it is determined in turn whether each node in the node set corresponding to each asynchronous scheduling thread satisfies the second resource allocation condition. The second resource allocation condition includes that the number of remaining allocatable resources on each node is greater than or equal to the number of resources to be allocated. For example, each node has the number of resources that the node can carry (i.e., the number of resources that the node can carry in total) and the number of resources that have been allocated to the node. The number of remaining allocatable resources is the difference between the number of resources that can be carried and the number of allocated resources.

[0047] In some embodiments, when each asynchronously scheduled thread does not satisfy the first resource allocation condition, the preset flag bit of each asynchronously scheduled thread is a specified value and the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, the asynchronously scheduled thread is blocked. For example, the asynchronously scheduled thread is adjusted from a scheduling state to a blocking state.

[0048] In some embodiments, when each asynchronously scheduled thread satisfies the first resource allocation condition, the preset flag bit of each asynchronously scheduled thread is a specified value and the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, but the specified storage space for storing resource allocation results is not full, it is re-determined whether the asynchronously scheduled thread meets the first resource allocation condition. This is because after the node obtains the resource allocation result from the specified storage space, the scheduler deletes the corresponding resource allocation result, so the number of remaining allocatable resources in the specified storage space will increase.

[0049] In step S123, for each node in the node set corresponding to each asynchronous scheduling thread, when the node meets the second resource allocation condition, the resource to be allocated is allocated to the node. In some embodiments, the node has a node identifier, and the resource to be allocated has a resource identifier. For example, the node identifier can be represented by the IP (Internet Protocol) address and port number of the node. If the IP address of a node is 10.10.10.10 and the port number is 8090, the node identifier of the node is 10.10.10.10:8090. In some embodiments, the correspondence between the resource identifier of the resource to be allocated and the node identifier of the node can be stored in a designated storage space as a resource allocation result.

[0050] In some embodiments, when a node does not meet the second resource allocation condition, it is determined whether the next node in the node set meets the second resource allocation condition. For example, when all nodes in the node set do not meet the second resource allocation condition, resource allocation fails. For example, each node in the node set may be traversed again.

[0051] In some embodiments, after storing the resource allocation result in the designated storage space, the scheduler schedules other threads except the above-mentioned asynchronous scheduling thread to obtain (consume) the resources allocated to each node from the designated storage space and tentatively submit the resources. If the submission fails, the scheduler abandons the resource and deletes the corresponding correspondence in the designated storage space.

[0052] In the above embodiment, multiple nodes in the cluster are divided into multiple node sets that are the same as the total number of multiple asynchronous scheduling threads, and in the resource allocation process, each asynchronous scheduling thread only handles the resource allocation process of each node in the node set corresponding to the asynchronous scheduling thread, which can improve the resource allocation efficiency of the cluster.

[0053] Figure 2 is a flowchart illustrating a resource allocation method for a cluster according to some other embodiments of the present disclosure.

[0054] like Figure 2 As shown, the resource allocation method for a cluster includes steps S100 to S123. The cluster includes a plurality of nodes. In some embodiments, the node has a node identifier.

[0055] For example, the resource allocation method is executed by a scheduler that turns on the asynchronous scheduling function. In some embodiments, the caller can also turn off the asynchronous scheduling function, and the scheduler performs resource allocation based on the heartbeat information of the node. For example, the asynchronous scheduling function of the scheduler can be turned on or off by configuring the function identification bit of the scheduler in the configuration file. For example, when the function identification bit is true or 1, the asynchronous scheduling function is turned on. When the function identification bit is false or 0, the asynchronous scheduling function is turned off.

[0056] In step S100, multiple asynchronous scheduling threads are initialized. In some embodiments, the preset number N of asynchronous scheduling threads is first read from a configuration file. N is a positive integer. Then, a thread array is created based on the number N of asynchronous scheduling threads read. The thread array includes N asynchronous scheduling threads (objects of asynchronous scheduling threads), and each asynchronous scheduling thread has a thread identifier. For example, a thread array can be created using the List data structure in Java. Finally, each asynchronous scheduling thread is initialized by assigning each asynchronous scheduling thread an identifier of the scheduler, a thread identifier of each asynchronous scheduling thread, and other related parameters.

[0057] In step S101, multiple node sets are initialized. In some embodiments, N node set arrays are created according to the number N of asynchronous scheduling threads read from the configuration file. Each node set array is a node set. The node set has a set identifier. In the case where the node set is called a node partition, the set identifier can be called a partition number.

[0058] For example, an array structure in Java can be used to create a node collection array. For example, in each node collection array, each node object stores the node identifier and the resource allocation information of the node in a Map structure. That is, the key in the Map structure is the node identifier, and the value is the resource allocation information. The resource allocation information of the node includes the number of resources that the node can carry (that is, the total number of resources that the node can carry) and the number of resources that have been allocated to the node.

[0059] In some embodiments, multiple nodes in the above cluster have been registered with a resource manager (ResourceManager, RM). For example, multiple nodes are registered with a node manager (NodeManager, NM). Multiple nodes are divided into multiple node sets with the same number of asynchronous scheduling threads. For example, the division of multiple nodes into multiple node sets can be achieved in the following manner.

[0060] First, the node representation of each node is hashed to obtain a hash value.

[0061] Then, according to the hash value and the total number of the multiple asynchronously scheduled threads, the set identifier of the node set corresponding to each node is determined. In some embodiments, the hash value obtained by hashing is used to perform a modulo operation on the total number of multiple asynchronously scheduled threads to obtain the set identifier of the node set corresponding to the current node. For example, the hash value of a node is 1234567, the total number of asynchronously scheduled threads is 20, and the modulo operation is 123456%20=7. The set identifier of the node is 7.

[0062] Finally, each node is divided into a node set corresponding to the determined set identifier.

[0063] In step S102, a correspondence between an asynchronously scheduled thread and a node set is established. In some embodiments, a correspondence between a thread identifier of an asynchronously scheduled thread and a set identifier of a node set is established. For example, a correspondence is established between an asynchronously scheduled thread and a node set with the same subscript of an object. The subscript is a number.

[0064] In step S110, a resource allocation request is received. The resource allocation request includes the number of resources to be allocated. For example, the resources to be allocated include containers. The container encapsulates software and hardware resources such as CPU (Central Processing Unit), memory, network and hard disk.

[0065] In step S120, each asynchronous scheduling thread in the plurality of asynchronous scheduling threads is scheduled according to the resource allocation request. Each asynchronous scheduling thread executes the following steps: Figure 2 As shown in step S121-step S123. Regarding step S121-step S123, the previous Figure 1 It has been described in detail and will not be repeated here.

[0066] In some embodiments, the resource allocation method further includes: Figure 2 Steps S130 to S150 are shown. Steps S130 to S150 may be performed at any time between steps S100 to S120, and may also be performed before step S100 or after step S120.

[0067] In step S130, according to the addition and deletion event message of a node, the node identifier of the node is hashed to obtain a hash value. The node can be one of multiple nodes or a newly added node in the cluster. In the case where the node is one of multiple nodes, the addition and deletion event message is to delete the node from the cluster. For example, in this case, the addition and deletion event message is a NODE_ADDED event message. In the case where the node is a newly added node in the cluster, the addition and deletion event message is to add the node to the cluster. For example, in this case, the addition and deletion event message is a NODE_REMOVED event message.

[0068] In some embodiments, before hashing the node identifier of the node, the object of the node may be generated and stored in a pre-built node array or deleted from a pre-built node array according to the node addition and deletion event message. The node array is used to store the node objects of all nodes in the cluster.

[0069] In step S140, the set identifier of the node set corresponding to the node is determined according to the hash value and the total number of multiple asynchronously scheduled threads. In some embodiments, the hash value obtained by hashing is used to perform a modulo operation on the total number of multiple asynchronously scheduled threads to obtain the set identifier of the node set corresponding to the current node.

[0070] In step S150, an operation corresponding to the addition and deletion event message is performed on the node according to the set identifier of the node set corresponding to the node.

[0071] For example, when the add / delete event message is to add a node, performing the operation corresponding to the add / delete event message on the node includes: adding the node to the node set corresponding to the node according to the set identifier of the node set corresponding to the node.

[0072] For another example, when the add / delete event message is to delete a node, performing the operation corresponding to the add / delete event message on the node includes: deleting the node from the node set corresponding to the node according to the set identifier of the node set corresponding to the node.

[0073] It can be seen from step S130 to step S150 that as the nodes in the cluster change, the nodes included in the node set also change continuously, that is, the node set changes dynamically.

[0074] In the above embodiment, multiple nodes in the cluster are divided into multiple node sets that are the same as the total number of multiple asynchronous scheduling threads, and in the resource allocation process, each asynchronous scheduling thread only handles the resource allocation process of each node in the node set corresponding to the asynchronous scheduling thread, which can improve the resource allocation efficiency of the cluster.

[0075] Figure 3 is a block diagram illustrating a resource allocation apparatus for a cluster according to some embodiments of the present disclosure.

[0076] like Figure 3 As shown, the resource allocation device 31 for clusters includes a receiving module 311 and a scheduling module 312. For example, the resource allocation device 31 for clusters is a scheduler.

[0077] The receiving module 311 is configured to receive a resource allocation request, for example, Figure 1 As shown in step S110, the resource allocation request includes the quantity of resources to be allocated.

[0078] The scheduling module 312 is configured to schedule each asynchronous scheduling thread in the plurality of asynchronous scheduling threads according to the resource allocation request, for example, to execute the following steps: Figure 1 Step S120 is shown.

[0079] Each asynchronous scheduling thread executes the following steps. First, determine whether each asynchronous scheduling thread meets the first resource allocation condition, for example, Figure 1 Then, when each asynchronously scheduled thread meets the first resource allocation condition, it is determined in turn whether each node in the node set corresponding to each asynchronously scheduled thread meets the second resource allocation condition, for example, executing the following Figure 1 Finally, for each node in the node set corresponding to each asynchronous scheduling thread, if the node meets the second resource allocation condition, the resource to be allocated is allocated to the node, for example, executing Figure 1 Step S123 shown.

[0080] Figure 4 is a block diagram showing a resource allocation device for a cluster according to some other embodiments of the present disclosure.

[0081] like Figure 4 As shown, the resource allocation device 41 for clusters includes a memory 411; and a processor 412 coupled to the memory 411. The memory 411 is used to store instructions for executing the corresponding embodiments of the resource allocation method for clusters. The processor 412 is configured to execute the resource allocation method for clusters in any of some embodiments of the present disclosure based on the instructions stored in the memory 411.

[0082] Figure 5 is a block diagram illustrating a resource allocation system for a cluster according to some embodiments of the present disclosure.

[0083] like Figure 5 As shown, the resource allocation system 5 for a cluster includes a scheduler 51 .

[0084] The scheduler 51 is configured to execute the resource allocation method for a cluster in any of some embodiments of the present disclosure. For example, the structure and function of the scheduler 51 are similar to those of the resource allocation device 31 or 41 for a cluster.

[0085] The resource allocation system 5 for a cluster further includes a resource manager 52 .

[0086] The resource manager 52 is configured to send a resource allocation request including the number of resources to be allocated to the scheduler 51. The resource manager 52 is also configured to, in the case of receiving a deregistration request from one of the multiple nodes in the cluster, send a deletion event message of the node to the scheduler 51. In the case of receiving a registration request from a newly added node other than the multiple nodes in the cluster, send an addition event message of the node to the scheduler 51. The deletion event message and the addition event message here both belong to the aforementioned addition and deletion event messages.

[0087] Figure 6 is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure.

[0088] like Figure 6 As shown, the computer system 60 may be embodied in the form of a general purpose computing device. The computer system 60 includes a memory 610, a processor 620, and a bus 600 that connects the various system components.

[0089] The memory 610 may include, for example, a system memory, a non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs. The system memory may include a volatile storage medium, such as a random access memory (RAM) and / or a cache memory. The non-volatile storage medium may store, for example, instructions for executing at least one corresponding embodiment of the resource allocation method for a cluster. The non-volatile storage medium includes, but is not limited to, a disk memory, an optical memory, a flash memory, etc.

[0090] The processor 620 can be implemented by a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistors, etc. Discrete hardware components. Accordingly, each module such as the judgment module and the determination module can be implemented by a central processing unit (CPU) running instructions in a memory that execute corresponding steps, or can be implemented by a dedicated circuit that executes corresponding steps.

[0091] The bus 600 may use any of a variety of bus architectures, including, but not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, and a Peripheral Component Interconnect (PCI) bus.

[0092] The computer system 60 may also include an input / output interface 630, a network interface 640, a storage interface 650, etc. These interfaces 630, 640, 650, the memory 610, and the processor 620 may be connected via a bus 600. The input / output interface 630 may provide a connection interface for input / output devices such as a display, a mouse, and a keyboard. The network interface 640 may provide a connection interface for various networked devices. The storage interface 650 may provide a connection interface for external storage devices such as a floppy disk, a USB flash drive, and an SD card.

[0093] Here, various aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to embodiments of the present disclosure. It should be understood that each frame of the flowchart and / or block diagram and the combination of frames can be implemented by computer-readable program instructions.

[0094] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable device to produce a machine, so that the processor executes the instructions to produce means for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.

[0095] These computer-readable program instructions may also be stored in a computer-readable memory, which cause the computer to work in a specific manner to produce an article of manufacture, including instructions for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.

[0096] The present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.

[0097] The resource allocation efficiency of the cluster can be improved by using the resource allocation method, device, system, and computer storable medium for the cluster in the above embodiments.

[0098] So far, the resource allocation method, device and system for clusters according to the present disclosure, and the computer storable medium have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed herein.

Claims

1. A resource allocation method for a cluster, the cluster comprising a plurality of nodes, the plurality of nodes being divided into a plurality of node sets equal to the total number of a plurality of asynchronous scheduling threads, one asynchronous scheduling thread corresponding to one node set, the resource allocation method comprising: receiving a resource allocation request, wherein the resource allocation request includes a quantity of resources to be allocated; According to the resource allocation request, each asynchronous scheduling thread in the multiple asynchronous scheduling threads is scheduled to perform the following steps: Determine whether each asynchronously scheduled thread satisfies a first resource allocation condition, wherein the first resource allocation condition includes that a preset flag bit of each asynchronously scheduled thread is a specified value, the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, and a specified storage space for storing resource allocation results is not full, and the specified value indicates that each asynchronously scheduled thread is currently in a scheduled state, In the case where each asynchronously scheduled thread satisfies the first resource allocation condition, determining in turn whether each node in the node set corresponding to each asynchronously scheduled thread satisfies the second resource allocation condition, For each node in the node set corresponding to each asynchronous scheduling thread, if the node meets the second resource allocation condition, the resource to be allocated is allocated to the node.

2. The resource allocation method for a cluster according to claim 1, wherein: The second resource allocation condition includes that the number of remaining allocatable resources on each node is greater than or equal to the number of resources to be allocated.

3. The resource allocation method for a cluster according to claim 1, further comprising: Initializing the multiple asynchronous scheduling threads; Initializing the plurality of node sets; Build the correspondence between asynchronous scheduling threads and node sets.

4. The resource allocation method for a cluster according to claim 3, wherein: The node set has a set identifier, the node has a node identifier, and the plurality of nodes are divided into a plurality of node sets equal to the number of the plurality of asynchronous scheduling threads, including: for each of the plurality of nodes, Perform hash processing on the node identifier of the node to obtain a hash value; Determine a set identifier of a node set corresponding to the node according to the hash value and the total number of the multiple asynchronous scheduling threads; The node is divided into a node set corresponding to the determined set identifier.

5. The resource allocation method for a cluster according to claim 1, wherein: The node set has a set identifier, and the node has a node identifier. The resource allocation method for the cluster also includes: According to the addition and deletion event message of a node, a node identifier of the node is hashed to obtain a hash value; Determine a set identifier of a node set corresponding to the node according to the hash value and the total number of the multiple asynchronous scheduling threads; According to the set identifier of the node set corresponding to the node, an operation corresponding to the addition and deletion event message is performed on the node.

6. The resource allocation method for a cluster according to claim 4 or 5, wherein: Determining the set identifier of the node set corresponding to the node includes: The hash value is used to perform a modulo operation on the total number of the multiple asynchronous scheduling threads to obtain a set identifier of a node set corresponding to the node.

7. The resource allocation method for a cluster according to claim 5, wherein: In the case where the addition / deletion event message is to add a node, performing an operation corresponding to the addition / deletion event message on the node includes: adding the node to the node set corresponding to the node according to the set identifier of the node set corresponding to the node; When the add / delete event message is to delete a node, performing the operation corresponding to the add / delete event message on the node includes: deleting the node from the node set corresponding to the node according to the set identifier of the node set corresponding to the node.

8. The resource allocation method for a cluster according to claim 1, wherein: The resource allocation method is executed by a scheduler with an asynchronous scheduling function enabled.

9. The resource allocation method for a cluster according to claim 1, wherein: The node has a node identifier, the resource to be allocated has a resource identifier, and allocating the resource to be allocated to the node includes: The corresponding relationship between the resource identifier of the resource to be allocated and the node identifier of the node is taken as the resource allocation result and stored in the designated storage space.

10. A resource allocation device for a cluster, the cluster comprising a plurality of nodes, the plurality of nodes being divided into a plurality of node sets equal to the total number of a plurality of asynchronous scheduling threads, one asynchronous scheduling thread corresponding to one node set, the resource allocation device comprising: A receiving module is configured to receive a resource allocation request, wherein the resource allocation request includes the amount of resources to be allocated; The scheduling module is configured to schedule each asynchronous scheduling thread in the multiple asynchronous scheduling threads to perform the following steps according to the resource allocation request: Determine whether each asynchronously scheduled thread satisfies a first resource allocation condition, wherein the first resource allocation condition includes that a preset flag bit of each asynchronously scheduled thread is a specified value, the number of nodes in the node set corresponding to each asynchronously scheduled thread is not 0, and a specified storage space for storing resource allocation results is not full, and the specified value indicates that each asynchronously scheduled thread is currently in a scheduled state, In the case where each asynchronously scheduled thread satisfies the first resource allocation condition, determining in turn whether each node in the node set corresponding to each asynchronously scheduled thread satisfies the second resource allocation condition, For each node in the node set corresponding to each asynchronous scheduling thread, if the node meets the second resource allocation condition, the resource to be allocated is allocated to the node.

11. A resource allocation device for a cluster, comprising: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the resource allocation method for a cluster according to any one of claims 1 to 9 based on instructions stored in the memory.

12. A resource allocation system for a cluster, comprising: A scheduler is configured to execute the resource allocation method for a cluster as claimed in any one of claims 1 to 9.

13. The resource allocation system for a cluster according to claim 12, further comprising: Resource Manager, configured as: sending a resource allocation request including the amount of resources to be allocated to the scheduler; In case of receiving a deregistration request from one of the plurality of nodes in the cluster, sending a deletion event message of the node to the scheduler; When a registration request is received from a newly added node other than the multiple nodes in the cluster, an addition event message of the node is sent to the scheduler.

14. A computer storable medium having computer program instructions stored thereon, wherein when the instructions are executed by a processor, the resource allocation method for a cluster as claimed in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Local collections of tasks in a scheduler

    CN102027447A

  • Resource scheduling method and device in distributed system

    CN108132840A