Cluster resource scheduling method and device, electronic equipment and storage medium

By acquiring predicted utilization data of worker nodes and containers, calculating resource idle rate, and selecting the most suitable worker node for business unit scheduling, the problem of imbalance of resource scheduling strategies for worker nodes in existing technologies is solved, thereby improving the resource balance and utilization of the cluster.

CN116302530BActive Publication Date: 2026-01-16JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310250568.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2026-01-16
Estimated Expiration
2043-03-15

AI Technical Summary

Technical Problem

In existing technologies, resource scheduling for business units is based on custom resource consumption, which affects the resource balance and performance of work nodes.

Method used

By acquiring predicted utilization data of worker nodes and containers, the resource idle rate is calculated, the most suitable worker node is selected for business unit scheduling, and scheduling decisions are made in combination with the actual resource consumption of nodes and containers.

Benefits of technology

It improves the resource balance and utilization of the cluster and solves the problem of uneven resource scheduling strategy on worker nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302530B_ABST
    Figure CN116302530B_ABST
Patent Text Reader

Abstract

The present disclosure provides a cluster resource scheduling method and device, electronic equipment and storage medium, which can be applied to the fields of cloud computing technology, container technology and computer technology. The method comprises: in response to a resource scheduling request, determining a target service unit to be scheduled, wherein the target service unit comprises a plurality of first target containers; obtaining node usage rate prediction data of a plurality of working nodes included in a cluster and application usage rate prediction data of the plurality of first target containers respectively from a prediction database; determining resource idle rates of the plurality of working nodes based on the node usage rate prediction data of the plurality of working nodes and the application usage rate prediction data of the plurality of first target containers; determining a first target working node from the plurality of working nodes based on the resource idle rates of the plurality of working nodes; and scheduling the target service unit to the first target working node.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of cloud computing, the technical field of containers, and the technical field of computers, and more particularly, to a cluster resource scheduling method and device, an electronic device, and a storage medium. BACKGROUND

[0002] A business unit is the smallest unit that can be created and managed in k8s (kubernetes, a container cluster management system) and is the smallest resource object model created or deployed by a user in a resource object model. The business unit can be composed of one or more containers, which can be used to run business applications.

[0003] In related technologies, the resource scheduling of a business unit is usually implemented according to the resource consumption declared in the business unit, and the resource consumption declared by the business unit is usually customized by business personnel, and the size of the resource consumption is irrelevant to the actual resource consumption of the business unit after node allocation. Therefore, when the method in the related technology is used to schedule resources for a business unit, at least there are problems of affecting the overall resource balance of the worker node and reducing the performance of the worker node. SUMMARY

[0004] Therefore, the present disclosure provides a cluster resource scheduling method, device, electronic device, readable storage medium, and computer program product.

[0005] One aspect of the present disclosure provides a cluster resource scheduling method, comprising: in response to a resource scheduling request, determining a target business unit to be scheduled, wherein the target business unit includes a plurality of first target containers; obtaining node usage rate prediction data of a plurality of worker nodes included in a cluster and application usage rate prediction data of the plurality of first target containers from a prediction database, respectively; determining resource idle rates of the plurality of worker nodes based on the node usage rate prediction data of the plurality of worker nodes and the application usage rate prediction data of the plurality of first target containers, respectively; determining a first target worker node from the plurality of worker nodes based on the resource idle rates of the plurality of worker nodes; and scheduling the target business unit to the first target worker node.

[0006] According to an embodiment of the present disclosure, the resource of the work node comprises a plurality of sub-resources; wherein the determining of the resource idle rate of each work node based on the node usage rate prediction data of each work node and the application usage rate prediction data of each first target container comprises: for each work node, obtaining node metadata of the work node by using the interaction component; determining the total resource quantity of each sub-resource of the work node based on the node metadata of the work node; determining the predicted resource usage quantity of each sub-resource of the work node based on the node usage rate prediction data of the work node and the application usage rate prediction data of each first target container; and determining the resource idle rate of the work node based on the predicted resource usage quantity of each sub-resource and the total resource quantity of each sub-resource.

[0007] According to an embodiment of the present disclosure, the method further comprises: in response to the second target work node satisfying a first preset condition, obtaining node metadata of the second target work node by using the interaction component; obtaining time sequence monitoring data of the second target work node in a first preset time period from the monitoring platform based on the node metadata of the second target work node; determining the node usage rate prediction data of the second target work node based on the time sequence monitoring data of the second target work node; and writing the node usage rate prediction data of the second target work node into the prediction database.

[0008] According to an embodiment of the present disclosure, the first preset condition comprises that the update interval length of the node usage rate prediction data of the second target work node is greater than or equal to a first preset length, or the second target work node runs a business unit.

