Resource scheduling method, device, equipment and medium

By receiving resource application requests in the Kubernetes cluster federation, using the cluster monitoring database to optimize resource allocation, selecting target clusters and allocating resource objects, the problem of poor resource scheduling caused by the increase in the number of clusters is solved, and efficient resource scheduling is achieved.

CN113760446BActive Publication Date: 2025-09-12BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110086447.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-22
Publication Date
2025-09-12
Estimated Expiration
2041-01-22

AI Technical Summary

Technical Problem

In Kubernetes cluster federation, as the number of clusters increases, resource scheduling between multiple clusters becomes ineffective. Existing technologies suffer from performance bottlenecks and low resource allocation efficiency.

Method used

By receiving resource application requests, obtaining parameter information of resource objects, using the cluster monitoring database to determine the resource sequence, selecting the target cluster and allocating resource objects, considering resource specifications, quantity and regional location, the resource allocation process is optimized.

Benefits of technology

It improves the resource scheduling efficiency between multiple clusters without the need to transform the cluster federation architecture. It is applicable to different cluster federations, improves the resource scheduling effect, and is applicable to different cluster federations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760446B_ABST
    Figure CN113760446B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a resource scheduling method, apparatus, device and medium. The method includes: obtaining parameter information of the resource object according to a resource application request for applying to create one or more resource objects, the parameter information including the resource specifications of the resource object and the application quantity of the resource object; determining a first resource sequence according to the resource specifications and the cluster monitoring database, the first resource sequence including the correspondence between at least one first cluster and the amount of resource objects that can be created, the cluster monitoring database being used to record the host information and resource object information of multiple clusters; determining the target cluster and the resource object allocation amount corresponding to the target according to the application quantity and the first resource sequence; sending a request to create a resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on the host machine in the target cluster. The method of the embodiment of the present disclosure improves the resource scheduling effect between multiple clusters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of cloud computing in the field of computer technology, and more particularly to a resource scheduling method, apparatus, device, and medium. Background Art

[0002] In the field of cloud computing, container technology is often used to deploy applications on host machines. A container is a collection of multiple processes. The processes in different containers are isolated from each other, preventing resource competition between processes in different containers and enabling rapid deployment across different clouds and hosts.

[0003] With the development of container technology, a variety of container orchestration technologies have emerged—techniques for running and coordinating containerized applications across multiple hosts. Among them, Kubernetes (K8s), a technology for running and coordinating containerized applications across a group of hosts, has emerged as a leader due to its advanced technology and increasingly mature implementation solutions. Kubernetes Cluster Federation is a distributed container scheduling system with multiple clusters. A cluster manages multiple hosts, each of which may have one or more containers deployed. Each container must apply for resources before deployment.

[0004] Therefore, as the number of clusters increases, how to improve the resource scheduling effect between multiple clusters is an urgent problem that needs to be solved. Summary of the Invention

[0005] Embodiments of the present disclosure provide a resource scheduling method, apparatus, device, and medium to solve the problem of poor resource scheduling effect among multiple clusters.

[0006] In a first aspect, an embodiment of the present disclosure provides a resource scheduling method, including:

[0007] receiving a resource application request from a terminal device, wherein the resource application request is used to apply for creation of one or more resource objects;

[0008] Acquire parameter information of the resource object according to the resource application request, the parameter information including resource specifications of the resource object and the application quantity of the resource object;

[0009] Determining a first resource sequence according to the resource specifications and a cluster monitoring database, wherein the first resource sequence includes a correspondence between at least one first cluster and a creatable quantity of resource objects, the cluster monitoring database being configured to record host information and resource object information of multiple clusters;

[0010] Determining a target cluster and an allocation amount of resource objects corresponding to the target cluster according to the application quantity and the first resource sequence;

[0011] According to the resource object allocation amount of the target cluster, a request for creating the resource object is sent to the target cluster, so as to create the resource object on a host in the target cluster.

[0012] In a possible implementation, the sending a request to the target cluster to create the resource object, the method further includes:

[0013] When monitoring indicates that the resource object on the target cluster is successfully created, the cluster monitoring database is updated according to the resource object allocation amount corresponding to the target cluster.

[0014] In a possible implementation, the host machine information of the cluster includes remaining hardware resources of the cluster, and determining the first resource sequence according to the resource specifications and a cluster monitoring database includes:

[0015] The first resource sequence is determined according to the resource specification and remaining amounts of hardware resources of multiple clusters in the cluster monitoring database.

[0016] In a possible implementation, the parameter information further includes a target regional location to which the resource object belongs, and the cluster monitoring database is further configured to record regional locations of all clusters. Before determining the first resource sequence based on the resource specifications and the cluster monitoring database, the method further includes:

[0017] Filtering all clusters in the cluster monitoring database according to the target area location and the area locations of all clusters in the cluster monitoring database;

[0018] The determining of the first resource sequence according to the resource specification and the cluster monitoring database includes:

[0019] The first resource sequence is determined according to the resource specifications and the remaining amount of hardware resources of the cluster screened in the cluster monitoring database.

[0020] In a possible implementation, determining the first resource sequence according to the resource specification and a cluster monitoring database includes:

[0021] In the cluster monitoring database, determining at least one cluster having a remaining amount of hardware resources greater than or equal to the resource specification as the first cluster;

[0022] Determining the amount of resource objects that can be created corresponding to the first cluster based on the resource specifications and the remaining amount of hardware resources of the first cluster;

[0023] The first resource sequence is determined according to the creatable quantity of resource objects corresponding to each of the first clusters.

[0024] In a possible implementation, determining the target cluster and the allocation amount of resource objects corresponding to the target cluster according to the application quantity and the first resource sequence includes:

[0025] Obtaining, according to the first resource sequence, the total amount of resource objects that can be created in all the first clusters;

[0026] If the total creatable amount of resource objects is greater than or equal to the applied quantity, the target cluster is determined in the first cluster, and the resource object allocation amount corresponding to the target cluster is determined according to the creatable amount of resource objects of the first cluster and the applied quantity.

[0027] In a possible implementation, determining the target cluster and the allocation amount of resource objects corresponding to the target cluster based on the application quantity and the first resource sequence further includes:

[0028] If the total amount of resource objects that can be created is greater than or equal to the applied quantity, sorting the first resource sequence in descending order according to the amount of resource objects that can be created;

[0029] In the sorted first resource sequence, the first clusters are determined as the target clusters in turn, and the resource object allocation quantity corresponding to the target clusters is determined according to the creatable quantity of resource objects of the first cluster, until the sum of the resource object allocation quantities of each target cluster is greater than or equal to the application quantity.

[0030] In a possible implementation, determining the target cluster and the allocation amount of resource objects corresponding to the target cluster based on the application quantity and the first resource sequence further includes:

[0031] If the total amount of resource objects that can be created is greater than or equal to the requested amount, querying whether there is at least one second cluster in the first cluster that has created the resource objects based on the resource object information of the first cluster;

[0032] If there is a second cluster that has created the resource object, determining a second resource sequence, where the second resource sequence includes a correspondence between the second cluster and the amount of resource objects that have been created;

[0033] The target cluster and the allocation amount of the resource objects corresponding to the target cluster are determined according to the application quantity, the first resource sequence, and the second resource sequence.

[0034] In a possible implementation, determining the target cluster and the allocation amount of resource objects corresponding to the target cluster according to the application quantity, the first resource sequence, and the second resource sequence includes:

[0035] Obtaining a total number of resource objects of all second clusters according to the first resource sequence and the second resource sequence, where the total number of resource objects of all second clusters is the sum of the number of resource objects that can be created and the number of resource objects that have been created of all second clusters;

