Node resource scheduling method and device, electronic equipment and storage medium
By filtering out the target node set that meets the resource quota for the service to be scheduled in the Kubernetes cluster and scheduling service instances to these nodes, the problems of fragmentation of memory resources and low resource utilization in the cluster are solved, and efficient utilization of resources and avoiding waste are achieved.
Patent Information
- Application Number
- CN202411710342.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
AI Technical Summary
Due to the fragmentation of memory resources in Kubernetes clusters, it is impossible to match the appropriate nodes for new instances, which limits the deployment of application services, and there are problems such as waste of resources and low node resource utilization.
By receiving the service request to be dispatched, the available resources of each node in the target cluster are detected, the node resource information of each node is obtained, and the target node set that meets the resource quota for the service request to be dispatched is selected, including a first node and at least one second node. The available resources of the first node meet the CPU resource quota, the sum of the available resources corresponding to the first node and the second node meets the memory resource quota, and the service instances to be dispatched are scheduled to each node in the target node set, and remote direct memory access is used between each node in the target node set.
It realizes elastic scheduling of node resources in the cluster, aggregates fragmented memory resources, and meets memory resource quotas through multiple node memory resources, avoids resource waste and node fragmentation problems, and improves node resource utilization.
Smart Images

Figure CN119621325A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a node resource scheduling method, device, electronic equipment and storage medium. Background Art
[0002] With the development of cloud computing and big data technology, Kubernetes has become a standard platform for containerized application management. Kubernetes provides powerful orchestration capabilities that can automatically deploy, scale, and manage containerized applications in large-scale cluster environments. In a Kubernetes cluster, as services are scheduled and allocated, the memory resources in the cluster will gradually become fragmented. As a result, although the cluster still has enough memory overall, there is no node that meets both processor and memory requirements, which makes it impossible to match a suitable node for the newly added instance, limiting the deployment of application services. In order to solve this problem, more hardware resources are usually added, but this also brings greater memory fragmentation problems, low node resource utilization, and resource waste. Summary of the invention
[0003] The present invention provides a node resource scheduling method, device, electronic device and storage medium to solve the problems of node memory fragmentation, low node resource utilization and resource waste in a cluster.
[0004] According to one aspect of the present invention, a node resource scheduling method is provided, comprising:
[0005] Receive a service request to be dispatched;
[0006] When it is detected that the available resources of each node in the target cluster do not satisfy the resource quota of the service request to be scheduled and the total available resources of the target cluster satisfy the resource quota of the service request to be scheduled, obtain the node resource information of each node in the target cluster, and based on the node resource information of each node and the resource quota of the service request to be scheduled, screen out a set of target nodes that satisfy the resource quota of the service request to be scheduled from the target cluster, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resources of the first node satisfy the CPU resource quota, and the sum of the available resources corresponding to the first node and the second node satisfy the memory resource quota;
[0007] The service instance corresponding to the service request to be scheduled is scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set.
[0008] Optionally, the node resource information includes available CPU resources and available memory resources; based on the node resource information of each node and the resource quota of the service request to be scheduled, a target node set that meets the resource quota of the service request to be scheduled is screened out from the target cluster, including: matching the CPU resource quota of the service request to be scheduled and the available CPU resources of each node to determine at least one node that meets the CPU resource quota, and taking any one of the at least one node as the first node, wherein any one of the at least one node that meets the CPU resource quota meets the CPU resource quota; determining a memory resource difference based on the available memory resources of the first node and the memory resource quota of the service request to be scheduled, and based on the available memory resources of each node and the memory resource difference, screening out at least one second node that meets the memory resource difference from the target cluster; forming a target node set based on the first node and the at least one second node.
[0009] Optionally, based on the available memory resources and the memory resource difference of each node, at least one second node that meets the memory resource difference is screened out from the target cluster, including: matching based on the memory resource difference and the available memory resources of each node to determine at least one node that meets the memory resource difference, selecting a node with the smallest available memory resources from at least one node that meets the resource difference, and using the node corresponding to the smallest available memory resources as the second node, wherein the available memory resources of any one of the at least one node that meets the memory resource difference meet the memory resource difference.
[0010] Optionally, the method also includes: when all nodes in the target cluster do not meet the memory resource difference, matching is performed based on the memory resource difference and the available memory resources of each node, to determine multiple node combinations that meet the memory resource difference, and selecting a node combination with the smallest available memory resources and the least number of nodes from the multiple node combinations, and using each node in the selected node combination as a second node.
[0011] Optionally, after receiving the service request to be scheduled, the method includes: traversing the node resource information of each node in the target cluster, determining the available resources of each node and the total available resources of the target cluster; judging whether the available resources of each node meet the resource quota of the service request to be scheduled, and whether the total available resources of the target cluster meet the resource quota of the service request to be scheduled.
[0012] Optionally, scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set includes: accessing each second node through remote direct memory access by the first node, and scheduling the service instance corresponding to the service request to be scheduled to the first node and each second node.
[0013] Optionally, after scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set, the method also includes: updating the available resource information of the corresponding node in the target storage space according to the resource scheduling information of each node in the target node set; after the execution of the service request to be scheduled is completed, releasing the resources of each node in the target node set.
[0014] According to another aspect of the present invention, a node resource scheduling device is provided, comprising:
[0015] A module for receiving service requests to be scheduled, used for receiving service requests to be scheduled;
[0016] A target node set determination module is used to obtain node resource information of each node in the target cluster when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resources of the target cluster meet the resource quota of the service request to be scheduled, and screen out a target node set that meets the resource quota of the service request to be scheduled from the target cluster based on the node resource information of each node and the resource quota of the service request to be scheduled, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resource amount of the first node meets the CPU resource quota, and the sum of the available resource amounts corresponding to the first node and the second node meets the memory resource quota;
[0017] The target node set scheduling module is used to schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set.
[0018] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the node resource scheduling method of any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the node resource scheduling method of any embodiment of the present invention when executed.
[0023] The technical solution of the embodiment of the present invention receives a service request to be scheduled; when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resource amount of the target cluster meets the resource quota of the service request to be scheduled, obtains the node resource information of each node in the target cluster, and based on the node resource information of each node and the resource quota of the service request to be scheduled, screens out a target node set that meets the resource quota of the service request to be scheduled from the target cluster, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resource amount of the first node meets the CPU resource quota, and the sum of the available resource amounts corresponding to the first node and the second node meets the memory resource quota; schedules the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set. This solution uses the node resource information of each node and the resource quota of the service request to be scheduled to screen out the target node set that meets the resource quota of the service request to be scheduled from the target cluster, thereby realizing the elastic scheduling of the node resources in the cluster to meet the service request to be scheduled. It can aggregate fragmented memory resources and meet the memory resource quota through the memory resources of multiple nodes to realize cross-node resource calling, so that the target node set can meet both the CPU resource quota and the memory resource quota. There is no need to apply for more node resources when the resources of a single node are insufficient, thus avoiding the problems of resource waste and node fragmentation and improving the utilization of node resources.
[0024] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 is a flowchart of a node resource scheduling method provided by Embodiment 1 of the present invention;
[0027] Figure 2 is a flowchart of a node resource scheduling method provided by Embodiment 2 of the present invention;
[0028] Figure 3 It is a structural diagram of a node resource scheduling device provided by Embodiment 3 of the present invention;
[0029] Figure 4 It is a structural schematic diagram of an electronic device for implementing the node resource scheduling method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Embodiment 1
[0033] Figure 1 This is a flowchart of a node resource scheduling method provided by the first embodiment of the present invention. This embodiment is applicable to the case of scheduling nodes, especially when a single node does not meet the scheduling requirements. The method can be executed by a node resource scheduling device, which can be implemented in the form of hardware and / or software. The node resource scheduling device can be configured in electronic devices such as computers and servers. Figure 1 As shown, the method includes:
[0034] S110: Receive a service request to be scheduled.
[0035] The service request to be scheduled may be specifically understood as a service request that has been submitted but has not yet been allocated resources or executed, and the service request to be scheduled may be received from any client or server.
[0036] In this embodiment, a service request to be scheduled submitted by a user through a client may be received.
[0037] Optionally, after receiving the service request to be scheduled, the method includes: traversing the node resource information of each node in the target cluster, determining the available resources of each node and the total available resources of the target cluster; judging whether the available resources of each node meet the resource quota of the service request to be scheduled, and whether the total available resources of the target cluster meet the resource quota of the service request to be scheduled.
[0038] Among them, the resource quota can be specifically understood as the resource quota required to complete the service request to be scheduled, including but not limited to the memory resource quota and the CPU resource quota. The node resource information specifically represents the information of the node resource amount, which can be the available resource amount of the node. The corresponding node resource information can be obtained according to the information in the resource quota. For example, if the resource quota includes the memory resource quota and the CPU resource quota, the node resource information only needs to obtain the available CPU resource amount and the available memory resource amount. It should be noted that in the Kubernetes cluster, instances are usually scheduled to execute on different nodes, and the amount of resources required by different instances is different. Therefore, there will be nodes with less resources that can no longer meet the resource requirements of other instances, which will make the fragmentation of node resources more and more serious, resulting in resource waste and reducing resource utilization. In the case of processing the service request to be scheduled, the resource amount of the target cluster and the resource amount of each node in the target cluster can be checked first to detect whether the resource amount of the target cluster and the resource amount of each node in the target cluster can meet the resource quota of the service request to be scheduled.
[0039] Specifically, after receiving the service request to be scheduled, it is necessary to identify the service request to be scheduled to obtain the resource quota corresponding to the service request to be scheduled. Then, it is determined whether the available resources of each node in the target cluster and the total available resources of the target cluster can meet the resource quota corresponding to the service request to be scheduled, specifically by traversing the target cluster, obtaining the node resource information of each node in the target cluster, extracting the available resources of each node from the node resource information of each node, and calculating the total resources of the target cluster according to the node resource of each node. The node resource of each node and the total resource of the target cluster are respectively compared with the resource quota of the service request to be scheduled, and it is determined whether the node resource of each node can meet the resource quota of the service request to be scheduled, and whether the total resource of the target cluster can meet the resource quota of the service request to be scheduled. If the node resource of any node in each node is less than the resource quota of the service request to be scheduled, it is determined that the available resource of each node in the target cluster does not meet the resource quota of the service request to be scheduled. If the total amount of resources of the target cluster is greater than the resource quota of the service request to be scheduled, it is determined that the total amount of resources of the target cluster satisfies the resource quota of the service request to be scheduled.
[0040] S120. When it is detected that the available resources of each node in the target cluster do not meet the resource quota of the service request to be scheduled and the total available resources of the target cluster meet the resource quota of the service request to be scheduled, obtain the node resource information of each node in the target cluster, and based on the node resource information of each node and the resource quota of the service request to be scheduled, filter out a set of target nodes that meet the resource quota of the service request to be scheduled from the target cluster.
[0041] Among them, the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resources of the first node meet the CPU resource quota, and the sum of the available resources corresponding to the first node and the second node meet the memory resource quota.
[0042] Among them, the node resource information can be specifically understood as the information that characterizes the computing resources of the node, including but not limited to the available CPU resources and available memory resources. The node resource information of each node in the corresponding target cluster can be queried by calling the node information query interface. The first node can be specifically understood as any node that meets the CPU resource quota. As long as a single node can meet the CPU resource quota, the single node can be used as the first node, but only one node can be selected as the first node in the end. Correspondingly, as long as a single node cannot meet the CPU resource quota, it can be used as the second node. The second node can include multiple nodes, but the total amount of available resources of a first node and multiple second nodes must meet the memory resource quota of the service request to be scheduled. Since it is the memory resource quota that meets the service request to be scheduled, the total amount of available resources here specifically refers to the total amount of available memory resources. It should be noted that the first node and the second node are different nodes.
[0043] Specifically, when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resource amount of the target cluster meets the resource quota of the service request to be scheduled, the node information query interface is called to query the node resource information of each node in the target cluster, the node resource information of each node in the target cluster is obtained, the available resource amount in the node resource information of each node is determined, and the available resource amount of each node is matched with the resource quota of the service request to be scheduled, and the target node set that can meet the resource quota of the service request to be scheduled is screened out, wherein the resource quota includes a memory resource quota and a CPU resource quota, and it is necessary to screen out a first node that can meet the CPU resource quota, and at least one second node that can meet the memory resource quota together with the first node, and the screened first node and at least one second node are used as the target node set that meets the resource quota of the service request to be scheduled. It should be noted that if a first node that meets the CPU resource quota cannot be screened out, it means that the current target cluster cannot meet the resource quota of the service request to be scheduled, and it is necessary to re-acquire another cluster as the target cluster, and re-screen a new target node set for the service request to be scheduled.
[0044] In this embodiment, when the available resources of each node in the target cluster do not meet the resource quota of the service request to be scheduled and the total available resources of the target cluster meet the resource quota of the service request to be scheduled, a set of target nodes that can meet the resource quota is determined from the target cluster according to the resource quota of the service request to be scheduled, so that both the CPU resource quota and the memory resource quota can be met, thereby effectively utilizing the fragmented node resources and improving the node resource utilization rate.
[0045] S130. Schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set.
[0046] Among them, the service instance can be specifically understood as a service instance created on a node in the target node set according to the service request to be scheduled, which is used to complete the service request to be scheduled. Remote direct memory access is used between the nodes in the target node set to realize the function of aggregating memory resources. Specifically, a remote direct memory access plug-in can be set on each node in the target node set, and remote direct memory access between the nodes is realized through the remote direct memory access plug-in. At the same time, the memory resources of each node in the target node set are isolated, and the amount of isolated memory resources is set according to the resource quota corresponding to the service request to be scheduled.
[0047] Specifically, when the target node set is determined, a corresponding service instance is created for the service request to be scheduled on the node in the target node set, and the memory isolation function is called by sending memory extension instructions to the remote direct memory access control plug-in of each node, so as to isolate the memory resources of each node in the target node set, and extend the memory logic to each node in the target node set, so as to complete the scheduling of the service instance corresponding to the service request to be scheduled to each node in the target node set.
[0048] In this embodiment, remote direct memory access is used between the nodes in the target node set to achieve the function of aggregating memory resources corresponding to the memory resources of each node in the target node set, so that node resources can be deployed across nodes. When scheduling the Kubernetes cluster, only nodes that meet the CPU resource quota are required to aggregate the memory of the remaining nodes for service use, and the user is not aware of it. This effectively solves the problem of node resource fragmentation, improves node resource utilization, and also improves the overall resource utilization of the target cluster.
[0049] Optionally, scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set includes: accessing each second node through remote direct memory access by the first node, and scheduling the service instance corresponding to the service request to be scheduled to the first node and each second node.
[0050] Specifically, the first node in the target node set is used as the target scheduling node, and the second node is used as the node providing memory resources. The memory extension instruction is transmitted to each second node through the target scheduling node, and the remote direct memory access control plug-in in each node isolates the respective memory resources after receiving the instruction, so that the target scheduling node performs remote memory scheduling, and completes the scheduling process of scheduling the service instance corresponding to the service request to be scheduled to the first node and each second node, thereby realizing cross-node resource scheduling.
[0051] Based on the above embodiments, after scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set, the method also includes: updating the available resource information of the corresponding node in the target storage space according to the resource scheduling information of each node in the target node set; after the execution of the service request to be scheduled is completed, releasing the resources of each node in the target node set.
[0052] The resource scheduling information of each node in the target node set specifically refers to the amount of resources that have been scheduled on each node for the service request to be scheduled, including the amount of CPU resources and the amount of memory resources. In this embodiment, the target storage space uses an ETCD database to store cluster information corresponding to the cluster and node information of each node in the cluster.
[0053] Specifically, after scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set, each node in the target node set is matched with the node information in the target storage space to determine the node corresponding to each node in the target node set, and the available resource information of the corresponding node in the target storage space is subtracted from the amount of resources that have been scheduled for the corresponding node to obtain the new amount of available resources of the corresponding node in the target storage space. After detecting that the execution of the service request to be scheduled is completed, the resources of each node in the target node set are released and recycled, and the resource status of each node in the target node set is restored to the node status before the scheduling of the service request to be scheduled.
[0054] The technical solution of this embodiment is to receive a service request to be scheduled; when it is detected that the available resources of each node in the target cluster do not meet the resource quota of the service request to be scheduled and the total available resources of the target cluster meet the resource quota of the service request to be scheduled, obtain the node resource information of each node in the target cluster, and based on the node resource information of each node and the resource quota of the service request to be scheduled, screen out a target node set that meets the resource quota of the service request to be scheduled from the target cluster, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resources of the first node meet the CPU resource quota, and the sum of the available resources corresponding to the first node and the second node meet the memory resource quota; schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is used between the nodes in the target node set. This solution uses the node resource information of each node and the resource quota of the service request to be scheduled to screen out the target node set that meets the resource quota of the service request to be scheduled from the target cluster, thereby realizing the elastic scheduling of the node resources in the cluster to meet the service request to be scheduled. It can aggregate fragmented memory resources and meet the memory resource quota through the memory resources of multiple nodes to realize cross-node resource calling, so that the target node set can meet both the CPU resource quota and the memory resource quota. There is no need to apply for more node resources when the resources of a single node are insufficient, thus avoiding the problems of resource waste and node fragmentation and improving the utilization of node resources.
[0055] Embodiment 2
[0056] Figure 2It is a flow chart of a node resource scheduling method provided in the second embodiment of the present invention. This embodiment is a further optimization of the method of the above embodiment. Optionally, based on the matching of the CPU resource quota of the service request to be scheduled and the available CPU resource amount of each node, at least one node that meets the CPU resource quota is determined, and any node of the at least one node is used as the first node, wherein any node of the at least one node that meets the CPU resource quota meets the CPU resource quota; the memory resource difference is determined based on the available memory resource amount of the first node and the memory resource quota of the service request to be scheduled, and at least one second node that meets the memory resource difference is screened out from the target cluster based on the available memory resource amount of each node and the memory resource difference; a target node set is formed based on the first node and the at least one second node. As Figure 2 As shown, the method includes:
[0057] S210: Receive a service request to be scheduled.
[0058] S220: When it is detected that the available resource amount of each node in the target cluster does not satisfy the resource quota of the service request to be scheduled and the total available resource amount of the target cluster satisfies the resource quota of the service request to be scheduled, obtain node resource information of each node in the target cluster.
[0059] S230: Matching the CPU resource quota of the service request to be scheduled with the available CPU resource amount of each node, determining at least one node that meets the CPU resource quota, and taking any one of the at least one node as the first node.
[0060] Specifically, the node resource information of each node in the target cluster is traversed to obtain the available CPU resource amount of each node, which is compared with the CPU resource quota of the service to be scheduled, and at least one node that meets the CPU resource quota is screened out, wherein any node of the at least one node that meets the CPU resource quota meets the CPU resource quota, and a node can be randomly selected from the screened nodes as the first node, or a node corresponding to the CPU resource amount closest to the CPU resource quota of the service to be scheduled can be selected as the first node, and there is no limitation here.
[0061] S240, determine the memory resource difference based on the available memory resource amount of the first node and the memory resource quota of the service request to be scheduled, and based on the available memory resource amount and the memory resource difference of each node, select at least one second node that meets the memory resource difference from the target cluster.
[0062] Specifically, after determining the first node, obtain the available memory resources of the first node, calculate the difference between the available memory resources of the first node and the memory resource quota of the service request to be scheduled, obtain the memory resource difference, compare the memory resource difference with the available memory resources of each node in the target cluster, select at least one node that satisfies the memory resource difference, if there is a single node that satisfies the memory resource difference, then any node that satisfies the memory resource difference will be used as the second node, if there is no single node that satisfies the memory resource difference, determine whether there are two nodes or more than two nodes whose total memory resources satisfy the memory resource difference, if there are two nodes or more than two nodes whose total memory resources satisfy the memory resource difference, then multiple nodes that satisfy the memory resource difference will be used as second nodes.
[0063] Optionally, based on the available memory resources and the memory resource difference of each node, at least one second node that meets the memory resource difference is screened out from the target cluster, including: matching based on the memory resource difference and the available memory resources of each node to determine at least one node that meets the memory resource difference, selecting a node with the smallest available memory resources from at least one node that meets the resource difference, and using the node corresponding to the smallest available memory resources as the second node, wherein the available memory resources of any one of the at least one node that meets the memory resource difference meet the memory resource difference.
[0064] Specifically, the available memory resources of each node in the target cluster are matched with the memory resource difference respectively to determine at least one node that satisfies the memory resource difference, wherein the available memory resources of any node in the at least one node that satisfies the memory resource difference all satisfy the memory resource difference. If it is determined that there are multiple nodes that satisfy the memory resource difference, the node with the smallest available memory resources is selected as the second node.
[0065] Optionally, the method also includes: when all nodes in the target cluster do not meet the memory resource difference, matching is performed based on the memory resource difference and the available memory resources of each node, to determine multiple node combinations that meet the memory resource difference, and selecting a node combination with the smallest available memory resources and the least number of nodes from the multiple node combinations, and using each node in the selected node combination as a second node.
[0066] Specifically, when all nodes in the target cluster do not meet the memory resource difference, the available memory resources of each node in the target cluster are matched with the memory resource difference respectively, and multiple node combinations that can meet the memory resource difference are determined, each node combination includes at least two nodes, and the total available memory resources of each node in each node combination meet the memory resource difference. In the case of obtaining multiple node combinations, first select the combination with the least number of nodes from the multiple node combinations, and select the node combination with the least amount of available memory resources from the combination with the least number of nodes. Finally, select the node combination that meets the conditions of the least number of nodes and the smallest amount of available memory resources, and use each node in the node combination as the second node.
[0067] In this embodiment, based on the memory resource difference and the available memory resources of each node, a node or a combination of multiple nodes that meet the memory resource difference is determined, and the node corresponding to the available memory resources that meet the memory resource difference and are closest to the memory resource difference is selected as the second node, thereby preventing the generation of node resource fragmentation, helping to improve node resource utilization, reducing the number of memory request failures, and ensuring service stability.
[0068] S250: Form a target node set based on the first node and at least one second node.
[0069] Specifically, the screened first node and at least one second node that meet the memory resource quota of the service request to be scheduled are used as a target node set to schedule the service instance corresponding to the service request to be scheduled.
[0070] S260: Schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is used between the nodes in the target node set.
[0071] The technical solution of this embodiment is as follows: receiving a service request to be scheduled; obtaining node resource information of each node in the target cluster when detecting that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resource amount of the target cluster meets the resource quota of the service request to be scheduled; matching the CPU resource quota of the service request to be scheduled and the available CPU resource amount of each node, determining at least one node that meets the CPU resource quota, and taking any node of the at least one node as the first node, wherein any node of the at least one node that meets the CPU resource quota meets the CPU resource quota; determining a memory resource difference based on the available memory resource amount of the first node and the memory resource quota of the service request to be scheduled, and screening out at least one second node that meets the memory resource difference from the target cluster based on the available memory resource amount of each node and the memory resource difference; forming a target node set based on the first node and the at least one second node; scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is used between the nodes in the target node set. This solution uses the node resource information of each node and the resource quota of the service request to be scheduled to screen out the target node set that meets the resource quota of the service request to be scheduled from the target cluster, thereby realizing the elastic scheduling of the node resources in the cluster to meet the service request to be scheduled. It can aggregate the fragmented memory resources and meet the memory resource quota through the memory resources of multiple nodes, so that the target node set can meet both the CPU resource quota and the memory resource quota. There is no need to apply for more node resources when the node resources are insufficient, thus avoiding the problems of resource waste and node fragmentation and improving the node resource utilization.
[0072] Embodiment 3
[0073] Figure 3 It is a structural diagram of a node resource scheduling device provided in Embodiment 3 of the present invention.
[0074] like Figure 3 As shown, the device comprises:
[0075] The to-be-scheduled service request receiving module 310 is used to receive the to-be-scheduled service request;
[0076] The target node set determination module 320 is used to obtain the node resource information of each node in the target cluster when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resource amount of the target cluster meets the resource quota of the service request to be scheduled, and screen out the target node set that meets the resource quota of the service request to be scheduled from the target cluster based on the node resource information of each node and the resource quota of the service request to be scheduled, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resource amount of the first node meets the CPU resource quota, and the sum of the available resource amounts corresponding to the first node and the second node meets the memory resource quota;
[0077] The target node set scheduling module 330 is used to schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is adopted between each node in the target node set.
[0078] The technical solution of this embodiment is to receive the service request to be scheduled through the service request to be scheduled receiving module; the target node set determination module obtains the node resource information of each node in the target cluster when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resource amount of the target cluster meets the resource quota of the service request to be scheduled, and screens out the target node set that meets the resource quota of the service request to be scheduled from the target cluster based on the node resource information of each node and the resource quota of the service request to be scheduled, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resource amount of the first node meets the CPU resource quota, and the sum of the available resource amounts corresponding to the first node and the second node meets the memory resource quota; the target node set scheduling module schedules the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is used between the nodes in the target node set. This solution uses the node resource information of each node and the resource quota of the service request to be scheduled to screen out the target node set that meets the resource quota of the service request to be scheduled from the target cluster, thereby realizing the elastic scheduling of the node resources in the cluster to meet the service request to be scheduled. It can aggregate the fragmented memory resources and meet the memory resource quota through the memory resources of multiple nodes, realize cross-node resource calling, so that the target node set can meet both the CPU resource quota and the memory resource quota. There is no need to apply for more node resources when the node resources are insufficient, thus avoiding the problems of resource waste and node fragmentation and improving the node resource utilization.
[0079] On the basis of the above embodiment, optionally, the node resource information includes available CPU resources and available memory resources; the target node set determination module 320 includes a first node determination unit, a second node determination unit and a target node set determination unit, the first node determination unit is used to match the CPU resource quota of the service request to be scheduled and the available CPU resources of each node, determine at least one node that meets the CPU resource quota, and use any one of the at least one node as the first node, wherein any one of the at least one node that meets the CPU resource quota meets the CPU resource quota; the second node determination unit is used to determine the memory resource difference based on the available memory resources of the first node and the memory resource quota of the service request to be scheduled, and based on the available memory resources of each node and the memory resource difference, filter out at least one second node that meets the memory resource difference from the target cluster; the target node set determination unit is used to form a target node set based on the first node and the at least one second node.
[0080] Optionally, the second node determination unit is specifically used to match the memory resource difference with the available memory resources of each node, determine at least one node that meets the memory resource difference, select the node with the smallest available memory resources from the at least one node that meets the resource difference, and use the node corresponding to the smallest available memory resources as the second node, wherein the available memory resources of any node in the at least one node that meets the memory resource difference meet the memory resource difference. The second node determination unit is also specifically used to match the memory resource difference with the available memory resources of each node to determine multiple node combinations that meet the memory resource difference when all nodes in the target cluster do not meet the memory resource difference, select the node combination with the smallest available memory resources and the least number of nodes from the multiple node combinations, and use each node in the selected node combination as the second node.
[0081] Optionally, after receiving the service request to be scheduled, the device is specifically used to traverse the node resource information of each node in the target cluster, determine the available resources of each node and the total available resources of the target cluster; judge whether the available resources of each node meet the resource quota of the service request to be scheduled, and whether the total available resources of the target cluster meet the resource quota of the service request to be scheduled.
[0082] Optionally, the target node set scheduling module 330 is specifically used to enable the first node to access each second node through remote direct memory access, and schedule the service instance corresponding to the service request to be scheduled to the first node and each second node.
[0083] Optionally, after scheduling the service instance corresponding to the service request to be scheduled to each node in the target node set, the device is also specifically used to update the available resource information of the corresponding node in the target storage space according to the resource scheduling information of each node in the target node set; after the execution of the service request to be scheduled is completed, the resources of each node in the target node set are released.
[0084] The node resource scheduling device provided in the embodiment of the present invention can execute the node resource scheduling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0085] Embodiment 4
[0086] Figure 4 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0087] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0088] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0089] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a node resource scheduling method.
[0090] In some embodiments, the node resource scheduling method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the node resource scheduling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the node resource scheduling method in any other appropriate manner (e.g., by means of firmware).
[0091] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0092] The computer program for implementing the node resource scheduling method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server.
[0093] Embodiment 5
[0094] Embodiment 5 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a node resource scheduling method, the method comprising:
[0095] Receive a service request to be dispatched;
[0096] When it is detected that the available resources of each node in the target cluster do not satisfy the resource quota of the service request to be scheduled and the total available resources of the target cluster satisfy the resource quota of the service request to be scheduled, obtain the node resource information of each node in the target cluster, and based on the node resource information of each node and the resource quota of the service request to be scheduled, screen out a set of target nodes that satisfy the resource quota of the service request to be scheduled from the target cluster, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resources of the first node satisfy the CPU resource quota, and the sum of the available resources corresponding to the first node and the second node satisfy the memory resource quota;
[0097] The service instance corresponding to the service request to be scheduled is scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set.
[0098] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0099] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0100] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0101] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0102] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0103] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A node resource scheduling method, characterized in that: include: Receive a service request to be dispatched; When it is detected that the available resources of each node in the target cluster do not satisfy the resource quota of the service request to be scheduled and the total available resources of the target cluster satisfy the resource quota of the service request to be scheduled, obtain the node resource information of each of the nodes in the target cluster, and based on the node resource information of each of the nodes and the resource quota of the service request to be scheduled, filter out a set of target nodes that satisfy the resource quota of the service request to be scheduled from the target cluster, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resources of the first node satisfy the CPU resource quota, and the sum of the available resources corresponding to the first node and the second node satisfy the memory resource quota; The service instance corresponding to the to-be-scheduled service request is scheduled to each node in the target node set, wherein remote direct memory access is adopted between the nodes in the target node set.
2. The method according to claim 1, characterized in that The node resource information includes available CPU resources and available memory resources; The step of screening out a target node set that satisfies the resource quota of the service request to be scheduled from the target cluster based on the node resource information of each node and the resource quota of the service request to be scheduled includes: Based on the matching of the CPU resource quota of the service request to be scheduled and the available CPU resource amount of each of the nodes, at least one node that meets the CPU resource quota is determined, and any one of the at least one node is used as the first node, wherein any one of the at least one node that meets the CPU resource quota meets the CPU resource quota; Determine a memory resource difference based on the available memory resource amount of the first node and the memory resource quota of the service request to be scheduled, and select at least one second node that satisfies the memory resource difference from the target cluster based on the available memory resource amount of each node and the memory resource difference; The target node set is formed based on the first node and the at least one second node.
3. The method according to claim 2, characterized in that The step of selecting at least one second node that satisfies the memory resource difference from the target cluster based on the available memory resource amount of each of the nodes and the memory resource difference includes: Based on the matching of the memory resource difference and the available memory resources of each of the nodes, at least one node that meets the memory resource difference is determined, and the node with the smallest available memory resources is selected from the at least one node that meets the resource difference, and the node corresponding to the smallest available memory resources is used as the second node, wherein the available memory resources of any node among the at least one node that meets the memory resource difference meet the memory resource difference.
4. The method according to claim 3, characterized in that The method also includes: In the case that none of the nodes in the target cluster meets the memory resource difference, a plurality of node combinations that meet the memory resource difference are determined based on matching the memory resource difference with the available memory resources of each node, and a node combination with the smallest available memory resources and the least number of nodes is selected from the plurality of node combinations, and each node in the selected node combination is used as the second node.
5. The method according to claim 1, characterized in that After receiving the request for a service to be scheduled, the method includes: Traversing the node resource information of each of the nodes in the target cluster, and determining the available resource amount of each of the nodes and the total available resource amount of the target cluster; It is determined whether the available resource amount of each of the nodes satisfies the resource quota of the service request to be scheduled, and whether the total available resource amount of the target cluster satisfies the resource quota of the service request to be scheduled.
6. The method according to claim 1, characterized in that The step of scheduling the service instance corresponding to the to-be-scheduled service request to each node in the target node set includes: The first node accesses each of the second nodes through remote direct memory access, and schedules the service instance corresponding to the to-be-scheduled service request to the first node and each of the second nodes.
7. The method according to claim 1, characterized in that After scheduling the service instance corresponding to the to-be-scheduled service request to each node in the target node set, the method further includes: The available resource information of the corresponding node in the target storage space is updated according to the resource scheduling information of each node in the target node set; after the execution of the to-be-scheduled service request is completed, the resources of each node in the target node set are released.
8. A node resource scheduling device, characterized in that: include: A module for receiving service requests to be scheduled, used for receiving service requests to be scheduled; A target node set determination module is used to obtain node resource information of each node in the target cluster when it is detected that the available resource amount of each node in the target cluster does not meet the resource quota of the service request to be scheduled and the total available resources of the target cluster meets the resource quota of the service request to be scheduled, and screen out a target node set that meets the resource quota of the service request to be scheduled from the target cluster based on the node resource information of each node and the resource quota of the service request to be scheduled, wherein the resource quota includes a memory resource quota and a CPU resource quota, the target node set includes a first node and at least one second node, the available resource amount of the first node meets the CPU resource quota, and the sum of the available resource amounts corresponding to the first node and the second node meets the memory resource quota; The target node set scheduling module is used to schedule the service instance corresponding to the service request to be scheduled to each node in the target node set, wherein remote direct memory access is adopted between each node in the target node set.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the node resource scheduling method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the node resource scheduling method according to any one of claims 1 to 7 when executed.