[0009] According to an embodiment of the present disclosure, the method further comprises: in response to the second target container satisfying a second preset condition, obtaining container metadata of the second target container by using the interaction component; obtaining time sequence monitoring data of the second target container in a second preset time period from the monitoring platform based on the container metadata of the second target container; determining the application usage rate prediction data of the second target container based on the time sequence monitoring data of the second target container; and writing the application usage rate prediction data of the second target container into the prediction database.

[0010] According to an embodiment of the present disclosure, the second preset condition comprises that the update interval length of the application usage rate prediction data of the second target container is greater than or equal to a second preset length, and the second target container triggers a container change event, wherein the container change event comprises container creation and container destruction.

[0011] Another aspect of the present disclosure provides a cluster resource scheduling apparatus, comprising: a first determining module configured to determine a target service unit to be scheduled in response to a resource scheduling request, wherein the target service unit comprises a plurality of first target containers; a first obtaining module configured to obtain node usage rate prediction data of each of a plurality of worker nodes comprised in the cluster and application usage rate prediction data of each of the plurality of first target containers from a prediction database respectively; a second determining module configured to determine resource idle rate of each of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers; a third determining module configured to determine a first target worker node from the plurality of worker nodes based on the resource idle rate of each of the plurality of worker nodes; and a scheduling module configured to schedule the target service unit to the first target worker node.

[0012] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory configured to store one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method as described above.

[0013] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the instructions, when executed, implement the method as described above.

[0014] Another aspect of the present disclosure provides a computer program product, comprising computer-executable instructions, wherein the instructions, when executed, implement the method as described above.

[0015] According to embodiments of the present disclosure, when performing resource scheduling of a target service unit, the node usage rate prediction data of each worker node can be used as the actual resource consumption of each worker node, and the application usage rate prediction data of each first target container comprised in the target service unit can be used as the actual resource consumption of the target service unit, and the selection of a first target worker node and the scheduling of the target service unit can be performed based on the actual resource consumption of each worker node and the actual resource consumption of the target service unit, so that the problem that the resource scheduling strategy in the related art affects the resource balance and the working performance of the worker nodes can be at least partially overcome, and the resource balance of the cluster as a whole is effectively improved, and the resource utilization rate is improved. BRIEF DESCRIPTION OF DRAWINGS

[0016] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:

[0017] Figure 1An exemplary system architecture to which the cluster resource scheduling method and apparatus according to embodiments of the present disclosure can be applied is schematically shown.

[0018] Figure 2 A flowchart of the cluster resource scheduling method according to embodiments of the present disclosure is schematically shown.

[0019] Figure 3A An update method of node usage rate prediction data according to embodiments of the present disclosure is schematically shown.

[0020] Figure 3B An update method of application usage rate prediction data according to embodiments of the present disclosure is schematically shown.

[0021] Figure 4 A flowchart of the resource idle rate calculation method according to embodiments of the present disclosure is schematically shown.

[0022] Figure 5 A block diagram of the cluster resource scheduling apparatus according to embodiments of the present disclosure is schematically shown.

[0023] Figure 6 A block diagram of an electronic device suitable for implementing the cluster resource scheduling method according to embodiments of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description which follows is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. However, it will be apparent to one skilled in the art that one or more embodiments of the present disclosure can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present disclosure.

[0025] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include", "comprise", and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0026] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present description, and should not be interpreted in an idealized or overly formal manner.

[0027] In the case of using expressions such as "at least one of A, B, and C", it generally should be understood that such expressions are used to indicate only that one of A, B, or C is required among the identified possibilities (e.g., A, B, and C - such conjunctions are simply intended to open up additional syntactical possibilities, such as for example purposes). In the case of using expressions such as "at least one of A, B, or C", it generally should be understood that such expressions are used to indicate only that one of A, B, or C is required among the identified possibilities (e.g., A, B, or C - such conjunctions are simply intended to open up additional syntactical possibilities, such as for example purposes).

[0028] Kube-scheduler is a scheduler of a k8s cluster, which is used to bind a user-created service unit to a suitable worker node in the cluster according to a specific scheduling algorithm and scheduling strategy. In the related art, the scheduling process can be divided into two stages, namely, a pre-selection stage and a selection stage. In the pre-selection stage, the scheduler can filter out the worker nodes that do not meet the minimum resource requirement of the service unit submitted by the user. In the selection stage, the scheduler can collect the resource surplus of the remaining worker nodes to score, and select the worker node with the highest score as the deployment node, and bind the service unit to the deployment node.

[0029] Since in the related art, the resource scheduling of the service unit is usually implemented according to the resource consumption declared in the service unit, and the resource consumption declared by the service unit is usually customized by the business personnel, the size of the resource consumption is irrelevant to the actual resource consumption of the service unit after node allocation. Therefore, when the method in the related art is used to schedule the resources of the service unit, at least the problems of affecting the overall resource balance of the worker node and reducing the performance of the worker node exist.