[0036] If the total amount of resource objects of all the second clusters is greater than or equal to the application quantity, the second clusters will be determined as the target clusters in turn, and the resource object allocation amount corresponding to the target cluster will be determined based on the creatable amount of resource objects of the second cluster, until the sum of the resource object allocation amount and the created amount of resource objects of all the target clusters is greater than or equal to the application quantity.

[0037] In a possible implementation, determining the target cluster and the allocation amount of resource objects corresponding to the target cluster based on the application quantity, the first resource sequence, and the second resource sequence further includes:

[0038] If the total amount of resource objects of all the second clusters is less than the applied quantity, all the second clusters are determined as the target clusters, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the second clusters;

[0039] In the first resource sequence, the third cluster other than the second cluster in the first cluster is determined as the target cluster in turn, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the third cluster, until the sum of the resource object allocation quantity and the created quantity of resource objects of all the target clusters is greater than or equal to the application quantity.

[0040] In one possible implementation, the cluster is a Kubernetes cluster.

[0041] On the other hand, an embodiment of the present disclosure provides a resource scheduling device, including:

[0042] A receiving module, configured to receive a resource application request from a terminal device, wherein the resource application request is used to apply for creation of one or more resource objects;

[0043] An acquisition module, configured to acquire parameter information of the resource object according to the resource application request, wherein the parameter information includes resource specifications of the resource object and the application quantity of the resource object;

[0044] a scheduling module configured to determine a first resource sequence based on the resource specifications and a cluster monitoring database, the first resource sequence including a correspondence between at least one first cluster and a creatable quantity of resource objects, the cluster monitoring database being configured to record host information and resource object information of multiple clusters, and to determine a target cluster and an allocation quantity of resource objects corresponding to the target cluster based on the application quantity and the first resource sequence;

[0045] The sending module is configured to send a request for creating the resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster.

[0046] In a possible implementation, the apparatus further includes:

[0047] The updating module is configured to update the cluster monitoring database according to the resource object allocation amount corresponding to the target cluster when monitoring that the resource object on the target cluster is successfully created.

[0048] In a possible implementation, the host machine information of the cluster includes remaining hardware resources of the cluster, and the scheduling module is specifically configured to:

[0049] The first resource sequence is determined according to the resource specification and remaining amounts of hardware resources of multiple clusters in the cluster monitoring database.

[0050] In a possible implementation, the parameter information further includes a target area location to which the resource object belongs, the cluster monitoring database is further configured to record the area locations of all clusters, and the apparatus further includes:

[0051] A screening module, configured to screen all clusters in the cluster monitoring database according to the target area location and the area locations of all clusters in the cluster monitoring database;

[0052] The scheduling module is specifically used to:

[0053] The first resource sequence is determined according to the resource specifications and the remaining amount of hardware resources of the cluster screened in the cluster monitoring database.

[0054] In a possible implementation, the scheduling module is specifically configured to:

[0055] In the cluster monitoring database, determining at least one cluster having a remaining amount of hardware resources greater than or equal to the resource specification as the first cluster;

[0056] Determining the amount of resource objects that can be created corresponding to the first cluster based on the resource specifications and the remaining amount of hardware resources of the first cluster;

[0057] The first resource sequence is determined according to the creatable quantity of resource objects corresponding to each of the first clusters.

[0058] In a possible implementation, the scheduling module is specifically configured to:

[0059] Obtaining, according to the first resource sequence, the total amount of resource objects that can be created in all the first clusters;

[0060] If the total creatable amount of resource objects is greater than or equal to the applied quantity, the target cluster is determined in the first cluster, and the resource object allocation amount corresponding to the target cluster is determined according to the creatable amount of resource objects of the first cluster and the applied quantity.

[0061] In a possible implementation, the scheduling module is specifically configured to:

[0062] If the total amount of resource objects that can be created is greater than or equal to the applied quantity, sorting the first resource sequence in descending order according to the amount of resource objects that can be created;

[0063] In the sorted first resource sequence, the first clusters are determined as the target clusters in turn, and the resource object allocation quantity corresponding to the target clusters is determined according to the creatable quantity of resource objects of the first cluster, until the sum of the resource object allocation quantities of each target cluster is greater than or equal to the application quantity.

[0064] In a possible implementation, the scheduling module is specifically configured to:

[0065] If the total amount of resource objects that can be created is greater than or equal to the requested amount, querying whether there is at least one second cluster in the first cluster that has created the resource objects based on the resource object information of the first cluster;

[0066] If there is a second cluster that has created the resource object, determining a second resource sequence, where the second resource sequence includes a correspondence between the second cluster and the amount of resource objects that have been created;

[0067] The target cluster and the allocation amount of the resource objects corresponding to the target cluster are determined according to the application quantity, the first resource sequence, and the second resource sequence.

[0068] In a possible implementation, the scheduling module is specifically configured to:

[0069] Obtaining a total number of resource objects of all second clusters according to the first resource sequence and the second resource sequence, where the total number of resource objects of all second clusters is the sum of the number of resource objects that can be created and the number of resource objects that have been created of all second clusters;

[0070] If the total amount of resource objects of all the second clusters is greater than or equal to the application quantity, the second clusters will be determined as the target clusters in turn, and the resource object allocation amount corresponding to the target cluster will be determined based on the creatable amount of resource objects of the second cluster, until the sum of the resource object allocation amount and the created amount of resource objects of all the target clusters is greater than or equal to the application quantity.

[0071] In a possible implementation, the scheduling module is specifically configured to:

[0072] If the total amount of resource objects of all the second clusters is less than the applied quantity, all the second clusters are determined as the target clusters, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the second clusters;

[0073] In the first resource sequence, the third cluster other than the second cluster in the first cluster is determined as the target cluster in turn, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the third cluster, until the sum of the resource object allocation quantity and the created quantity of resource objects of all the target clusters is greater than or equal to the application quantity.

[0074] In one possible implementation, the cluster is a Kubernetes cluster.

[0075] In a third aspect, an embodiment of the present disclosure provides a resource scheduling device, comprising: at least one processor and a memory;

[0076] The memory stores computer-executable instructions;

[0077] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the resource scheduling method as described in the first aspect and various possible implementations of the first aspect.

[0078] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the resource scheduling method described in the first aspect and various possible implementation methods of the first aspect is implemented.

[0079] The resource scheduling method, apparatus, device, and storage medium provided by the embodiments of the present disclosure obtain parameter information of the resource objects upon receiving a resource request for creating one or more resource objects, the parameter information including the resource specifications and resource quantity of the resource objects. A first resource sequence is determined based on cluster monitoring data used to record host information and resource object information of multiple clusters, as well as the resource specifications of the resource objects. Based on the resource object request quantity and the first resource sequence, a target cluster and the corresponding resource allocation amount of the target cluster are determined. A request to create a resource object is sent to the target cluster based on the resource object allocation amount of the target cluster.

[0080] Therefore, the embodiments of the present disclosure comprehensively consider the resource specifications and resource quantities of resource objects as well as the host information and resource object information of each cluster, reasonably determine the target cluster and the resource allocation amount corresponding to the target cluster, and effectively improve the effect of resource scheduling in multiple clusters. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0082] Figure 1 An example diagram of an architecture applicable to a resource scheduling method according to an embodiment of the present disclosure is provided;

[0083] Figure 2 An example diagram of an application scenario in which a resource scheduling method is applicable is provided for an embodiment of the present disclosure;

[0084] Figure 3 A schematic diagram of a resource scheduling method according to an embodiment of the present disclosure is provided;

[0085] Figure 4 A flowchart of a resource scheduling method is provided for another embodiment of the present disclosure;

[0086] Figure 5 An example flow chart of a resource scheduling method is provided for an embodiment of the present disclosure;

[0087] Figure 6 A flowchart illustrating a resource scheduling method according to another embodiment of the present disclosure is provided;