[0030] Therefore, the embodiments of the present disclosure provide a cluster resource scheduling method, device, electronic equipment, readable storage medium and computer program product, which comprises: in response to a resource scheduling request, determining a target service unit to be scheduled, wherein the target service unit comprises a plurality of first target containers; obtaining node usage rate prediction data of a plurality of worker nodes included in the cluster and application usage rate prediction data of the plurality of first target containers from a prediction database respectively; determining resource idle rates of the plurality of worker nodes based on the node usage rate prediction data of the plurality of worker nodes and the application usage rate prediction data of the plurality of first target containers respectively; determining a first target worker node from the plurality of worker nodes based on the resource idle rates of the plurality of worker nodes; and scheduling the target service unit to the first target worker node.

[0031] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations, necessary security measures are taken, and the public order and good customs are not violated.

[0032] In the technical solutions of the present disclosure, the authorization or consent of the user is obtained before the user personal information is acquired or collected.

[0033] It should be noted that, unless it is explicitly stated that there is an execution sequence between different operations or there is an execution sequence in the technical implementation between different operations, the execution sequence between multiple operations can not be distinguished, and multiple operations can be executed simultaneously.

[0034] Figure 1 An exemplary system architecture to which the cluster resource scheduling method and apparatus according to the embodiments of the present disclosure can be applied is schematically shown. It should be noted that, Figure 1 The shown is only an example of a system architecture to which the embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0035] As Figure 1 shown, the system architecture 100 according to the embodiment can include terminal devices 101, 102, 103, 104 and a network 105.

[0036] The network 105 is a medium for providing a communication link between the terminal devices 101, 102, 103, 104. The network 105 can include various connection types, such as wired and / or wireless communication links, etc.

[0037] The terminal devices 101, 102, 103, 104 can include various servers or various electronic devices, the various servers can include local hosts, cloud servers, etc., and the various electronic devices can include computers, industrial terminals, etc.

[0038] The terminal devices 101, 102, 103, and 104 can join the k8s cluster as nodes, one of the terminal devices 101, 102, 103, and 104 (for example, the terminal device 101) can be a management node in the k8s cluster, accordingly, the cluster resource scheduling method provided in the embodiments of the present disclosure can be executed by the terminal device corresponding to the management node, that is, the terminal device 101, and the cluster resource scheduling apparatus provided in the embodiments of the present disclosure can be arranged in the terminal device 101. Alternatively, the terminal devices 101, 102, 103, and 104 can all join the k8s cluster as worker nodes, and the management node of the k8s cluster can be another terminal device capable of communicating with the terminal devices 101, 102, 103, and 104 through the network 105, accordingly, the cluster resource scheduling method provided in the embodiments of the present disclosure can be executed by the other terminal device capable of communicating with the terminal devices 101, 102, 103, and 104 through the network 105, and the cluster resource scheduling apparatus provided in the embodiments of the present disclosure can be arranged in the other terminal device capable of communicating with the terminal devices 101, 102, 103, and 104 through the network 105.

[0039] It should be understood that Figure 1 The number of terminal devices and networks in the above description is only illustrative. Any number of terminal devices and networks can be provided according to the needs of implementation.

[0040] Figure 2 A flowchart of a cluster resource scheduling method according to an embodiment of the present disclosure is schematically shown.

[0041] As shown in Figure 2 , the method includes operations S201-S205.

[0042] In operation S201, in response to a resource scheduling request, a target service unit to be scheduled is determined, wherein the target service unit includes a plurality of first target containers.

[0043] In operation S202, node usage rate prediction data of each of a plurality of worker nodes included in the cluster and application usage rate prediction data of each of the plurality of first target containers are respectively acquired from a prediction database.

[0044] In operation S203, based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers, a resource idle rate of each of the plurality of worker nodes is determined.

[0045] In operation S204, based on the resource idle rate of each of the plurality of worker nodes, a first target worker node is determined from the plurality of worker nodes.

[0046] In operation S205, the target service unit is scheduled to the first target worker node.

[0047] According to an embodiment of the present disclosure, the target service unit can be a minimum scheduling unit in the k8s cluster. Various applications can run in the first target container, including but not limited to engineering applications, web applications, etc. The same or different applications can run in the multiple first target containers included in the target service unit, which is not limited here.

[0048] According to an embodiment of the present disclosure, the prediction database can pre-store node usage rate prediction data of each worker node and application usage rate prediction data of each application that can run in the cluster. The application usage rate prediction data of the first target container can be determined based on the application usage rate prediction data of the applications running in the first target container. For example, applications A and B can run in the first target container, and the application usage rate prediction data of the first target container can be the sum of the application usage rate prediction data of application A and the application usage rate prediction data of application B.

[0049] According to an embodiment of the present disclosure, the prediction database can be various relational databases such as MYSQL, Oracle, etc., or various non-relational databases such as Redis, MongoDb, etc., and the type of the prediction database is not limited here.

[0050] According to an embodiment of the present disclosure, the node usage rate prediction data and the application usage rate prediction data can include the expected occupation amount of each resource in the worker node for the node or the application, and the resources can include CPU, memory, disk, network bandwidth, etc., which are not limited here.

[0051] According to an embodiment of the present disclosure, the resource idle rate can be represented as the ratio of the expected idle resource of the worker node to the total amount of resources. The higher the resource idle rate, the higher the score of the worker node when performing resource scheduling, and the worker node is more likely to be bound to the target service unit as the first target worker node.

[0052] According to an embodiment of the present disclosure, when performing resource scheduling of the target service unit, the node usage rate prediction data of each worker node can be used as the actual resource consumption of each worker node, and the application usage rate prediction data of each first target container included in the target service unit can be used as the actual resource consumption of the target service unit, and the selection of the first target worker node and the scheduling of the target service unit can be performed based on the actual resource consumption of each worker node and the actual resource consumption of the target service unit. Therefore, the problem that the resource scheduling strategy in the related art can affect the resource balance and the working performance of the worker node can be at least partially overcome, the overall resource balance of the cluster is effectively improved, and the resource utilization rate is improved.

[0053] The following refers toFigure 3A 、 Figure 3B and Figure 4 , in combination with the specific embodiments, further illustrate the method shown in Figure 2 .

[0054] According to embodiments of the present disclosure, a monitoring platform such as prometheus or the like can be deployed in the k8s cluster, which can collect resource usage of each worker node in the cluster, usage rate of each container, and the like. The time series monitoring data collected can be stored in the storage medium of the monitoring platform.

[0055] According to embodiments of the present disclosure, the node usage rate prediction data and the application usage rate prediction data stored in the prediction database can be updated based on the collected time series monitoring data when certain conditions are met, so as to guarantee the reliability of the prediction data.

[0056] Figure 3A An update method of node usage rate prediction data according to embodiments of the present disclosure is schematically shown.

[0057] As shown in Figure 3A , the method comprises operations S301-S304.

[0058] In operation S301, in response to the second target worker node satisfying the first preset condition, the node metadata of the second target worker node is obtained by using the interaction component.

[0059] In operation S302, based on the node metadata of the second target worker node, the time series monitoring data of the second target worker node within the first preset period is obtained from the monitoring platform.

[0060] In operation S303, based on the time series monitoring data of the second target worker node, the node usage rate prediction data of the second target worker node is determined.

[0061] In operation S304, the node usage rate prediction data of the second target worker node is written into the prediction database.

[0062] According to embodiments of the present disclosure, the second target worker node can refer to any one of the plurality of worker nodes of the k8s cluster.

[0063] According to an embodiment of the present disclosure, the first preset condition can include a periodic updating condition and a non-periodic updating condition. The periodic updating condition can be, for example, that the update interval length of the node usage rate prediction data of the second target worker node is greater than or equal to a first preset length, which can be set according to a specific application scenario. The non-periodic updating condition can be, for example, that a service unit is running in the second target worker node, that is, the service unit is scheduled to the second target worker node. Alternatively, the first preset condition can also include other conditions that can cause the resource amount of the second worker node to change, such as changes or damage to the hardware facilities of the second worker node.

[0064] According to an embodiment of the present disclosure, the interaction component can refer to a kube-apiserver component in the k8s cluster, through which data access to the storage unit of the k8s cluster can be achieved.

[0065] According to an embodiment of the present disclosure, the node metadata can be data describing the attributes of the worker node, for example, the node metadata can include description data of the address, hardware configuration, etc. of the worker node. Specifically, the node metadata of the second target worker node can include description data of various data related to the resources of the second target worker node.

[0066] According to an embodiment of the present disclosure, the first preset period can be set according to a specific application scenario, for example, can be set to 1 hour, 1 day, etc., which is not limited here.

[0067] According to an embodiment of the present disclosure, based on the node metadata of the second target worker node, the time series monitoring data of the second target worker node within the first preset period can be obtained from the monitoring platform, which can be according to the description data of various data related to resources included in the node metadata, respectively obtaining the time series monitoring data of the various data from the storage medium of the monitoring platform, and intercepting the data within the first preset period as the time series monitoring data of the second target worker node.

[0068] According to an embodiment of the present disclosure, the time series monitoring data of the second target worker node can include multiple groups of monitoring data, and the collection time intervals between each group of monitoring data can be equal, which can be, for example, 1 second, 0.5 seconds, etc. The node usage rate prediction data of the second target worker node determined based on the time series monitoring data of the second target worker node can be the average value of the multiple groups of monitoring data included in the time series monitoring data within the first preset period, or can be the average value of the peak values per minute in the multiple groups of monitoring data included in the time series monitoring data within the first preset period, which is not limited here.

[0069] According to an embodiment of the present disclosure, writing the node usage rate prediction data of the second target worker node into the prediction database can be replacing the node usage rate prediction data of the second target worker node originally in the prediction database with the currently generated node usage rate prediction data of the second target worker node.