[0088] Figure 7 A schematic diagram of the structure of a resource scheduling device is provided for an embodiment of the present disclosure;

[0089] Figure 8 A schematic diagram of a flow chart of a resource scheduling device is provided for another embodiment of the present disclosure;

[0090] Figure 9 A schematic diagram of the structure of a resource scheduling device is provided for an embodiment of the present disclosure.

[0091] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0092] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0093] First, the nouns involved in the embodiments of the present disclosure are explained:

[0094] 1. Container:

[0095] Operating systems contain a variety of processes, including native OS services and application programs. To minimize the impact of processes on each other, virtual machines (VMs) or containers are currently being used to provide relatively independent runtime environments for each process.

[0096] In container technology, a container is a collection of isolated processes. Containers have independent file systems; in other words, processes in different containers run on their own independent file systems. Furthermore, hardware resources such as memory and processors used by different containers are isolated from each other. Compared to virtual machines, containers can be deployed quickly and flexibly, making them suitable for deployment in cloud environments.

[0097] During container deployment, an application or service can be built into a container image. An image is a collection of all the files required for a container to run. By running the image, the corresponding container can be deployed. Therefore, an image is equivalent to a template, and a container is equivalent to a specific running instance. Images offer the ability to build once and run anywhere, providing flexible deployment and strong portability. Applications deployed using containers are also called containerized applications.

[0098] 2. Cluster:

[0099] In a cloud environment (such as a public or private cloud), a cluster manages multiple nodes. Each node is an abstract representation of a single machine in the cluster. A node can be a single physical machine, such as a server or computer, or a virtual machine. In a cluster, each node can be considered a hardware resource. When deploying containers on a cluster, the cluster can assign container deployment tasks to one or more nodes. Therefore, a node can also be called a host.

[0100] 3. Resource objects:

[0101] Before deploying a container, you need to apply for the hardware resources required for the container to run. Resource objects are the basic units that users can apply for, and one or more containers can be deployed in a resource object.

[0102] 4. Kubernetes Cluster Federation

[0103] Kubernetes, derived from the Borg system, refers to a technology that runs and coordinates containerized applications on a group of host machines, providing mechanisms for application deployment, planning, updating and maintenance. In other words, Kubernetes is a container management technology.

[0104] A cluster that manages multiple hosts in the Kubernetes system is also called a Kubernetes cluster. Within a Kubernetes cluster, the Kubernetes Application Programming Interface (API) is used to manipulate various Kubernetes objects, such as resources, services, and containers. In a Kubernetes cluster, resource objects are abbreviated as pods. Kubernetes cluster federation enables unified management of multiple Kubernetes clusters. These clusters can span multiple regions and cloud providers.

[0105] In related technologies, in addition to multiple Kubernetes clusters, Kubernetes cluster federation requires the deployment of a Federation Application Programming Interface Server (Federation API Service) and an etcd cluster. Among them, etcd is a distributed key-value database. The Federation API Service is used to manage the Kubernetes APIs in multiple Kubernetes clusters. The etcd cluster records resources created across Kubernetes cluster federation clusters in the etcd cluster. When the number of clusters is too large, the Federation API Service will experience performance bottlenecks. When the amount of resource creation is too large, the input and output (I / O) performance of the etcd cluster will also reach bottlenecks.

[0106] In addition, when creating resources, each cluster is asked in turn whether it can create the resource object. When the number of clusters is too large, this resource scheduling method is not effective.

[0107] Therefore, as the number of clusters increases and the scale of clusters increases (for example, a Kubernetes cluster can manage more than 5,000 hosts), resource scheduling between multiple clusters will become a more difficult problem to control.

[0108] In order to improve the resource scheduling effect between multiple clusters, an embodiment of the present disclosure provides a resource scheduling method. In this method, when a resource application request for creating one or more resource objects is received, a first resource sequence is determined based on the resource specifications of the resource object in the parameter information of the resource object and the cluster monitoring database. The first resource sequence includes a correspondence between at least one first cluster and the amount of resource objects that can be created. According to the application quantity of the resource objects and the first resource sequence, the target cluster and the resource object allocation amount corresponding to the target cluster are determined.

[0109] Therefore, the resource scheduling method provided by the embodiment of the present disclosure performs resource scheduling between multiple clusters while fully considering the amount of resource objects that can be created in the cluster and the number of resource objects applied for, effectively improving the resource scheduling effect between multiple clusters, and does not require the architecture of the cluster federation to be modified, and can be compatible with different versions of cluster federation (such as Kubernetes cluster federation).

[0110] Among them, the resource scheduling method provided by the embodiment of the present disclosure can be implemented through one or more applications or services, and the one or more applications or services can be deployed on electronic devices outside the multiple clusters, or on host machines of multiple clusters. If the number of clusters increases or the number of resource objects increases, the one or more applications or services can be expanded horizontally. In other words, by utilizing the easy migration and easy deployment characteristics of containerized applications under cloud services, the application or service is deployed on multiple electronic devices outside the multiple clusters or on multiple host machines of multiple clusters to improve the resource scheduling capability and resource scheduling effect of the resource scheduling method provided by the embodiment of the present disclosure.

[0111] As an example, Figure 1 As shown, the resource scheduling method provided by the embodiments of the present disclosure can be implemented through a resource management service and a cluster management service. The cluster management service is responsible for receiving resource application requests and interacting with multiple clusters (cluster 1, cluster 2, cluster 3, cluster 4, cluster 5, ... cluster N). The resource management service is responsible for monitoring the host machines and containers of each cluster. The cluster management service and resource management service can be deployed on one or more electronic devices outside of the multiple clusters, or can be deployed on the same or different clusters.

[0112] Figure 2 An example diagram of an application scenario applicable to the resource scheduling method provided in the embodiments of the present disclosure. The application scenario is a cloud service scenario, including a cloud platform and multiple user terminals (e.g., user terminal 1, user terminal 2, etc.). The cloud platform includes multiple clusters (e.g., cluster 1, cluster 2, etc.) and a cluster federation server for managing multiple clusters. Different clusters can be deployed in the same geographic area or in different geographic areas. Each cluster includes multiple host machines and a cluster server for managing multiple host machines. One or more containers can run on the host machine.

[0113] The cloud platform can be either a public or private cloud. For example, a private cloud can provide sufficient computing resources for developers within an internet company to develop retail businesses (for example, developers can apply for resources, compile and build, and conduct business development on the cloud platform for an online shopping mall on a computer or an online shopping application on a mobile terminal). It can also extend to the internet company's offline stores, providing computing resources and data services for the offline stores' retail business, thereby improving the offline stores' retail business.

[0114] The following describes in detail the technical solutions of the embodiments of the present disclosure and how the technical solutions of the present disclosure solve the above-mentioned technical problems using specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present disclosure will be described below in conjunction with the accompanying drawings.

[0115] Figure 3 This is a flow chart of a resource scheduling method provided by an embodiment of the present disclosure. The execution subject of this embodiment takes an electronic device as an example. The electronic device can be one or more client terminals or one or more servers. Figure 3 As shown, the method includes:

[0116] S301: Receive a resource application request from a terminal device.

[0117] Among them, the terminal device can be a computer, tablet computer, mobile phone and other devices.

[0118] The resource application request is used to apply for the creation of one or more resource objects on the cloud service. A resource object can provide hardware resources for the deployment and operation of one or more containers.

[0119] Specifically, before deploying a container, the user can enter resource request instructions on their terminal device to prepare the appropriate hardware resources for the container. For example, in a Kubernetes cluster federation, a user can enter the corresponding kubectl command line on their terminal device to request the creation of a resource object. After detecting the resource request instruction entered by the user, the terminal device generates a resource request and sends it to the current electronic device.

[0120] S302: Acquire parameter information of the resource object according to the resource application request, where the parameter information includes resource specifications of the resource object and the application quantity of the resource object.

[0121] The resource specification of a resource object refers to the size of the hardware resources contained in the resource object. For example, the resource specification of a resource object may be a 2-core central processing unit (CPU), 2GB of memory, and 10GB of disk space. The resource object request quantity refers to the number of resource objects requested to be created in the resource request.

[0122] Specifically, the resource request may or may not include parameter information about the resource object. If the resource request includes parameter information about the resource object, the parameter information about the resource object may be directly obtained from the resource request. Otherwise, the parameter information about the resource object may be received separately from the terminal device.

[0123] S303: Determine a first resource sequence according to resource specifications and a cluster monitoring database.

[0124] The cluster monitoring database is used to record the host information and resource object information of multiple clusters, and the multiple clusters are located in the same cluster federation.

[0125] Optionally, the host information of the cluster includes the remaining hardware resources of the cluster.

[0126] After obtaining the parameter information of the resource object requested for creation by the resource application request, the remaining hardware resources of each cluster can be obtained from the cluster monitoring database. The remaining hardware resources of each cluster are compared with the resource specifications of the resource object. If there is no cluster with remaining hardware resources greater than or equal to the resource specifications of the resource object, it means that the remaining hardware resources of each cluster are insufficient to create a resource object, and a message indicating that the resource application failed is returned to the terminal device. If there is a cluster with remaining hardware resources greater than or equal to the resource specifications of the resource object, the cluster with remaining hardware resources greater than or equal to the resource specifications of the resource object is determined as the first cluster. The number of first clusters is one or more.

[0127] Based on the remaining hardware resources of the first cluster and the resource specifications of the resource objects, the number of resource objects that each first cluster can create is determined. For simplicity, the number of resource objects that a first cluster can create is referred to as the first cluster's creatable resource object quantity. A first resource sequence is composed of one or more first clusters and the creatable resource object quantity of each first cluster. Therefore, the first resource sequence includes a correspondence between one or more first clusters and the creatable resource object quantity.

[0128] As an example, the remaining hardware resources of the first cluster are 4-core CPU, 16GB memory space and 20GB disk space, and the resource specifications of the resource object are 2-core central processing unit (CPU), 2GB memory space and 10GB disk space. Then the number of resource objects that can be created in the first cluster is 2.

[0129] Optionally, the cluster's host machine information includes the cluster's total hardware resources, and the cluster's resource object information includes the resource specifications of each created resource object in the cluster and the number of created resource objects. Therefore, after obtaining the parameter information of the resource object requested for creation by the resource application request, the cluster's total hardware resources, the resource specifications of each created resource object, and the number of resources of each created resource object can also be obtained from the cluster monitoring database. For each cluster, the cluster's used hardware resources can be obtained based on the resource specifications and resource numbers of each created resource object in the cluster, and the cluster's remaining hardware resources can be obtained based on the cluster's total hardware resources and the cluster's used hardware resources.

[0130] Optionally, the host information of the cluster may further include the number of hosts in the cluster and the total hardware resources, remaining hardware resources, and used hardware resources of each host in the cluster. The remaining hardware resources of the cluster may also be determined based on the total hardware resources, remaining hardware resources, and used hardware resources of each host in the cluster.

[0131] Optionally, the cluster monitoring database includes a first data table for storing host information and a second data table for storing resource object information. The host information of all clusters is recorded in the first data table, and the resource object information of all clusters is recorded in the second data table.

[0132] Furthermore, the cluster monitoring database is a relational database, such as a MySQL database.

[0133] S304: Determine the target cluster and the allocation amount of the resource objects corresponding to the target cluster according to the application quantity and the first resource sequence.

[0134] The number of target clusters is one or more.

[0135] Specifically, after obtaining the first resource sequence, one or more target clusters and the resource object allocation quantity corresponding to each target cluster can be determined in the one or more first clusters based on the application quantity and the creatable quantity of resource objects in the one or more first clusters in the first resource sequence. The resource object allocation quantity corresponding to the target cluster is the number of resource objects that need to be applied for on the target cluster, and the resource object allocation quantity corresponding to the target cluster is less than or equal to the creatable quantity of resource objects in the target cluster.

[0136] S305 : Send a request to create a resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster.

[0137] Specifically, after determining the resource object allocation amount of one or more target clusters, a request to create a resource object can be sent to each target cluster. The request to create a resource object sent to the target cluster includes the resource specifications of the resource object and the resource object allocation amount corresponding to the target cluster, so that the target cluster can apply to create a resource object on the host machine in the target cluster based on the resource specifications of the resource object and the resource object allocation amount corresponding to the target cluster.

[0138] Optionally, monitor whether the resource objects on the target cluster are successfully created. If the monitoring shows that the resource objects on the target cluster are successfully created, update the cluster monitoring database based on the resource object allocation corresponding to the target cluster to improve the accuracy of the data in the cluster monitoring database. When updating the cluster monitoring database based on the resource object allocation corresponding to the target cluster, the cluster monitoring database can update the host information of the target cluster, such as the remaining hardware resources of the target cluster, and can also update the resource object information of the target cluster in the cluster monitoring database, such as the specifications and quantity of the resource objects on the target cluster.

[0139] As an example, taking the Kubernetes system as an example, by enabling the list function and watch function in the Kubernetes system, it is possible to obtain the host information and resource object information of each cluster and monitor whether the resource objects on the target cluster are successfully created. Specifically, the host information of each cluster is obtained through the list function, and the host information is recorded in the nodeinfo table of the cluster monitoring database. The resource object information of each cluster is obtained through the list function, and the resource object information is recorded in the podinfo table of the cluster monitoring database. The remaining hardware resources of each cluster in the nodeinfo table can also be updated based on the obtained resource object information. During the application and creation process of resource objects, the creation and deletion of resource objects can be monitored through the watch function.

[0140] In the disclosed embodiment, the target cluster and the resource object allocation amount corresponding to the target cluster are determined based on the resource specifications and resource quantities of the resources requested for creation in the cluster monitoring database and the resource application request. Therefore, the resource situation of each cluster is fully considered, and resource objects are allocated in multiple clusters based on the resource object creation capabilities of each cluster, which effectively improves the resource scheduling effect in multiple clusters and does not require the architecture of the cluster federation where the multiple clusters are located to be modified. It is suitable for different cluster federations.

[0141] Figure 4 This is a flow chart of a resource scheduling method provided by another embodiment of the present disclosure. The execution subject of this embodiment is an electronic device, which can be one or more client terminals or one or more servers. Figure 4 As shown, the method includes:

[0142] S401: Receive a resource application request from a terminal device.

[0143] The implementation principle and technical effects of S401 may refer to the aforementioned embodiments and will not be described in detail.

[0144] S402: Acquire parameter information of the resource object according to the resource application request, where the parameter information includes resource specifications of the resource object, application quantity of the resource object, and target area location.

[0145] Among them, the cluster federation can be arranged across regions, wherein different regions can be different geographical regions or different computer rooms. For example, the cluster federation includes cluster 1 located in geographical region A, cluster 2 in geographical region B, cluster 3 in geographical region C, etc. For another example, the cluster federation includes cluster 4 located in computer room a, cluster 5 located in computer room b, etc. One or more clusters can be distributed in a geographical region, one or more clusters can be distributed in a computer room, or a cluster can include multiple computer rooms. The target area location in the parameter information of the resource object means that the resource object needs to be arranged on the cluster located in the target area location, and the user can select one or more target area locations on the terminal device according to his or her own needs, such as selecting geographical region A as the target area location from geographical region A, geographical region B, and geographical region C on the browser.

[0146] The resource specifications of the resource objects and the application quantity of the resource objects may refer to the description of step S302 and will not be repeated here.