[0070] Figure 3B An update method of application usage rate prediction data is shown schematically according to an embodiment of the present disclosure.

[0071] As Figure 3B shown, the method includes operations S311-S314.

[0072] In operation S311, in response to the second target container satisfying a second preset condition, container metadata of the second target container is acquired by using an interaction component.

[0073] In operation S312, based on the container metadata of the second target container, time series monitoring data of the second target container in a second preset time period is acquired from a monitoring platform.

[0074] In operation S313, based on the time series monitoring data of the second target container, application usage rate prediction data of the second target container is determined.

[0075] In operation S314, the application usage rate prediction data of the second target container is written into a prediction database.

[0076] According to an embodiment of the present disclosure, the second target container can refer to any one of the containers supportable in a k8s cluster.

[0077] According to an embodiment of the present disclosure, the second preset condition can include a periodic update condition and a non-periodic update condition. The periodic update condition can be, for example, that an update interval length of the application usage rate prediction data of the second target container is greater than or equal to a second preset length, which can be set according to a specific application scenario. The non-periodic update condition can be, for example, that the second target container triggers a container change event, which can include container creation, container destruction, etc. Alternatively, the second preset condition can also include other conditions that can cause the resource consumption of the second target container to change, for example, the application program running in the second target container has undergone version change, the environmental parameter configuration of the second target container has changed, etc.

[0078] According to an embodiment of the present disclosure, the container metadata can be data describing the attributes of the container, for example, the container metadata can include description data of the business application that the container can run, the specification information of the container, etc.

[0079] According to an embodiment of the present disclosure, the second preset time period can be set according to a specific application scenario, for example, can be set to 1 day, 7 days, etc., which is not limited herein.

[0080] According to an embodiment of the present disclosure, based on the time series monitoring data of the second target container, the application usage rate prediction data of the second target container can be determined, for example, a regression analysis can be performed on the time series monitoring data of the second target container by using a prediction algorithm such as random forest or K-nearest neighbor, to obtain the application usage rate prediction data of the second target container.

[0081] According to an embodiment of the present disclosure, writing the application usage rate prediction data of the second target container into the prediction database can be replacing the original application usage rate prediction data of the second target container in the prediction database with the currently generated application usage rate prediction data of the second target container.

[0082] According to an embodiment of the present disclosure, by updating the node usage rate prediction data and the application usage rate prediction data stored in the prediction database, the reliability of the prediction data can be guaranteed, thereby improving the resource balancing degree and utilization of the cluster.

[0083] According to an embodiment of the present disclosure, the schedulable resources in the worker node can include a plurality of sub-resources, for example, can include CPU, memory, disk, network bandwidth, IO speed, etc., which is not limited herein. Correspondingly, the update of the node usage rate prediction data or the application usage rate prediction data can include the update of the prediction data corresponding to each sub-resource in the node usage rate prediction data or the application usage rate prediction data, which is not described herein.

[0084] According to an embodiment of the present disclosure, the resource idle rate of each worker node can be determined according to the resource idle rate of each sub-resource in the worker node.

[0085] Figure 4 A flowchart of a resource idle rate calculation method according to an embodiment of the present disclosure is schematically shown.

[0086] As shown in Figure 4 , the method includes operations S401-S404.

[0087] In operation S401, for each worker node, the node metadata of the worker node is obtained by using the interaction component.

[0088] In operation S402, based on the node metadata of the worker node, the total amount of each sub-resource of the worker node is determined.

[0089] At operation S403, based on the node usage rate prediction data of the worker node and the application usage rate prediction data of each of the plurality of first target containers, a resource prediction usage amount of each of a plurality of sub-resources of the worker node is determined.

[0090] At operation S404, based on the resource prediction usage amount of each of the plurality of sub-resources and the total amount of resources of each of the plurality of sub-resources, a resource idle rate of the worker node is determined.

[0091] According to an embodiment of the present disclosure, the node metadata can be data describing the attributes of the worker node, for example, the node metadata can include description data of the address, hardware configuration, etc. of the worker node. Accordingly, the node metadata can include description data of the CPU, memory, disk, network configuration, interface transmission rate, etc. of the worker node, based on which the total amount of resources of each of the CPU, memory, disk, network bandwidth, IO speed, etc. can be determined.

[0092] According to an embodiment of the present disclosure, the node usage rate prediction data can include prediction data of each of the CPU, memory, disk, network bandwidth, IO speed, etc., and the application usage rate prediction data can include prediction data of each of the CPU, memory, disk, network bandwidth, IO speed, etc. The resource prediction usage amount of each sub-resource can be represented as the sum of the prediction data of the sub-resource in the node usage rate prediction data and the prediction data of the sub-resource in the application usage rate prediction data of the plurality of first target containers, as shown in formula (1):

[0093]