[0147] Specifically, the resource request may or may not include parameter information about the resource object. If the resource request includes parameter information about the resource object, the parameter information about the resource object may be directly obtained from the resource request. Otherwise, the parameter information about the resource object may be received separately from the terminal device.

[0148] S403: Filter all clusters in the cluster monitoring database according to the target area location and the area locations of all clusters in the cluster monitoring database.

[0149] The cluster monitoring database not only records the host and resource information of multiple clusters, but also records the regional location of each cluster. In addition to obtaining the regional location of each cluster from the cluster monitoring database, it is also possible to determine the regional location of each cluster by directly communicating with each cluster.

[0150] Specifically, according to the regional location of each cluster in the cluster monitoring database and the target regional location, all clusters in the cluster monitoring database are screened to determine one or more clusters located in the target regional location.

[0151] S404: Determine a first resource sequence according to resource specifications and remaining hardware resources of the cluster screened in the cluster monitoring database.

[0152] Specifically, after screening all clusters in the cluster monitoring database and determining one or more clusters located in the target area, the remaining hardware resources of each cluster located in the target area can be obtained based on the cluster monitoring database. The remaining hardware resources of each cluster located in the target area are compared with the resource specifications of the resource object. If there is no cluster in the clusters located in the target area whose remaining hardware resources are greater than or equal to the resource specifications of the resource object, a message indicating that the resource application failed is returned to the terminal device. If there is a cluster in the clusters located in the target area whose remaining hardware resources are greater than or equal to the resource specifications of the resource object, the cluster whose remaining hardware resources are greater than or equal to the resource specifications of the resource object is determined as the first cluster.

[0153] The amount of resource objects that can be created in the first cluster is determined based on the remaining hardware resources of the first cluster and the resource specifications of the resource objects. A first resource sequence is formed by one or more first clusters and the amount of resource objects that can be created in each first cluster.

[0154] S405: Determine the target cluster and the allocation amount of the resource objects corresponding to the target cluster according to the application quantity and the first resource sequence.

[0155] S406 : Send a request to create a resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster.

[0156] The implementation principles and technical effects of S405 and S406 can be referred to the aforementioned embodiments and will not be described in detail.

[0157] In the disclosed embodiment, the target cluster and the resource object allocation amount corresponding to the target cluster are determined based on the resource specifications, resource quantity, and target area location of the resources requested for creation in the cluster monitoring database and the resource application request. Therefore, the resource situation of each cluster is fully considered, and resource objects are allocated in multiple clusters based on the resource object creation capabilities of each cluster, which effectively improves the resource scheduling effect in multiple clusters and does not require the architecture of the cluster federation where the multiple clusters are located to be modified. It is suitable for different cluster federations.

[0158] In some embodiments, a possible implementation method of S304 or S405 is: according to the first resource sequence, obtain the total amount of resource objects that can be created of all first clusters; if the total amount of resource objects that can be created is greater than or equal to the application quantity, determine the target cluster in the first cluster, and determine the resource object allocation amount corresponding to the target cluster based on the resource objects that can be created and the application quantity of the first cluster.

[0159] Specifically, the amount of resource objects that can be created in each first cluster can be obtained in the first resource sequence, and the amount of resource objects that can be created in each first cluster can be added together to obtain the total amount of resource objects that can be created in all first clusters. The total amount of resource objects that can be created in all first clusters is compared with the number of resource objects applied for in the resource application request. If the total amount of resource objects that can be created in the first cluster is greater than or equal to the number of applications, it means that the creation of the requested number of resource objects can be completed in each first cluster. Therefore, one or more target clusters can be determined in the first cluster, and the resource object allocation amount corresponding to each target cluster can be determined based on the resource object creation amount and the number of applications in the first cluster. Among them, the sum of the resource object allocation amounts corresponding to each target cluster is greater than or equal to the number of applications.

[0160] If the total number of resource objects that can be created in the first cluster is less than the applied number, it means that the applied number of resource objects cannot be created in each first cluster. Therefore, a message of application failure can be returned to the terminal device, and the user can be reminded to reduce the applied number of resource objects.

[0161] In some embodiments, another possible implementation of S304 or S405 is: according to the first resource sequence, obtain the total amount of resource objects that can be created of all first clusters; if the total amount of resource objects that can be created is greater than or equal to the application quantity, sort the first resource sequence in descending order according to the amount of resource objects that can be created; in the sorted first resource sequence, determine the first cluster as the target cluster in turn, and determine the resource object allocation amount corresponding to the target cluster according to the resource object allocation amount of the first cluster, until the sum of the resource object allocation amounts of each target cluster is greater than or equal to the application quantity.

[0162] Specifically, the creatable quantity of resource objects of each first cluster can be obtained in the first resource sequence, and the creatable quantity of resource objects of each first cluster can be added together to obtain the total creatable quantity of resource objects of all first clusters. The total creatable quantity of resource objects of all first clusters is compared with the applied quantity of resource objects applied for in the resource application request. If the total creatable quantity of resource objects of the first cluster is greater than or equal to the applied quantity, it means that the creation of the applied quantity of resource objects can be completed in each first cluster. At this time, the first resource sequence can be sorted in descending order according to the creatable quantity of resource objects. That is, in the first resource sequence, each first cluster is sorted in order from most to least according to the creatable quantity of resource objects.

[0163] Specifically, after sorting the first resource sequence in descending order, the first first cluster in the first resource sequence is first determined as the target cluster. If the target cluster's creatable resource object quantity is greater than or equal to the application quantity, the application quantity is determined as the target cluster's allocated resource object quantity, and resource object allocation is completed. If the target cluster's creatable resource object quantity is less than the application quantity, the target cluster's creatable resource object quantity is determined as the target cluster's allocated resource object quantity. Next, the next first cluster in the first resource sequence is determined as the target cluster. If the target cluster's creatable resource object quantity plus the determined target cluster's allocated resource object quantity is greater than or equal to the application quantity, the difference between the application quantity and the target cluster's creatable resource object quantity is determined as the target cluster's allocated resource object quantity, and resource object allocation is completed. Otherwise, the target cluster's creatable resource object quantity is determined as the target cluster's allocated resource object quantity, and the next first cluster is then determined as the target cluster. One or more first clusters are sequentially determined as target clusters in this manner until the target cluster's allocated resource object quantity is greater than or equal to the application quantity.

[0164] Therefore, this embodiment fully considers the creatable amount of resource objects of each first cluster and determines the target cluster and the resource object allocation amount of the target cluster in an orderly manner according to the first cluster, effectively improving the rationality and efficiency of resource scheduling in multiple clusters, thereby improving the resource scheduling effect.

[0165] In some embodiments, when the current user applies to create a resource object for the containerized operation of a certain application or service, other users may have already applied for the same resource object for the application or service, and the application or service has not been updated to the resource management database in a timely manner. Therefore, in order to maximize the number of resource objects in the cluster federation to be as close as possible to the number of applications, another possible implementation of S404 or S405 is: according to the first resource sequence, the total amount of resource objects that can be created in all first clusters is obtained; if the total amount of resource objects that can be created is greater than or equal to the number of applications, based on the resource object information of the first cluster, whether there is at least one second cluster in the first cluster that has created the requested resource object is queried; if there is a second cluster that has created the requested resource object, a second resource sequence is determined, and the second resource sequence includes a corresponding relationship between the second cluster and the amount of resource objects that have been created; based on the number of applications, the first resource sequence and the second resource sequence, the target cluster and the resource object allocation amount corresponding to the target cluster are determined.