[0094] In formula (1), RFU(i) can represent the resource prediction usage amount of the i-th sub-resource, P node(i) may represent the prediction data of the i-th sub-resource in the node usage rate prediction data of the worker node, P(j) container(i) may represent the prediction data of the i-th sub-resource in the application usage rate prediction data of the j-th first target container, and n can represent the number of first target containers.

[0095] According to an embodiment of the present disclosure, the demands of different service applications for each sub-resource can be different, for example, the resource demand of application A for CPU and memory is high, and the resource demand for bandwidth is low, the resource demand of application B for CPU, memory and bandwidth is high, and the resource demand for IO speed and disk is low. Therefore, when determining the resource idle rate of the worker node based on the resource prediction usage amount of each of the plurality of sub-resources and the total amount of resources of each of the plurality of sub-resources, a weight value can be assigned to each sub-resource, and the configuration manner of the weight value is not limited herein, for example, the weight value of each sub-resource can be determined based on the amount of the sub-resource in the worker node.

[0096] According to an embodiment of the present disclosure, the resource idle rate of the worker node is determined based on the resource predicted usage of each of the plurality of sub-resources and the resource total amount of each of the plurality of sub-resources, which can be shown as formula (2):

[0097]

[0098] In formula (2), Ratio can represent the resource idle rate of the worker node, m can represent the number of items of the sub-resources, TR(i) can represent the resource total amount of the i-th item of the sub-resources, and weight(i) can represent the weight of the i-th item of the sub-resources.

[0099] According to an embodiment of the present disclosure, as an optional implementation, the calculated resource idle rate of the worker node can be converted into a score of the worker node, so as to determine the first target worker node based on the scores of the plurality of worker nodes. The manner of converting the resource idle rate of the worker node into the score of the worker node is not limited herein, for example, the score of the worker node can be a value between 0 and 10, and the score of the worker node score can be represented as score = 10 x Ratio.

[0100] Figure 5 A block diagram of a cluster resource scheduling apparatus according to an embodiment of the present disclosure is schematically shown.

[0101] As shown in Figure 5 The cluster resource scheduling apparatus 500 includes a first determination module 510, a first acquisition module 520, a second determination module 530, a third determination module 540, and a scheduling module 550.

[0102] The first determination module 510 is configured to determine a target service unit to be scheduled in response to a resource scheduling request, wherein the target service unit includes a plurality of first target containers.

[0103] The first acquisition module 520 is configured to acquire, from a prediction database, node usage rate prediction data of each of a plurality of worker nodes included in a cluster and application usage rate prediction data of each of a plurality of first target containers.

[0104] The second determination module 530 is configured to determine a resource idle rate of each of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers.

[0105] The third determination module 540 is configured to determine a first target worker node from the plurality of worker nodes based on the resource idle rate of each of the plurality of worker nodes.

[0106] The scheduling module 550 is configured to schedule the target service unit to the first target worker node.

[0107] According to an embodiment of the present disclosure, when performing resource scheduling of the target service unit, the node usage rate prediction data of each worker node can be taken as the actual resource consumption of each worker node, the application usage rate prediction data of each first target container included in the target service unit can be taken as the actual resource consumption of the target service unit, and the selection of the first target worker node and the scheduling of the target service unit are performed based on the actual resource consumption of each worker node and the actual resource consumption of the target service unit, so that the problem that the resource scheduling strategy in the related art affects the resource balance and the working performance of the worker node can be at least partially overcome, the resource balance of the whole cluster is effectively improved, and the resource utilization rate is improved.

[0108] According to an embodiment of the present disclosure, the resources of the worker node include a plurality of sub-resources.

[0109] According to an embodiment of the present disclosure, the second determination module 530 includes a first determination unit, a second determination unit, a third determination unit, and a fourth determination unit.

[0110] The first determination unit is configured to, for each worker node, acquire node metadata of the worker node by using the interaction component.

[0111] The second determination unit is configured to determine the total amount of resources of each of the plurality of sub-resources of the worker node based on the node metadata of the worker node.

[0112] The third determination unit is configured to determine the predicted usage amount of resources of each of the plurality of sub-resources of the worker node based on the node usage rate prediction data of the worker node and the application usage rate prediction data of each of the plurality of first target containers.

[0113] The fourth determination unit is configured to determine the resource idle rate of the worker node based on the predicted usage amount of resources of each of the plurality of sub-resources and the total amount of resources of each of the plurality of sub-resources.

[0114] According to an embodiment of the present disclosure, the cluster resource scheduling apparatus 500 further includes a second acquisition module, a third acquisition module, a fourth determination module, and a first writing module.

[0115] The second acquisition module is configured to, in response to the second target worker node satisfying the first preset condition, acquire node metadata of the second target worker node by using the interaction component.

[0116] The third acquisition module is configured to acquire, based on the node metadata of the second target worker node, time sequence monitoring data of the second target worker node in a first preset time period from the monitoring platform.

[0117] The fourth determining module is configured to determine node usage rate prediction data of the second target worker node based on timing monitoring data of the second target worker node.