[0166] Specifically, if the total number of resource objects that can be created is greater than or equal to the number of applications, resource object creation query information is sent to each first cluster in the first resource sequence to query whether all first clusters have created the resource objects applied for by this resource application request. If there is at least one first cluster on which the resource objects applied for by this resource application request have been created, it is determined that there is at least one second cluster in the first cluster that has created the applied resource objects. Otherwise, it is determined that there is no second cluster in the first cluster that has created the applied resource objects.

[0167] If there is at least one second cluster in the first cluster that has created the requested resource object, then the number of resource objects created on each second cluster is obtained. For the sake of simplicity, the number of resource objects created on the second cluster is referred to as the created resource object quantity of the second cluster. Based on the created resource objects of the second cluster, a second resource sequence is established, and the second resource sequence includes the correspondence between the second cluster and the created resource objects. Based on the application quantity, the first resource sequence and the second resource sequence, the target cluster and the resource object allocation quantity corresponding to the target cluster are determined, so that the sum of the resource object allocation quantity and the created resource object quantity corresponding to the target cluster is greater than or equal to the application quantity. Therefore, under the premise of fully considering the cluster's resource object creatable quantity and the resource object created quantity, the resource object creation task is allocated in multiple clusters, effectively improving the resource scheduling effect.

[0168] If there is no second cluster in the first cluster that has created the requested resource object, the target cluster and the resource object allocation amount corresponding to the target cluster are determined based on the application quantity and the first resource sequence. The specific implementation principle and technical effects can be referred to the above embodiment and will not be repeated here.

[0169] Optionally, in the process of determining the target cluster and the resource object allocation amount corresponding to the target cluster based on the application quantity, the first resource sequence and the second resource sequence, the total amount of resource objects of all second clusters is obtained according to the first resource sequence and the second resource sequence, and the total amount of resource objects of all second clusters is the sum of the creatable amount of resource objects and the created amount of resource objects of all second clusters; if the total amount of resource objects of all second clusters is greater than or equal to the application quantity, the second clusters are determined as target clusters in turn, and the resource object allocation amount corresponding to the target cluster is determined according to the creatable amount of resource objects of the second cluster, until the sum of the resource object allocation amount and the created amount of resource objects of all target clusters is greater than or equal to the application quantity, and the allocation of resource object creation tasks is terminated.

[0170] In the first resource sequence, the number of resource objects that can be created for each second cluster is obtained. In the second resource sequence, the number of resource objects that have been created for each second cluster is obtained. The number of resource objects that can be created and the number of resource objects that have been created for all second clusters are added together to obtain the total number of resource objects for all second clusters. The total number of resource objects for all second clusters is compared with the number of resource objects requested. If the total number of resource objects for all second clusters is greater than or equal to the number of resource objects requested, it means that the hardware resources of all second clusters are sufficient to create the requested number of resource objects. Therefore, the second clusters can be identified as target clusters in turn, and the resource object allocation quantity corresponding to the target clusters is determined based on the number of resource objects that can be created for the second clusters. This process ends when the sum of the resource object allocation quantity and the resource object creation quantity for all target clusters is greater than or equal to the number of resource objects requested. Therefore, resource objects are preferably placed on the second cluster where the resource objects have already been created, thereby improving the rationality of resource scheduling across multiple clusters.

[0171] In the process of sequentially determining the second clusters as target clusters and determining the corresponding resource object allocation quantity of the target clusters based on the creatable quantity of resource objects in the second clusters, the second resource sequence can also be sorted according to the creatable quantity of resource objects in each second cluster. In the sorted second resource sequence, the first second cluster is determined as the target cluster in the sorted order, and a determination is made as to whether the creatable quantity of resource objects in the target cluster plus the created quantity of resource objects in the target cluster is greater than or equal to the application quantity. If so, the difference between the application quantity and the created quantity of resource objects in the target cluster is determined as the resource object allocation quantity of the target cluster, completing the allocation of the resource object creation task. If not, the creatable quantity of resource objects in the target cluster is determined as the resource object allocation quantity of the target cluster, and the above process is continued for the next second cluster until the sum of the resource object allocation quantities of all target clusters and the created quantity of resource objects in all target clusters is greater than or equal to the application quantity.

[0172] If the total amount of resource objects in all second clusters is less than the requested number, it means that the hardware resources of all second clusters are insufficient to create the requested number of resource objects. It is necessary to apply to create resource objects in clusters other than the second cluster in the first cluster. For ease of distinction, clusters other than the second cluster in the first cluster are referred to as third clusters. Therefore, if the total amount of resource objects in all second clusters is less than the requested number, all second clusters are identified as target clusters, and the resource object allocation amount of the target cluster is determined based on the amount of resource objects that can be created in the second cluster. Then, in the first resource sequence, the third cluster is identified as the target cluster in turn, and the resource object allocation amount of the target cluster is determined based on the amount of resource objects that can be created in the third cluster, until the sum of the resource object allocation amount and the amount of resource objects created in all target clusters is greater than or equal to the requested number.

[0173] In the process of determining a third cluster as a target cluster and determining the target cluster's resource object allocation quantity based on the third cluster's creatable resource object quantity, the first third cluster in the first resource sequence may be determined as the target cluster. If the sum of the target cluster's creatable resource object quantity, the resource object allocation quantities of all determined target clusters, and the created resource object quantities of all determined target clusters is greater than or equal to the application quantity, the difference between the application quantity and the sum of the resource object allocation quantities of all determined target clusters and the created resource object quantities of all determined target clusters is determined as the resource object allocation quantity of the target cluster determined based on the first third cluster. If the sum of the target cluster's creatable resource object quantity, the resource object allocation quantities of all determined target clusters, and the created resource object quantities of all determined target clusters is less than the application quantity, the resource object creatable quantity of the target cluster determined based on the first third cluster is determined as the resource object allocation quantity of the target cluster. Third clusters may be determined as target clusters in this manner until the sum of the resource object allocation quantities and created resource object quantities of all target clusters is greater than or equal to the application quantity.

[0174] Optionally, the cluster federation in the aforementioned embodiment is a Kubernetes cluster federation, and the cluster in the aforementioned embodiment is a Kubernetes cluster, thereby effectively improving the resource scheduling effect between multiple Kubernetes clusters in the Kubernetes cluster federation.

[0175] As an example, the resource scheduling method provided in the embodiment of the present disclosure is implemented through resource management service and cluster management service. Figure 5 As shown, the resource scheduling method provided by the embodiment of the present disclosure includes: (1) the cluster management service receives a resource application request from a terminal device, and obtains parameter information of a resource object according to the resource application request; (2) the cluster management service sends the resource specification of the parameter object in the parameter information of the resource object to the resource management service; (3) the resource management service determines a first resource sequence according to the resource specification and the cluster monitoring database, and the first resource sequence includes a correspondence between at least one first cluster and the amount of resource objects that can be created; (4) the resource management service sends the first resource sequence to the cluster management service; (5) the cluster management service determines the target cluster and the resource object allocation amount corresponding to the target cluster according to the application amount and the first resource sequence; (6) the cluster management service sends a request to create a resource object to the target cluster according to the resource object allocation amount of the target cluster.

[0176] Furthermore, taking the cluster federation as Kubernetes cluster federation, the cluster as Kubernetes cluster, and the parameter information of the resource object also including the target computer room as an example, Figure 6As shown, the resource scheduling method provided by the embodiment of the present disclosure includes: (1) the cluster management service receives the resource application request of the terminal device, and obtains the resource specification, application quantity and target computer room of the resource object according to the resource application request; (2) the cluster management service filters out the cluster name of the Kubernetes cluster located in the target computer room according to the target computer room; (3) the cluster management service sends the cluster name of the Kubernetes cluster located in the target computer room and the resource specification of the resource object to the resource management service; (4) the resource management service filters out the remaining hardware resources that do not meet the requirements in the Kubernetes cluster located in the target computer room according to the cluster name of the Kubernetes cluster located in the target computer room and the resource specification of the resource object Kubernetes cluster with resource specifications; (5) The resource management service calculates and filters the remaining Kubernetes clusters for the amount of resource objects that can be created, and obtains the first resource sequence in the form of cluster name + amount of resource objects that can be created; (6) The resource management service returns the first resource sequence to the cluster management service; (7) For each Kubernetes cluster in the first resource sequence, the cluster management service determines whether the total amount of resource objects that can be created in the Kubernetes cluster is greater than or equal to the application amount. If not, the resource scheduling is terminated directly. If so, the resource scheduling is continued and the first resource sequence is used to determine the target cluster and the resource object allocation amount of each target cluster; (8) According to the resource object allocation amount of each target cluster, an application is made to each target cluster to create a resource object.

[0177] Figure 7 This is a schematic diagram of the structure of a resource scheduling device provided by an embodiment of the present disclosure. Figure 7 As shown, the resource scheduling device 700 includes: a receiving module 701 , an acquiring module 702 , a scheduling module 703 , and a sending module 704 .

[0178] Receiving module 701, configured to receive a resource application request from a terminal device, where the resource application request is used to apply for creation of one or more resource objects;

[0179] An acquisition module 702 is configured to acquire parameter information of a resource object according to a resource application request, wherein the parameter information includes resource specifications of the resource object and the application quantity of the resource object;

[0180] Scheduling module 703 is configured to determine a first resource sequence based on resource specifications and a cluster monitoring database, the first resource sequence including a correspondence between at least one first cluster and the number of resource objects that can be created. The cluster monitoring database is configured to record host information and resource object information for multiple clusters, and to determine a target cluster and the corresponding resource object allocation quantity based on the application quantity and the first resource sequence.

[0181] The sending module 704 is configured to send a request for creating a resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster.

[0182] In the disclosed embodiment, the target cluster and the resource object allocation amount corresponding to the target cluster are determined based on the resource specifications and resource quantities of the resources requested for creation in the cluster monitoring database and the resource application request. Therefore, the resource situation of each cluster is fully considered, and resource objects are allocated in multiple clusters based on the resource object creation capabilities of each cluster, which effectively improves the resource scheduling effect in multiple clusters and does not require the architecture of the cluster federation where the multiple clusters are located to be modified. It is suitable for different cluster federations.

[0183] In one possible implementation, Figure 8 As shown, the resource scheduling device 700 further includes:

[0184] The updating module 705 is configured to update the cluster monitoring database according to the resource object allocation amount corresponding to the target cluster when monitoring that the resource object on the target cluster is successfully created.

[0185] In a possible implementation, the host information of the cluster includes the remaining hardware resources of the cluster. The scheduling module 703 is specifically configured to:

[0186] A first resource sequence is determined according to resource specifications and remaining amounts of hardware resources of multiple clusters in a cluster monitoring database.

[0187] In a possible implementation, the parameter information further includes the target region location to which the resource object belongs, the cluster monitoring database is further configured to record the region locations of all clusters, and the resource scheduling apparatus 700 further includes:

[0188] A filtering module is used to filter all clusters in the cluster monitoring database based on the target region location and the region locations of all clusters in the cluster monitoring database;

[0189] The scheduling module 703 is specifically configured to:

[0190] A first resource sequence is determined according to resource specifications and remaining hardware resources of the cluster screened in the cluster monitoring database.

[0191] In a possible implementation, the scheduling module 703 is specifically configured to:

[0192] In the cluster monitoring database, at least one cluster having a remaining amount of hardware resources greater than or equal to the resource specification is determined as a first cluster;

[0193] Determine the amount of resource objects that can be created in the first cluster based on the resource specifications and the remaining hardware resources of the first cluster;

[0194] A first resource sequence is determined according to the creatable quantity of resource objects corresponding to each first cluster.

[0195] In a possible implementation, the scheduling module 703 is specifically configured to:

[0196] According to the first resource sequence, obtaining the total amount of resource objects that can be created in all first clusters;

[0197] If the total creatable resource objects are greater than or equal to the applied quantity, a target cluster is determined in the first cluster, and the resource object allocation quantity corresponding to the target cluster is determined according to the creatable resource objects and the applied quantity of the first cluster.

[0198] In a possible implementation, the scheduling module 703 is specifically configured to:

[0199] If the total amount of resource objects that can be created is greater than or equal to the number of applications, the first resource sequence is sorted in descending order according to the amount of resource objects that can be created;

[0200] In the sorted first resource sequence, the first cluster is determined as the target cluster in turn, and the resource object allocation quantity corresponding to the target cluster is determined according to the creatable resource object quantity of the first cluster, until the sum of the resource object allocation quantities of each target cluster is greater than or equal to the application quantity.

[0201] In a possible implementation, the scheduling module 703 is specifically configured to:

[0202] If the total number of resource objects that can be created is greater than or equal to the number of applications, querying whether there is at least one second cluster in the first cluster that has created a resource object based on the resource object information of the first cluster;

[0203] If there is a second cluster of created resource objects, determining a second resource sequence, the second resource sequence including a correspondence between the second cluster and the amount of created resource objects;

[0204] A target cluster and an allocation amount of resource objects corresponding to the target cluster are determined according to the application quantity, the first resource sequence, and the second resource sequence.

[0205] In a possible implementation, the scheduling module 703 is specifically configured to:

[0206] Obtaining the total amount of resource objects of all second clusters according to the first resource sequence and the second resource sequence, where the total amount of resource objects of all second clusters is the sum of the creatable amount of resource objects and the created amount of resource objects of all second clusters;

[0207] If the total amount of resource objects of all second clusters is greater than or equal to the application quantity, the second clusters will be determined as target clusters in turn, and the resource object allocation quantity corresponding to the target cluster will be determined based on the creatable resource objects of the second clusters, until the sum of the resource object allocation quantity and the created resource objects of all target clusters is greater than or equal to the application quantity.

[0208] In a possible implementation, the scheduling module 703 is specifically configured to:

[0209] If the total amount of resource objects in all second clusters is less than the requested amount, all second clusters are determined as target clusters, and the resource object allocation amount of the target cluster is determined according to the creatable amount of resource objects in the second clusters;

[0210] In the first resource sequence, the third cluster except the second cluster in the first cluster is determined as the target cluster in turn, and the resource object allocation quantity of the target cluster is determined according to the creatable resource object quantity of the third cluster, until the sum of the resource object allocation quantity and the created resource object quantity of all target clusters is greater than or equal to the application quantity.

[0211] In one possible implementation, the cluster is a Kubernetes cluster.

[0212] The cluster scheduling device provided in the embodiment of the present disclosure can be used to execute the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.

[0213] Figure 9 This is a schematic diagram of the structure of a resource scheduling device provided by an embodiment of the present disclosure. Figure 9 As shown, the resource scheduling device 900 provided in this embodiment includes: at least one processor 901 and a memory 902. The resource scheduling device 900 also includes a communication component 903. The processor 901, the memory 902 and the communication component 903 are connected via a bus 904.

[0214] During the specific implementation process, at least one processor 901 executes the computer-executable instructions stored in the memory 902, so that the at least one processor 901 executes the above resource scheduling method.

[0215] The specific implementation process of the processor 901 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.

[0216] In the above Figure 9In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0217] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.

[0218] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the figures of this disclosure are not limited to just one bus or just one type of bus.

[0219] The present disclosure also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above table creation statement generation method is implemented.