[0118] The first writing module is configured to write the node usage rate prediction data of the second target worker node into the prediction database.

[0119] According to an embodiment of the present disclosure, the first preset condition comprises that an update interval length of the node usage rate prediction data of the second target worker node is greater than or equal to a first preset length, or the second target worker node runs a service unit.

[0120] According to an embodiment of the present disclosure, the cluster resource scheduling apparatus 500 further comprises a fourth obtaining module, a fifth obtaining module, a fifth determining module and a second writing module.

[0121] The fourth obtaining module is configured to, in response to the second target container satisfying a second preset condition, obtain container metadata of the second target container by using the interaction component.

[0122] The fifth obtaining module is configured to obtain timing monitoring data of the second target container in a second preset time period from the monitoring platform based on the container metadata of the second target container.

[0123] The fifth determining module is configured to determine application usage rate prediction data of the second target container based on the timing monitoring data of the second target container.

[0124] The second writing module is configured to write the application usage rate prediction data of the second target container into the prediction database.

[0125] According to an embodiment of the present disclosure, the second preset condition comprises that an update interval length of the application usage rate prediction data of the second target container is greater than or equal to a second preset length, and the second target container triggers a container change event, wherein the container change event comprises container creation and container destruction.

[0126] Any of the modules, sub-modules, units, sub-units, or at least part of any of them according to the embodiments of the present disclosure can be implemented in one module. Any of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be split into multiple modules for implementation. Any of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be implemented at least in part as a hardware circuit, for example, a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware by integrating or packaging circuits, or in any one of software, hardware, and firmware, or in a proper combination of any of them. Alternatively, one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be implemented at least in part as computer program modules, which can perform corresponding functions when running.

[0127] For example, any of the first determining module 510, the first obtaining module 520, the second determining module 530, the third determining module 540, and the scheduling module 550 can be combined in one module / unit / sub-unit for implementation, or any of them can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of the modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units, and implemented in one module / unit / sub-unit. According to the embodiments of the present disclosure, at least one of the first determining module 510, the first obtaining module 520, the second determining module 530, the third determining module 540, and the scheduling module 550 can be implemented at least in part as a hardware circuit, for example, a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware by integrating or packaging circuits, or in any one of software, hardware, and firmware, or in a proper combination of any of them. Alternatively, at least one of the first determining module 510, the first obtaining module 520, the second determining module 530, the third determining module 540, and the scheduling module 550 can be implemented at least in part as computer program modules, which can perform corresponding functions when running.

[0128] It should be noted that the cluster resource scheduling device part in the embodiments of the present disclosure corresponds to the cluster resource scheduling method part in the embodiments of the present disclosure, and the description of the cluster resource scheduling device part is specifically referred to the cluster resource scheduling method part, which will not be repeated here.

[0129] Figure 6 A block diagram of an electronic device suitable for implementing a cluster resource scheduling method according to an embodiment of the present disclosure is shown schematically. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0130] like[ Figure 6 As shown, a computer electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0131] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0132] According to an embodiment of the present disclosure, the electronic device 600 can further include an input / output (I / O) interface 605 that is also connected to the bus 604. The electronic device 600 can further include one or more of the following components connected to the I / O interface 605: an input part 606 including, for example, a keyboard and a mouse; an output part 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage part 608 including, for example, a hard disk; and a communication part 609 including, for example, a LAN card, a modem, and the like. The communication part 609 performs communication processing via a network such as the Internet. A driver 610 is also connected to the I / O interface 605 as necessary. A removable medium 611 such as a magnetic disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the driver 610 as necessary, so that a computer program read therefrom is installed into the storage part 608 as necessary.

[0133] According to an embodiment of the present disclosure, the method flow according to the embodiment of the present disclosure can be implemented as a computer software program. For example, the embodiment of the present disclosure includes a computer program product including a computer program carried on a computer-readable storage medium, the computer program containing program codes for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network by the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-described functions defined in the system, device, apparatus, module, unit, and the like of the embodiment of the present disclosure are performed. According to an embodiment of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by computer program modules.

[0134] The present disclosure also provides a computer-readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, which when executed, implement the method according to the embodiment of the present disclosure.

[0135] According to an embodiment of the present disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. For example, it can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0136] For example, according to an embodiment of the present disclosure, the computer-readable storage medium can include one or more memories other than the ROM 602 and / or the RAM 603 and / or the ROM 602 and the RAM 603 described above.

[0137] Embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the method provided by the embodiments of the present disclosure, and when the computer program product is run on an electronic device, the program codes are used to make the electronic device implement the cluster resource scheduling method provided by the embodiments of the present disclosure.

[0138] When the computer program is executed by the processor 601, the above-mentioned functions defined in the system / apparatus of the embodiments of the present disclosure are performed. According to an embodiment of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.

[0139] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed through the communication part 609, and / or be installed from the detachable medium 611. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination of the above.

[0140] According to an embodiment of the present disclosure, the program codes of the computer program for executing the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented by using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes but is not limited to, for example, Java, C++, python, “C” language, or similar programming language. The program codes can be executed entirely on a user computing device, partially on a user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected through the Internet by using an Internet service provider).

[0141] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features recited in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not expressly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0142] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A cluster resource scheduling method, comprising: determining a target service unit to be scheduled in response to a resource scheduling request, wherein the target service unit comprises a plurality of first target containers; acquiring node usage rate prediction data of each of a plurality of worker nodes included in a cluster and application usage rate prediction data of each of the plurality of first target containers from a prediction database respectively; determining a resource idle rate of each of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers; determining a first target worker node from the plurality of worker nodes based on the resource idle rate of each of the plurality of worker nodes; and scheduling the target service unit to the first target worker node, wherein the resource of the worker node comprises a plurality of sub-resources, wherein the determining the resource idle rate of each of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers comprises: for each of the worker nodes, acquiring node metadata of the worker node by an interaction component; determining a total amount of each of the plurality of sub-resources of the worker node based on the node metadata of the worker node; determining a predicted usage amount of each of the plurality of sub-resources of the worker node as a sum of prediction data corresponding to the sub-resource in the node usage rate prediction data and prediction data corresponding to the sub-resource in the application usage rate prediction data of the plurality of first target containers based on the node usage rate prediction data of the worker node and the application usage rate prediction data of the plurality of first target containers; allocating a weight value to each of the plurality of sub-resources; and determining the resource idle rate of the worker node based on the predicted usage amount of each of the plurality of sub-resources, the total amount of each of the plurality of sub-resources, and the weight value of each of the plurality of sub-resources. 2.The method of claim 1, further comprising: in response to a second target worker node satisfying a first preset condition, acquiring node metadata of the second target worker node by an interaction component; acquiring time series monitoring data of the second target worker node in a first preset time period from a monitoring platform based on the node metadata of the second target worker node; determining node usage rate prediction data of the second target worker node based on the time series monitoring data of the second target worker node; and writing the node usage rate prediction data of the second target worker node into the prediction database. The first preset condition comprises that an update interval length of the node usage rate prediction data of the second target worker node is greater than or equal to a first preset length, or a service unit is running in the second target worker node.

3. The method of claim 2, wherein, 4.The method of claim 1, further comprising: in response to a second target container satisfying a second preset condition, acquiring container metadata of the second target container by an interaction component; acquiring time series monitoring data of the second target container in a second preset time period from a monitoring platform based on the container metadata of the second target container; and ​ determine application usage rate prediction data of the second target container based on the time series monitoring data of the second target container; and write the application usage rate prediction data of the second target container into the prediction database.

5. The method of claim 4, wherein, The second preset condition includes that an update interval length of the application usage rate prediction data of the second target container is greater than or equal to a second preset length, and the second target container triggers a container change event, wherein the container change event includes container creation and container destruction.

6. A cluster resource scheduling apparatus, comprising: a first determination module configured to determine a target service unit to be scheduled in response to a resource scheduling request, wherein the target service unit comprises a plurality of first target containers; a first acquisition module configured to acquire, from a prediction database, node usage rate prediction data of each of a plurality of worker nodes included in a cluster and application usage rate prediction data of each of the plurality of first target containers; a second determination module configured to determine resource idle rates of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers; a third determination module configured to determine a first target worker node from the plurality of worker nodes based on the resource idle rates of the plurality of worker nodes; and a scheduling module configured to schedule the target service unit to the first target worker node, wherein the resource of the worker node comprises a plurality of sub-resources, wherein the determination of the resource idle rates of the plurality of worker nodes based on the node usage rate prediction data of each of the plurality of worker nodes and the application usage rate prediction data of each of the plurality of first target containers comprises: for each of the worker nodes, acquiring node metadata of the worker node by using an interaction component; determining resource total amounts of the plurality of sub-resources of the worker node based on the node metadata of the worker node; determining resource prediction usage amounts of the plurality of sub-resources of the worker node as a sum of prediction data corresponding to the sub-resource in the node usage rate prediction data and prediction data corresponding to the sub-resource in the application usage rate prediction data of the plurality of first target containers based on the node usage rate prediction data of the worker node and the application usage rate prediction data of the plurality of first target containers; allocating a weight value to each of the plurality of sub-resources; and determining the resource idle rate of the worker node based on the resource prediction usage amounts of the plurality of sub-resources, the resource total amounts of the plurality of sub-resources, and the weight values of the plurality of sub-resources.

7. An electronic device, comprising: one or more processors; a memory configured to store one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the method of any one of claims 1 to 5.

9. A computer program product comprising computer-executable instructions for implementing the method of any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Task scheduling method and device

    CN114327881A

  • Resource scheduling method and electronic equipment

    CN115756857A