[0220] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. The computer-readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0221] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0222] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. A resource scheduling method, characterized in that: The method comprises: receiving a resource application request from a terminal device, wherein the resource application request is used to apply for creation of one or more resource objects; Acquire parameter information of the resource object according to the resource application request, the parameter information including resource specifications of the resource object and the application quantity of the resource object; Determining a first resource sequence according to the resource specifications and a cluster monitoring database, wherein the first resource sequence includes a correspondence between at least one first cluster and a creatable quantity of resource objects, the cluster monitoring database being configured to record host information and resource object information of multiple clusters; Determining a target cluster and an allocation amount of resource objects corresponding to the target cluster according to the application quantity and the first resource sequence; Sending a request to create the resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster; The parameter information also includes the target area location to which the resource object belongs, and the cluster monitoring database is further used to record the area locations of all clusters. Before determining the first resource sequence based on the resource specifications and the cluster monitoring database, the method further includes: Filtering all clusters in the cluster monitoring database according to the target area location and the area locations of all clusters in the cluster monitoring database; The determining of the first resource sequence according to the resource specification and the cluster monitoring database includes: Determining the first resource sequence according to the resource specifications and the remaining amount of hardware resources of the cluster screened in the cluster monitoring database; The determining, based on the application quantity and the first resource sequence, a target cluster and an allocation amount of resource objects corresponding to the target cluster includes: If the total amount of resource objects that can be created is greater than or equal to the requested amount, querying whether there is at least one second cluster in the first cluster that has created the resource object based on the resource object information of the first cluster; the total amount of resource objects that can be created is determined based on the first resource sequence; If there is a second cluster that has created the resource object, determining a second resource sequence, where the second resource sequence includes a correspondence between the second cluster and the amount of resource objects that have been created; Determining the target cluster and an allocation amount of resource objects corresponding to the target cluster according to the application quantity, the first resource sequence, and the second resource sequence; The determining, according to the application quantity, the first resource sequence, and the second resource sequence, the target cluster and the allocation amount of the resource objects corresponding to the target cluster includes: Obtaining a total number of resource objects of all second clusters according to the first resource sequence and the second resource sequence, where the total number of resource objects of all second clusters is the sum of the number of resource objects that can be created and the number of resource objects that have been created of all second clusters; If the total amount of resource objects of all the second clusters is greater than or equal to the application quantity, the second clusters will be determined as the target clusters in turn, and the resource object allocation amount corresponding to the target cluster will be determined based on the creatable amount of resource objects of the second cluster, until the sum of the resource object allocation amount and the created amount of resource objects of all the target clusters is greater than or equal to the application quantity.

2. The method according to claim 1, characterized in that The sending of the request to the target cluster to create the resource object, the method further comprising: When monitoring indicates that the resource object on the target cluster is successfully created, the cluster monitoring database is updated according to the resource object allocation amount corresponding to the target cluster.

3. The method according to claim 1, characterized in that The host machine information of the cluster includes the remaining hardware resources of the cluster, and determining the first resource sequence according to the resource specifications and a cluster monitoring database includes: The first resource sequence is determined according to the resource specification and remaining amounts of hardware resources of multiple clusters in the cluster monitoring database.

4. The method according to claim 1, wherein The determining of the first resource sequence according to the resource specification and the cluster monitoring database includes: In the cluster monitoring database, determining at least one cluster having a remaining amount of hardware resources greater than or equal to the resource specification as the first cluster; Determining the amount of resource objects that can be created corresponding to the first cluster based on the resource specifications and the remaining amount of hardware resources of the first cluster; The first resource sequence is determined according to the creatable quantity of resource objects corresponding to each of the first clusters.

5. The method according to claim 1, characterized in that The determining, based on the application quantity and the first resource sequence, a target cluster and an allocation amount of resource objects corresponding to the target cluster includes: Obtaining, according to the first resource sequence, the total amount of resource objects that can be created in all the first clusters; If the total creatable amount of resource objects is greater than or equal to the applied quantity, the target cluster is determined in the first cluster, and the resource object allocation amount corresponding to the target cluster is determined according to the creatable amount of resource objects of the first cluster and the applied quantity.

6. The method according to claim 5, characterized in that The determining, based on the application quantity and the first resource sequence, a target cluster and an allocation amount of resource objects corresponding to the target cluster further includes: If the total amount of resource objects that can be created is greater than or equal to the applied quantity, sorting the first resource sequence in descending order according to the amount of resource objects that can be created; In the sorted first resource sequence, the first clusters are determined as the target clusters in turn, and the resource object allocation quantity corresponding to the target clusters is determined according to the creatable quantity of resource objects of the first cluster, until the sum of the resource object allocation quantities of each target cluster is greater than or equal to the application quantity.

7. The method according to claim 1, characterized in that The determining, according to the application quantity, the first resource sequence, and the second resource sequence, the target cluster and the allocation amount of the resource objects corresponding to the target cluster further includes: If the total amount of resource objects of all the second clusters is less than the applied quantity, all the second clusters are determined as the target clusters, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the second clusters; In the first resource sequence, the third cluster other than the second cluster in the first cluster is determined as the target cluster in turn, and the resource object allocation quantity of the target cluster is determined according to the creatable quantity of resource objects of the third cluster, until the sum of the resource object allocation quantity and the created quantity of resource objects of all the target clusters is greater than or equal to the application quantity.

8. The method according to any one of claims 1 to 7, characterized in that The cluster is a Kubernetes cluster.

9. A resource scheduling device, characterized in that: The device comprises: A receiving module, configured to receive a resource application request from a terminal device, wherein the resource application request is used to apply for creation of one or more resource objects; An acquisition module, configured to acquire parameter information of the resource object according to the resource application request, wherein the parameter information includes resource specifications of the resource object and the application quantity of the resource object; a scheduling module configured to determine a first resource sequence based on the resource specifications and a cluster monitoring database, the first resource sequence including a correspondence between at least one first cluster and a creatable quantity of resource objects, the cluster monitoring database being configured to record host information and resource object information of multiple clusters, and to determine a target cluster and an allocation quantity of resource objects corresponding to the target cluster based on the application quantity and the first resource sequence; a sending module, configured to send a request to create the resource object to the target cluster according to the resource object allocation amount of the target cluster, so as to create the resource object on a host in the target cluster; The parameter information also includes the target area location to which the resource object belongs, and the cluster monitoring database is further used to record the area locations of all clusters; The resource scheduling device further includes: A screening module, configured to screen all clusters in the cluster monitoring database according to the target area location and the area locations of all clusters in the cluster monitoring database; The scheduling module is specifically configured to determine the first resource sequence according to the resource specifications and the remaining amount of hardware resources of the cluster screened in the cluster monitoring database; The scheduling module is specifically used to: If the total amount of resource objects that can be created is greater than or equal to the requested amount, querying whether there is at least one second cluster in the first cluster that has created the resource object based on the resource object information of the first cluster; the total amount of resource objects that can be created is determined based on the first resource sequence; If there is a second cluster that has created the resource object, determining a second resource sequence, where the second resource sequence includes a correspondence between the second cluster and the amount of resource objects that have been created; Determining the target cluster and an allocation amount of resource objects corresponding to the target cluster according to the application quantity, the first resource sequence, and the second resource sequence; The scheduling module is specifically used to: Obtaining a total number of resource objects of all second clusters according to the first resource sequence and the second resource sequence, where the total number of resource objects of all second clusters is the sum of the number of resource objects that can be created and the number of resource objects that have been created of all second clusters; If the total amount of resource objects of all the second clusters is greater than or equal to the application quantity, the second clusters will be determined as the target clusters in turn, and the resource object allocation amount corresponding to the target cluster will be determined based on the creatable amount of resource objects of the second cluster, until the sum of the resource object allocation amount and the created amount of resource objects of all the target clusters is greater than or equal to the application quantity.

10. A resource scheduling device, characterized in that: include: at least one processor and memory; The memory is used to store computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Resource scheduling method and device, cloud computing system and storage medium

    CN109582433A

  • Container cloud-based high-performance computing cluster creation method and system

    CN111212116A