Server scheduling method, device, equipment, medium and computer program product

By building a server tree structure and using three-level fill factors to dynamically select the target server, the problems of low resource utilization and unbalanced load in the server cluster are solved, load balancing and resource optimization allocation of the server cluster are realized, and system performance is improved.

CN120371542BActive Publication Date: 2025-08-15SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510866081.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-26
Publication Date
2025-08-15
Estimated Expiration
2045-06-26

AI Technical Summary

Technical Problem

In the existing server scheduling methods, the resource utilization rate of server cluster task processing is low, and the load is unbalanced between servers, resulting in a decline in overall system performance.

Method used

Build a server tree structure, dynamically select the target server layer, cluster and single server through three-level fill factors, calculate the fill factor based on the load information of each server layer, cluster and single server, and realize the global balanced allocation of server resources.

Benefits of technology

It improves the resource utilization rate of server cluster task processing, realizes load balancing between servers, and improves the overall stability and performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371542B_ABST
    Figure CN120371542B_ABST
Patent Text Reader

Abstract

The present application discloses a server scheduling method, apparatus, device, medium, and computer program product, which relate to the field of computer technology and are applied to a target host. The method comprises: when a target task is acquired, selecting a target server layer from a server tree based on a first fill factor; selecting a target server cluster from the target server layer based on a second fill factor, and selecting a target server from the target server cluster based on a third fill factor; allocating the target task to the target server for processing; the first fill factor is calculated based on the first maximum number of tasks that each server layer can handle and the number of first tasks being processed; the second fill factor is calculated based on the second maximum number of tasks that each server cluster can handle and the number of second tasks being processed; and the third fill factor is calculated based on the third maximum number of tasks that each server can handle and the number of third tasks being processed. The present application can achieve load balancing between servers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a server scheduling method, apparatus, device, medium and computer program product. Background Art

[0002] In the dynamic environment of distributed systems, achieving optimal performance and responsiveness depends heavily on the efficient utilization of computing resources. Algorithms that control server scheduling and synchronization are key factors in coordinating the smooth execution of activities in distributed environments. Server scheduling is the process of determining the order in which operations are executed on servers. Efficient scheduling algorithms are crucial for optimizing resource utilization, reducing latency, and improving overall system responsiveness. Furthermore, properly distributing server load within a distributed system to achieve workload balance is crucial. Unbalanced server allocation can lead to resource constraints, thereby degrading overall system performance. Balancing the computing load contributes to overall system stability.

[0003] Existing server scheduling methods primarily include First Come First Served (FCFS), Shortest Job First (SJF), and Priority Scheduling (PS). FCFS allocates tasks based on the order in which processes arrive. While simple and fair, it can lead to "starvation" problems, causing later short tasks to wait longer and resulting in longer average wait times. SJF prioritizes the process with the shortest estimated run time, ideally minimizing average wait times. However, due to its inability to accurately predict process execution times, it can cause long jobs to "starve." The PS method assigns a priority to each process, executing higher-priority tasks first. This ensures timely execution of high-priority tasks, but can lead to priority inversion and starvation problems.

[0004] In summary, how to improve the resource utilization of server cluster task processing and achieve load balancing among servers is a problem that needs to be solved. Summary of the Invention

[0005] In view of this, the present invention aims to provide a server scheduling method, apparatus, device, medium, and computer program product that can improve resource utilization of server cluster task processing and achieve load balancing between servers. The specific solution is as follows:

[0006] In a first aspect, the present application discloses a server scheduling method, which is applied to a target host and includes:

[0007] When a target task is obtained, a target server layer is selected from a server tree based on a first fill factor; wherein the server tree is a tree structure having a target host as a root node and servers in a preset server cluster as child nodes; the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server;

[0008] selecting a target server cluster from the target server tier based on a second fill factor, and selecting a target server from the target server cluster based on a third fill factor;

[0009] Assign the target task to the target server for processing;

[0010] Among them, the first filling factor is calculated based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed; the second filling factor is calculated based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed; the third filling factor is calculated based on the third maximum number of tasks that each server can handle and the third number of tasks being processed.

[0011] Optionally, the process of building a server tree based on a pre-set server cluster includes:

[0012] The target host is the root node of the server tree; the root node is the first server layer;

[0013] Get the target number of servers from the preset server cluster as child nodes and connect them to the root node to obtain a new server layer;

[0014] The new server layer is used as the current server layer, and for each server in the current server layer, a target number of servers are obtained from the unselected servers in the preset server cluster as child nodes and connected to each server to obtain a new server layer;

[0015] Repeat the steps of using the new server layer as the current server layer until all servers in the preset server cluster have been selected as child nodes to obtain a server tree including multiple server layers; wherein a target number of servers connected to each target node in the server tree constitute a server cluster, and the target node is a root node or any child node.

[0016] Optionally, the server scheduling method of the present application further includes:

[0017] In the current server layer, add the target number of servers obtained from the preset server cluster to each server in order from left to right.

[0018] Optionally, the process of obtaining a target number of servers from unselected servers in the preset server cluster as child nodes and connecting to each server to obtain a new server layer further includes:

[0019] If the number of unselected servers in the preset server cluster does not reach the target number, the current last server cluster of the server tree is constructed based on the unselected servers in the preset server cluster.

[0020] Optionally, the server scheduling method of the present application further includes:

[0021] When a new server appears in the preset server cluster, the new server is added to the server tree based on the current structure of the server tree.

[0022] Optionally, add new servers to the server tree based on the current structure of the server tree, including:

[0023] When the number of servers in the last server cluster of the current last server layer of the server tree does not reach the target number, the new server is added to the last server cluster;

[0024] When the number of servers in the last server cluster of the last server layer of the server tree reaches the target number, it is determined whether the total number of servers in the last server layer reaches the maximum number of servers corresponding to the layer;

[0025] Add the new server to the server tree based on the judgment result.

[0026] Optionally, add the new server to the server tree based on the judgment result, including:

[0027] If the total number of servers in the current last server layer does not reach the maximum number of servers corresponding to the layer, then a new first server cluster is added to the current last server layer, and the newly added servers are added to the first server cluster; wherein the parent node of the first server cluster is located in the server layer above the current last server layer, and the parent node is the first server in the previous server layer that does not have a child node;

[0028] If the total number of servers in the current last server layer reaches the maximum number of servers corresponding to that layer, a new server layer is added to the server tree, and a new second server cluster is added to the new server layer to add the newly added servers to the second server cluster; wherein the parent node of the second server cluster is the first server in the current last server layer.

[0029] Optionally, selecting a target server tier from the server tree based on the first fill factor includes:

[0030] Obtaining a first filling factor corresponding to each server layer in the server tree, and constructing a layer set based on the server layer corresponding to the minimum value of each first filling factor;

[0031] If the number of server layers in the layer set is single, the server layer in the layer set is directly used as the target server layer;

[0032] If there are multiple server layers in the layer set, a server layer is randomly selected from the layer set as the target server layer.

[0033] Optionally, selecting a target server cluster from the target server layer based on the second fill factor includes:

[0034] Obtaining the second filling factor corresponding to each server cluster in the target server layer, and constructing a cluster set based on the server cluster corresponding to the minimum value of each second filling factor;

[0035] If the number of server clusters in the cluster set is only one, the server cluster in the cluster set is directly used as the target server cluster;

[0036] If there are multiple server clusters in the cluster set, a server cluster is randomly selected from the cluster set as the target server cluster.

[0037] Optionally, selecting a target server from the target server cluster based on a third fill factor includes:

[0038] Obtaining the third filling factor corresponding to each server in the target server cluster, and constructing a server set based on the server corresponding to the minimum value of each third filling factor;

[0039] If the number of servers in the server set is only one, then the server in the server set is directly used as the target server;

[0040] If there are multiple servers in the server set, a server is randomly selected from the server set as the target server.

[0041] Optionally, the server scheduling method of the present application further includes:

[0042] determining a first fill factor based on a ratio between a first number of tasks being processed by each server layer and a first maximum number of tasks that can be processed;

[0043] determining a second fill factor based on a ratio between the second number of tasks being processed by each server cluster and a second maximum number of tasks that can be processed;

[0044] A third fill factor is determined based on a ratio between a third number of tasks being processed by each server and a third maximum number of tasks that can be processed by each server.

[0045] Optionally, the target host is locally provided with a first task set for recording the number of tasks being processed by each server layer, a second task set for recording the number of tasks being processed by each server cluster, and a third task set for recording the number of tasks being processed by each server; wherein, there are multiple first task sets, each first task set is numbered in ascending order based on the number of tasks, and the largest set number in the first task set is the first maximum number of tasks that the corresponding server layer can process; there are multiple second task sets, each second task set is numbered in ascending order based on the number of tasks, and the largest set number in the second task set is the second maximum number of tasks that the corresponding server cluster can process; there are multiple third task sets, each third task set is numbered in ascending order based on the number of tasks, and the largest set number in the third task set is the third maximum number of tasks that the corresponding server can process.

[0046] Optionally, each server layer is numbered in sequence from top to bottom in the server tree to obtain a corresponding layer number, each server cluster is numbered in sequence from left to right in the corresponding server layer to obtain a corresponding cluster number, and each server is numbered in sequence from left to right in the corresponding server cluster to obtain a corresponding server number.

[0047] Optionally, after assigning the target task to the target server for processing, the following steps are also included:

[0048] Determine the original third task set in which the server number of the target server is located, increment the set number of the original third task set by one to obtain a first updated set number, and then move the server number of the target server from the original third task set to the third task set corresponding to the first updated set number; wherein the value of the set number of the original third task set is consistent with the number of tasks being processed by the target server before receiving the target task;

[0049] Determine the original second task set where the cluster number of the target server cluster is located, increment the set number of the original second task set by one to obtain a second updated set number, and then move the cluster number of the target server cluster from the original second task set to the second task set corresponding to the second updated set number; wherein the value of the set number of the original second task set is consistent with the number of tasks being processed by the target server cluster before receiving the target task;

[0050] Determine the original first task set where the layer number of the target server layer is located, and add one to the set number of the original first task set to obtain the third updated set number, and then move the layer number of the target server layer from the original first task set to the first task set corresponding to the third updated set number; wherein the value of the set number of the original first task set is consistent with the number of tasks being processed by the target server layer before receiving the target task.

[0051] Optionally, the server scheduling method of the present application further includes:

[0052] Determine the number of first tasks currently being processed by each server layer based on the set number corresponding to the first task set where the layer number of each server layer currently resides;

[0053] Determine the number of second tasks currently being processed by each server cluster based on the set number corresponding to the second task set to which the cluster number of each server cluster currently belongs;

[0054] The number of third tasks currently being processed by each server is determined based on the set number corresponding to the third task set where the server number of each server currently resides.

[0055] Optionally, after obtaining the target task, it also includes:

[0056] If there is no idle server in the server tree for executing the target task, the target task is stored in a preset waiting queue;

[0057] When there are completed tasks in the server tree, based on the number of completed tasks, a preset random algorithm is used to obtain a corresponding number of target tasks from the waiting queue and assign them to the servers corresponding to the completed tasks for processing.

[0058] Optionally, the server scheduling method of the present application further includes:

[0059] In the waiting queue, the unexecuted target tasks are divided into different task rounds based on the maximum number of target tasks that the server tree can handle and the order in which the tasks are obtained. In each task round, the target tasks are sorted to obtain the task sequence number.

[0060] Accordingly, the process of obtaining the target task from the waiting queue using the preset random algorithm includes:

[0061] Calculate the task probability values of the target tasks corresponding to different task numbers in each task round; the task probability value is negatively correlated with the task round number and task number, and the sum of the task probability values of all target tasks in each task round is 1;

[0062] Determine the probability distribution interval corresponding to each target task based on the task probability value;

[0063] Generate a target random number and determine the target probability distribution interval in which the target random number lies to obtain the target task corresponding to the target probability distribution interval.

[0064] In a second aspect, the present application discloses a server scheduling device, which is applied to a target host and includes:

[0065] a layer selection module for selecting a target server layer from a server tree based on a first fill factor upon acquiring a target task; wherein the server tree is a tree structure having a target host as a root node and servers in a preset server cluster as child nodes; the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server;

[0066] a cluster selection module, configured to select a target server cluster from the target server layer based on a second fill factor;

[0067] A server selection module, configured to select a target server from the target server cluster based on a third fill factor;

[0068] The task allocation module is used to allocate the target task to the target server for processing;

[0069] Among them, the first filling factor is calculated based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed; the second filling factor is calculated based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed; the third filling factor is calculated based on the third maximum number of tasks that each server can handle and the third number of tasks being processed.

[0070] In a third aspect, the present application discloses an electronic device, comprising:

[0071] Memory, used to store computer programs;

[0072] The processor is used to execute a computer program to implement the steps of the aforementioned disclosed server scheduling method.

[0073] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed server scheduling method are implemented.

[0074] In a fifth aspect, the present application discloses a computer program product, including a computer program / instruction, which implements the steps of the aforementioned disclosed server scheduling method when executed by a processor.

[0075] It can be seen that when the target host in this application obtains the target task, it selects the target server layer from the server tree based on the first filling factor; wherein, the server tree is a tree structure with the target host as the root node and each server in the preset server cluster as a child node; the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server; based on the second filling factor, the target server cluster is selected from the target server layer, and based on the third filling factor, the target server is selected from the target server cluster; the target task is assigned to the target server for processing; wherein, the first filling factor is calculated based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed; the second filling factor is calculated based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed; the third filling factor is calculated based on the third maximum number of tasks that each server can handle and the third number of tasks being processed.

[0076] Beneficial Effects: This application constructs a server tree with the target host as the root node and the servers in the preset server cluster as child nodes, and specifically discloses the structure of the server tree, wherein the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server. In addition, this application calculates a first filling factor based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed, calculates a second filling factor based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed, and calculates a third filling factor based on the third maximum number of tasks that each server can handle and the third number of tasks being processed. Through this calculation method, the value of the filling factor can dynamically represent the current load information of the server layer, server cluster, and individual server. Then, when the target task is obtained, the target server layer is first selected from the server tree based on the first filling factor used to represent the load of each server layer, and then the target server cluster is selected from the target server layer based on the second filling factor used to represent the load of each server cluster. Finally, the target server is selected from the target server cluster based on the third filling factor used to represent the load of each server. That is, this application divides the server tree structure into three levels and schedules the servers according to the fill factor in the three-level structure, so as to achieve global balanced distribution of server cluster resources through hierarchical load perception, greatly improving the resource utilization of task processing in the server cluster and realizing load balancing among the servers. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.

[0078] Figure 1 This is a flow chart of a server scheduling method disclosed in this application;

[0079] Figure 2 A schematic diagram of the structure of a server tree disclosed in this application;

[0080] Figure 3 This is a schematic diagram of the architecture of a root node disclosed in this application;

[0081] Figure 4 A schematic diagram of a server node disclosed in this application;

[0082] Figure 5 This is a flow chart of a specific server scheduling method disclosed in this application;

[0083] Figure 6 This is a processing flow chart for a server tree task that is fully filled in the state disclosed in this application;

[0084] Figure 7 A server scheduling flow chart disclosed in this application;

[0085] Figure 8 A unit structure diagram of a waiting queue disclosed in this application;

[0086] Figure 9 This is a structural diagram of a server scheduling device disclosed in this application;

[0087] Figure 10 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0088] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0089] Existing server scheduling methods primarily include first-come, first-served (FCFS), shortest-job-first (SJF), and priority scheduling (PS). FCFS allocates tasks based on the order in which processes arrive. While simple and fair, it can lead to "starvation" issues, causing later short tasks to wait longer and resulting in longer average wait times. SJF prioritizes the process with the shortest estimated run time, ideally minimizing average wait times. However, due to its inability to accurately predict process execution times, it can cause long jobs to "starve." The PS method assigns a priority to each process, with higher-priority tasks executing first. This ensures the timely execution of high-priority tasks, but can lead to priority inversion and starvation issues.

[0090] To this end, embodiments of the present application disclose a server scheduling method, apparatus, device, medium, and computer program product, which can improve resource utilization of server cluster task processing and achieve load balancing among servers.

[0091] See also Figure 1 As shown, an embodiment of the present application discloses a server scheduling method, which is applied to a target host. The method includes:

[0092] Step S11: When the target task is obtained, a target server layer is selected from the server tree based on the first filling factor; wherein the server tree is a tree structure constructed with the target host as the root node and each server in the preset server cluster as a child node; the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server.

[0093] In this embodiment, a server tree is constructed with the target host as the root node and each server in the preset server cluster as a child node. This application also specifically discloses the structure of the server tree, wherein the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server.

[0094] Furthermore, the present application calculates a first fill factor based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed, calculates a second fill factor based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed, and calculates a third fill factor based on the third maximum number of tasks that each server can handle and the third number of tasks being processed. Through this calculation method, the value of the fill factor can dynamically represent the current load information of a single server layer, a single server cluster, and a single server. Then, when the target task is obtained, the target server layer is first selected from the server tree based on the first fill factor used to represent the load of each server layer.

[0095] It should be pointed out that the process of building a server tree based on the preset server cluster specifically includes: taking the target host as the root node of the server tree; the root node is the first server layer; obtaining a target number of servers from the preset server cluster as child nodes and connecting them to the root node to obtain a new server layer; taking the new server layer as the current server layer, and for each server in the current server layer, obtaining a target number of servers from the unselected servers in the preset server cluster as child nodes and connecting them to each server to obtain a new server layer; repeating the step of taking the new server layer as the current server layer until all servers in the preset server cluster have been selected as child nodes to obtain a server tree including multiple server layers; wherein, the target number of servers connected to each target node in the server tree constitute a server cluster, and the target node is the root node or any child node.

[0096] That is, if Figure 2 As shown, this application constructs the server cluster into a tree structure to obtain a server tree. Each server in the server cluster becomes a child node in the server tree, and the target host is the root node of the server tree. Starting from the root node, each node is connected to the target number (denoted as n) of child nodes. The first main node is called the first layer of the tree, that is, the first server layer. Then, the layers are layered downwards. Each time a child node branch is passed, the number of node layers increases by one. Figure 2 The upper right subscript of the server node indicates the server's tier number. Individual servers within a server cluster are added to the tree structure through the tree structure until all servers in the server cluster have been selected and added as child nodes. This results in a server tree consisting of multiple tiers of servers. The n servers connected to each node form a sub-unit of a tier, called a server cluster. That is, each tier node contains a server cluster consisting of n servers from the next tier, and so on.

[0097] Furthermore, it should be noted that the above method also includes: in the current server layer, adding the target number of servers obtained from the preset server cluster to each server in a left-to-right order. That is, when the present application obtains n servers from the server cluster as child nodes and adds them to each server in the current server layer, it needs to add them in a left-to-right order.

[0098] The process of obtaining a target number of servers from the unselected servers in the preset server cluster as child nodes and connecting each server to form a new server layer further includes: if the number of unselected servers in the preset server cluster does not reach the target number, constructing the last server cluster of the server tree based on the unselected servers in the preset server cluster. In other words, if the number of servers last added is less than n, the servers less than n are formed into a cluster unit, which serves as the last server cluster of the server tree.

[0099] Furthermore, the above method further includes: when a new server appears in the preset server cluster, adding the new server to the server tree based on the current structure of the server tree. It is understood that when a new server node is added to improve server cluster performance, the position assigned to the new server in the server tree should also meet the above requirements. Specifically, the new server needs to be added to the server tree based on the current structure of the server tree.

[0100] In a specific implementation, a new server is added to the server tree based on the current structure of the server tree, including: when the number of servers in the last server cluster of the current last server layer of the server tree does not reach the target number, the new server is added to the last server cluster; when the number of servers in the last server cluster of the current last server layer of the server tree reaches the target number, it is determined whether the total number of servers in the current last server layer reaches the maximum number of servers corresponding to the layer; and the new server is added to the server tree based on the determination result.

[0101] That is, when the number of servers in the last server cluster of the current last server layer of the entire server tree does not reach the target number, that is, when it does not reach n, then the newly added server can be added to the last server cluster. When the number of servers in the last server cluster of the current last server layer of the entire server tree reaches the target number n, it is necessary to further determine whether the total number of servers in the current last server layer has reached the maximum number of servers corresponding to the layer. It is understandable that since only n child nodes are allowed to be connected under each node, the maximum number of servers in the current server layer can be calculated based on the number of servers in the previous server layer. Therefore, this application needs to determine whether the total number of servers in the current last server layer has reached the maximum number of servers corresponding to the current last server layer, and then determine how to add the newly added server to the server tree based on the judgment result.

[0102] Specifically, new servers are added to the server tree based on the judgment result, including: if the total number of servers in the current last server layer does not reach the maximum number of servers corresponding to the layer, then a new first server cluster is added to the current last server layer, and the new servers are added to the first server cluster; wherein, the parent node of the first server cluster is located in the upper server layer of the current last server layer, and the parent node is the first server in the upper server layer that does not include child nodes; if the total number of servers in the current last server layer reaches the maximum number of servers corresponding to the layer, then a new server layer is added to the server tree, and a new second server cluster is added to the new server layer to add the new servers to the second server cluster; wherein, the parent node of the second server cluster is the first server in the current last server layer.

[0103] It is understood that, in one specific embodiment, if the total number of servers in the current last server layer has not yet reached the maximum number of servers corresponding to that layer, it means that there are still vacant server nodes in the corresponding previous server layer that are not connected to child nodes. Therefore, a new first server cluster is added to the current last server layer, and the newly added servers are added to the first server cluster. The parent node of the first server cluster is located in the server layer above the current last server layer, and the parent node is the first server in the previous server layer that does not have a child node.

[0104] In another specific embodiment, the total number of servers in the current last server layer has reached the maximum number of servers corresponding to the layer, which means that all the server nodes in the previous server layer are connected to the server cluster of this layer, and the server cluster of this layer has also reached the full state. In this case, a new server layer is added to the entire server tree, and a new second server cluster is added to the new server layer to add the newly added server to the second server cluster; wherein the parent node of the second server cluster is the first server in the current last server layer. That is, starting with the leftmost server node in the current last server layer, clusters are added to the next layer. Furthermore, as server nodes are added to the cluster, so that the number of servers in the cluster reaches n, new clusters are opened in sequence from left to right using the server nodes of the previous layer.

[0105] It should also be noted that the root node (ie, the target host) in the embodiment of the present application is an intelligent allocation host composed of a router, a memory, and a processor. Figure 3 As shown; the remaining nodes are server nodes composed of servers and intelligent routers, as shown in Figure 4 shown.

[0106] Step S12: Select a target server cluster from the target server layer based on the second filling factor, and select a target server from the target server cluster based on the third filling factor.

[0107] In this embodiment, after the target server layer is selected, the target server cluster is selected from the target server layer based on the second filling factor used to represent the load of each server cluster, and finally the target server is selected from the target server cluster based on the third filling factor used to represent the load of each server.

[0108] That is, this application divides the server tree structure into three levels and schedules the servers according to the fill factor in the three-level structure, so as to achieve global balanced distribution of server cluster resources through hierarchical load perception, greatly improving the resource utilization of task processing in the server cluster and realizing load balancing among the servers.

[0109] Step S13: Allocate the target task to the target server for processing.

[0110] In this embodiment, the acquired target task is assigned to the selected target server for processing.

[0111] As can be seen, the present application constructs a server tree with the target host as the root node and the servers in the preset server cluster as child nodes, and specifically discloses the structure of the server tree, wherein the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server. In addition, the present application calculates a first fill factor based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed, calculates a second fill factor based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed, and calculates a third fill factor based on the third maximum number of tasks that each server can handle and the third number of tasks being processed. Through this calculation method, the fill factor value can dynamically represent the current load information of the server layer, server cluster, and individual server. Then, when the target task is obtained, the target server layer is first selected from the server tree based on the first fill factor used to represent the load of each server layer, the target server cluster is then selected from the target server layer based on the second fill factor used to represent the load of each server cluster, and finally, the target server is selected from the target server cluster based on the third fill factor used to represent the load of each server. That is, this application divides the server tree structure into three levels and schedules the servers according to the fill factor in the three-level structure, so as to achieve global balanced distribution of server cluster resources through hierarchical load perception, greatly improving the resource utilization of task processing in the server cluster and realizing load balancing among the servers.

[0112] See also Figure 5As shown, the embodiment of the present application discloses a specific server scheduling method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:

[0113] Step S21: When the target task is obtained, a target server layer is selected from the server tree based on a first filling factor; wherein the server tree is a tree structure constructed with the target host as the root node and each server in the preset server cluster as a child node; the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server; the first filling factor is calculated based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed.

[0114] It should be pointed out that the target host is locally provided with a first task set for recording the number of tasks being processed by each server layer, a second task set for recording the number of tasks being processed by each server cluster, and a third task set for recording the number of tasks being processed by each server; wherein, there are multiple first task sets, and each first task set is numbered in ascending order based on the number of tasks, and the largest set number in the first task set is the first maximum number of tasks that the corresponding server layer can process; there are multiple second task sets, and each second task set is numbered in ascending order based on the number of tasks, and the largest set number in the second task set is the second maximum number of tasks that the corresponding server cluster can process; there are multiple third task sets, and each third task set is numbered in ascending order based on the number of tasks, and the largest set number in the third task set is the third maximum number of tasks that the corresponding server can process.

[0115] Among them, each server layer is numbered in the order from top to bottom in the server tree to obtain the corresponding layer number, each server cluster is numbered in the order from left to right in the corresponding server layer to obtain the corresponding cluster number, and each server is numbered in the order from left to right in the corresponding server cluster to obtain the corresponding server number. Figure 2 As shown, the upper right subscript of the server node represents the layer number of the server, the number on the left of the lower right bracket represents the current cluster number, and the number on the right represents the cluster server number of the server in the current cluster.

[0116] That is, in the memory of the target host, there are three types of sets, namely the first task set, the second task set and the third task set. The values of the three types of sets represent the number of tasks currently processed by each server layer, each server cluster and each server in the server tree. Among them, the first task set and the second task set corresponding to each cluster in the corresponding layer, and the second task set and the third task set corresponding to each server in the corresponding cluster belong to a recursive relationship. When the server tree is not in use, the layer number, cluster number and server number in all server node codes are placed in the three sets with a task number of 0 in the target host, that is, the layer number in the server tree is in the first task set with a task number of 0, and the cluster number in each layer is determined by the recursive relationship to be allocated to the second task set with a task number of 0. Similarly, the server number in each cluster is also allocated to the third task set with a task number of 0. When the task of the corresponding server node is 1, the layer number, cluster number and server number of the corresponding node will be placed in the set with the task number of 1. Similarly, when all server nodes are fully loaded, the first task set, the second task set and the third task set placed by the layer number, cluster number and server number will also reach the corresponding maximum set number: M d_max 、M d_c_max and M d_c_n_max It should be noted that when adding server nodes to the server tree to increase the processing performance of the server tree, the maximum set number M of the set to which the layer number, cluster number, and server number belong is d_max 、M d_c_max and M d_c_n_max The tree position of the added server node will also be updated accordingly.

[0117] In the above symbols, M represents the number of tasks, d represents the layer number, c represents the cluster number, and n represents the server number in the cluster; d_max M represents the maximum number of tasks that the server layer with layer number d can handle. d_c_max represents the maximum number of tasks that a server cluster with layer number d and cluster number c can handle; M d_c_n represents the number of tasks processed by the server with layer number d, cluster number c, and server number n in the cluster, then M d_c_n_max The maximum number of tasks that a single server can handle.

[0118] For example, when a completely empty server tree receives a target task sent by a client, it first randomly generates a layer number through the target host, then randomly generates a cluster number within the layer number and a server number within the cluster, and then distributes them to the corresponding layer, cluster, and server node within the cluster. At this time, the corresponding layer number, cluster number, and server number will be added to the task set with a task number of 1. Similarly, when the server in the same layer and cluster is assigned a task, the number of server tasks in the cluster is increased by one, which will cause the number of tasks in the same cluster to increase by one, and extend to the number of server tasks in the same layer to increase by one, and the corresponding layer number, cluster number, and server number within the cluster are added to the task set with the corresponding task number. As the number of tasks assigned in the server tree increases, the server specifically assigned to the task will cause the current layer number to belong to the first task set with a higher number of tasks. At the same time, the current cluster number will also be added to the second set with a higher number of tasks under the current layer. When the server tree processes tasks that reach the maximum value M max , the layer number, cluster number and server number of each layer will also be attributed to the maximum value M of the layer, cluster and server task d_max 、M d_c_max and M d_c_n_max in the task set.

[0119] At the same time, when the server of the relevant node returns a task completion message to the target host, the target host will return the message to the corresponding task requesting client and remove the layer number, cluster number, and server number within the cluster from the current task set to which it belongs. The node will be assigned to the task set with the number of tasks for each layer, cluster, and server minus one. The set always maintains a recursive relationship between the layer, cluster, and server number within the cluster. For example, when a server completes a task and returns the result to the target host, the layer number of the layer, cluster number, and server number of the cluster to which the server belongs will be removed from the corresponding original task set and assigned to the task set with the number of tasks minus one.

[0120] Furthermore, the above method also includes: determining the number of first tasks currently being processed by each server layer based on the set number corresponding to the first task set where the layer number of each server layer currently resides; determining the number of second tasks currently being processed by each server cluster based on the set number corresponding to the second task set where the cluster number of each server cluster currently resides; and determining the number of third tasks currently being processed by each server based on the set number corresponding to the third task set where the server number of each server currently resides. It can be understood that, from the above content, as the number of tasks processed by a single server changes, its corresponding server number, the cluster number of the cluster to which it belongs, and the task set to which the layer number of the layer currently belongs will change accordingly. Therefore, the number of first tasks M currently being processed by each server layer can be determined by the set number corresponding to the first task set where the layer number of each server layer currently resides. dSimilarly, based on the cluster number of each server cluster, the number of second tasks currently being processed by each server cluster can be determined based on the cluster number corresponding to the second task set currently located. d_c Based on the set number corresponding to the third task set where the server number of each server currently resides, the number of third tasks M currently being processed by each server can be determined. d_c_n .

[0121] Specifically, the above method also includes: determining a first filling factor based on the ratio between the first number of tasks being processed by each server layer and the first maximum number of tasks that can be processed; determining a second filling factor based on the ratio between the second number of tasks being processed by each server cluster and the second maximum number of tasks that can be processed; and determining a third filling factor based on the ratio between the third number of tasks being processed by each server and the third maximum number of tasks that can be processed.

[0122] That is, the target host will establish a corresponding filling factor for each layer, each cluster, and each server in the memory, that is, the first filling factor f d , the second filling factor f d_c and the third filling factor f d_c_n The calculation method is as follows:

[0123] ;

[0124] ;

[0125] ;

[0126] From the above calculation method, we can know that the filling factor f d 、f d_c and f d_c_n The value range is [0, 1].

[0127] In a specific implementation, a target server layer is selected from a server tree based on a first filling factor, including: obtaining the first filling factor corresponding to each server layer in the server tree, and constructing a layer set based on the server layer corresponding to the minimum value of each first filling factor; if the number of server layers in the layer set is single, the server layer in the layer set is directly used as the target server layer; if the number of server layers in the layer set is multiple, a server layer is randomly selected from the layer set as the target server layer.

[0128] That is, each server layer will obtain a corresponding first filling factor according to the above calculation formula. This application needs to determine the minimum value among each first filling factor, and build a layer set based on the server layer corresponding to the minimum value, and further select the target server layer from the layer set. Among them, if the number of server layers in the layer set is single, the server layer in the layer set is directly used as the target server layer, and if the number of server layers in the layer set is multiple, a server layer is randomly selected from the layer set as the target server layer. It can be understood that layers with the same filling factor belong to the same set of categories in the memory of the target host, and are dynamically adjusted according to the allocation and completion of tasks.

[0129] Step S22: Select a target server cluster from the target server layer based on the second filling factor, and select a target server from the target server cluster based on the third filling factor; the second filling factor is calculated based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed; the third filling factor is calculated based on the third maximum number of tasks that each server can handle and the third number of tasks being processed.

[0130] In a specific embodiment, selecting a target server cluster from a target server layer based on a second filling factor includes: obtaining the second filling factors corresponding to each server cluster in the target server layer, and constructing a cluster set based on the server cluster corresponding to the minimum of each second filling factor; if the cluster set contains only one server cluster, directly using the server cluster in the cluster set as the target server cluster; if the cluster set contains multiple server clusters, randomly selecting a server cluster from the cluster set as the target server cluster. That is, each server cluster will obtain a corresponding second filling factor according to the above calculation formula. This application requires determining the minimum of each second filling factor, constructing a cluster set based on the server cluster corresponding to the minimum, and further selecting a target server cluster from the cluster set. If the cluster set contains only one server cluster, directly using the server cluster in the cluster set as the target server cluster; if the cluster set contains multiple server layers, randomly selecting a server cluster from the cluster set as the target server cluster. It is understood that clusters with the same filling factor belong to the same set of categories in the target host's memory and are dynamically adjusted based on task allocation and completion.

[0131] Similarly, selecting a target server from the target server cluster based on the third filling factor includes: obtaining the third filling factor corresponding to each server in the target server cluster, and constructing a server set based on the server corresponding to the minimum value of each third filling factor; if the number of servers in the server set is single, then directly use the server in the server set as the target server; if the number of servers in the server set is multiple, then randomly select a server from the server set as the target server. That is, each server will obtain the corresponding third filling factor according to the above calculation formula. This application needs to determine the minimum value of each third filling factor, and construct a server set based on the server corresponding to the minimum value, and further select the target server from the server set. Among them, if the number of servers in the server set is single, then directly use the server in the server set as the target server, and if the number of server layers in the server set is multiple, then randomly select a server from the server set as the target server.

[0132] That is, when the server tree structure receives a new target task, it first allocates tasks based on the first filling factor, and gives priority to allocating tasks to the layer set with the smallest first filling factor, and selects a layer from the layer set with the smallest filling factor through a random algorithm to determine it as the task allocation layer. In the task allocation layer, the cluster set with the smallest second filling factor is selected, and the task allocation cluster is randomly selected for task allocation. The server set with the smallest third filling factor is selected in the task allocation cluster, and a server is randomly selected from the server set for task allocation. It can be seen that the present application divides the server tree structure into three levels according to the filling factor, and recursively includes the server layer, cluster, and server number within the cluster, and then combines and classifies them according to the filling factor in the three-level structure, performs dynamic set adjustment based on the allocation and completion of tasks, and randomly allocates tasks to the layer set, cluster set, and server set with the smallest filling factor, thereby greatly improving the resource utilization of each node in the entire server cluster.

[0133] Step S23: Allocate the target task to the target server for processing.

[0134] Step S24: Determine the original third task set where the server number of the target server is located, and add one to the set number of the original third task set to obtain the first updated set number, and then move the server number of the target server from the original third task set to the third task set corresponding to the first updated set number.

[0135] In this embodiment, after the target task is assigned to the target server for processing, the task set to which the target server's server number belongs needs to be updated. Specifically, the original third task set to which the target server's server number belongs is first determined. The value of the set number of the original third task set is consistent with the number of tasks being processed by the target server before receiving the target task. Then, the set number of the original third task set is incremented by one to obtain a first updated set number. The target server's server number is then moved from the original third task set to the third task set corresponding to the first updated set number.

[0136] Step S25: Determine the original second task set where the cluster number of the target server cluster is located, and add one to the set number of the original second task set to obtain the second updated set number, and then move the cluster number of the target server cluster from the original second task set to the second task set corresponding to the second updated set number.

[0137] In this embodiment, after the target task is assigned to the target server for processing, the task set to which the cluster number of the target server's cluster belongs needs to be updated. Specifically, the original second task set to which the cluster number of the target server cluster belongs is first determined. The value of the set number of the original second task set is consistent with the number of tasks being processed by the target server cluster before receiving the target task. Then, the set number of the original second task set is incremented by one to obtain a second updated set number. The cluster number of the target server cluster is then moved from the original second task set to the second task set corresponding to the second updated set number.

[0138] Step S26: Determine the original first task set where the layer number of the target server layer is located, and add one to the set number of the original first task set to obtain the third updated set number, and then move the layer number of the target server layer from the original first task set to the first task set corresponding to the third updated set number.

[0139] In this embodiment, after assigning the target task to the target server for processing, the task set corresponding to the layer number of the target server's layer needs to be updated. Specifically, the original first task set corresponding to the layer number of the target server layer is first determined. The set number of the original first task set is consistent with the number of tasks being processed by the target server layer before receiving the target task. The set number of the original first task set is then incremented by one to obtain a third updated set number. The layer number of the target server layer is then moved from the original first task set to the first task set corresponding to the third updated set number.

[0140] For a more specific processing procedure of the above step S23, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0141] It can be seen that the present application divides the server tree structure into three levels according to the filling factor, and recursively includes the server layer, cluster, and server number within the cluster. Then, in the three-level structure, it combines and classifies them according to the filling factor, performs dynamic set adjustment based on the distribution and completion of tasks, and randomly allocates tasks to the layer set, cluster set, and server set with the minimum filling factor, thereby greatly improving the resource utilization of each node in the entire server cluster. In addition, the target host is locally provided with a first task set for recording the number of tasks being processed by each server layer, a second task set for recording the number of tasks being processed by each server cluster, and a third task set for recording the number of tasks being processed by each server. As the number of tasks processed by a single server changes, the corresponding server number, the cluster number of the cluster to which it belongs, and the task set to which the layer number of the layer currently belongs will change accordingly.

[0142] For further information, see Figure 6 and Figure 7 As shown, based on the above embodiment, after obtaining the target task, the method of the present application further includes:

[0143] Step S31: If there is no idle server in the server tree for executing the target task, the target task is stored in a preset waiting queue.

[0144] In this embodiment, when the server tree tasks are full, that is, there is currently no idle server in the server tree for executing the target task, the target task is first stored in the preset waiting queue. At this time, the values of the first filling factor, the second filling factor and the third filling factor are all 1. Figure 8 This is the unit structure diagram of the waiting queue, which is mainly composed of a task memory and an arithmetic unit.

[0145] Step S32: When there are completed tasks in the server tree, based on the number of completed tasks, a preset random algorithm is used to obtain a corresponding number of target tasks from the waiting queue and assign them to the servers corresponding to the completed tasks for processing.

[0146] In this embodiment, when there are completed tasks in the server tree, a node with a fill factor other than 1 is generated. Based on the number of completed tasks, the processor then uses a preset random algorithm to retrieve a corresponding number of target tasks from the waiting queue and assigns them to the servers corresponding to the completed tasks for processing. In other words, the processor uses a preset random algorithm to retrieve the same number of target tasks from the waiting queue as the number of completed tasks, and assigns them to the corresponding servers for processing.

[0147] In a specific embodiment, the above method further includes: dividing each unexecuted target task in the waiting queue into different task rounds based on the target maximum number of tasks that the server tree can handle and the order in which tasks are acquired, and sorting each target task in each task round to obtain a task sequence number. It can be understood that there is a memory in the waiting queue, and the target maximum number of tasks that all servers in the server tree can handle is recorded as M. max , the number of elements in the waiting queue has reached M max In the case of , a new round of allocation will be carried out for the newly acquired tasks, from 1 to M max As a round, the new round of tasks will enter a new round of combination. According to this method, the tasks are marked as follows: the upper mark of the task is the task round number of the task, and the lower mark is the task sequence number of the task in this round. , where m represents the acquired task requirement, i represents the task round number, and j represents the task sequence number of the task in the corresponding task round number.

[0148] When a task enters the waiting queue, it will be marked according to the above method. Each task that needs to wait will be marked once and added to the memory. When the corresponding task is obtained from the waiting queue in a different round, the waiting tasks in the corresponding round will be rearranged in order from 1 to the end of the round set according to the previous order. For example, when the tasks in round i are full and task When it is sent to the server tree for task processing, the number of tasks in round i will be reduced by one, and the total number of tasks will become M max -1. At this time, the i-th round of waiting tasks, The index will be reduced by one, and the number of tasks at the end of the queue will be increased by becomes ,at this time, Will become the new Similarly, whenever a task element in a different set is completed, the sequence number of the task element after it in that set is decremented by one, until all task elements in that round set are completed. When the round is completely completed, the round number after that round is decremented by one, that is, the i+1th round is updated to i, and this continues until all task elements in all round sets are completed and the number of tasks stored in the waiting queue memory is 0.

[0149] Correspondingly, the process of obtaining the target task from the waiting queue using a preset random algorithm includes: calculating the task probability value of the target task corresponding to different task numbers in each task round; wherein the task probability value is negatively correlated with the task round and the task number, and the sum of the task probability values of all target tasks in each task round is 1; determining the probability distribution interval corresponding to each target task based on the task probability value; generating a target random number, and determining the target probability distribution interval in which the target random number is located, so as to obtain the target task corresponding to the target probability distribution interval.

[0150] It is understandable that in order to obtain the target task from the waiting queue using a preset random algorithm, the present application first needs to calculate the task probability value of the target task corresponding to the different task numbers in each task round. The specific calculation formula used is as follows:

[0151] ;

[0152] In the above formula, The number of tasks at the end of round i. This value is dynamically updated based on the latest tasks added to the server tree; The total number of task rounds in the waiting task queue is updated dynamically based on the number of completed task rounds in the waiting queue. The value of l ranges from 1 to , is the probability value of the jth task being selected in the i-th round of the waiting queue; a is the probability dilution factor, which consists of a positive integer. The larger a is, the larger the denominator of the probability dilution is for the task queue with a longer waiting time. Therefore, the probability of being selected in a smaller round can be increased by increasing the value of a; is the number of tasks at the end of round l, and the value of k ranges from 1 to .

[0153] It can be seen from the formula that the larger the number of task rounds and the larger the task sequence number, the smaller the corresponding task probability value.

[0154] In addition, the probability of each layer is :

[0155] ;

[0156] Furthermore, the probability values of all tasks waiting in the queue from the first round to the last round are added together to obtain:

[0157] ;

[0158] The probability distribution interval of each round is [ , ], The probability distribution is 0. By generating a target random number b from the interval (0,1), the task round number i of the task assigned to the server tree is determined by the interval where the number is located. The tasks in the waiting sequence of each round are filled in order. The probability distribution interval of tasks with different task numbers in each round is [ , ], according to the target probability distribution interval where the target random number b is located, the corresponding target task is filled into the server tree structure.

[0159] This application uses a random algorithm to assign probability distribution intervals to different layers, where the round number factor in the task probability is added to the formula , l is the current task round number. The smaller the task round number, the greater the probability of task execution.

[0160] Assume that there are two rounds in the waiting queue, the probability dilution factor a is 2, there are 4 tasks waiting for messages in the first round, and there are 5 tasks waiting for messages in the second round. , , , .

[0161] Specifically:

[0162] ;

[0163] ;

[0164] And so on.

[0165] Finally, the probability of obtaining is as follows:

[0166] , , , ;

[0167] , , , , .

[0168] As can be seen, when the server tree is fully populated, meaning there are no idle servers in the server tree currently available to execute the target task, the target task will first be stored in a preset waiting queue. This application can effectively improve the fairness of the server cluster in processing waiting message queues by dynamically and randomly allocating waiting task sequences, making tasks with smaller task rounds and smaller task numbers more likely to be selected. This can effectively avoid the problem of infinite blocking that occurs when allocating server computing resources, and effectively balance the average waiting time of tasks.

[0169] See also Figure 9 As shown, an embodiment of the present application discloses a server scheduling device, which is applied to a target host and includes:

[0170] The layer selection module 11 is used to select the target server layer from the server tree based on the first filling factor when the target task is obtained; wherein the server tree is a tree structure constructed with the target host as the root node and the servers in the preset server cluster as child nodes; the server tree includes multiple server layers, each of the server layers includes at least one server cluster, and each of the server clusters includes at least one server; the first filling factor is calculated based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed.

[0171] The cluster selection module 12 is configured to select a target server cluster from the target server layer based on a second filling factor; the second filling factor is calculated based on a second maximum number of tasks that each server cluster can process and a second number of tasks being processed.

[0172] The server selection module 13 is configured to select a target server from the target server cluster based on a third filling factor; the third filling factor is calculated based on a third maximum number of tasks that each server can process and a third number of tasks being processed.

[0173] The task allocation module 14 is configured to allocate the target task to the target server for processing.

[0174] As can be seen, the present application constructs a server tree with the target host as the root node and the servers in the preset server cluster as child nodes, and specifically discloses the structure of the server tree, wherein the server tree includes multiple server layers, each server layer includes at least one server cluster, and each server cluster includes at least one server. In addition, the present application calculates a first fill factor based on the first maximum number of tasks that each server layer can handle and the first number of tasks being processed, calculates a second fill factor based on the second maximum number of tasks that each server cluster can handle and the second number of tasks being processed, and calculates a third fill factor based on the third maximum number of tasks that each server can handle and the third number of tasks being processed. Through this calculation method, the fill factor value can dynamically represent the current load information of the server layer, server cluster, and individual server. Then, when the target task is obtained, the target server layer is first selected from the server tree based on the first fill factor used to represent the load of each server layer, the target server cluster is then selected from the target server layer based on the second fill factor used to represent the load of each server cluster, and finally, the target server is selected from the target server cluster based on the third fill factor used to represent the load of each server. That is, this application divides the server tree structure into three levels and schedules the servers according to the fill factor in the three-level structure, so as to achieve global balanced distribution of server cluster resources through hierarchical load perception, greatly improving the resource utilization of task processing in the server cluster and realizing load balancing among the servers.

[0175] Since the embodiments of the device part correspond to the above embodiments, the embodiments of the device part please refer to the description of the embodiments of the method part, and will not be repeated here.

[0176] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, the device may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the server scheduling method performed by the electronic device disclosed in any of the aforementioned embodiments.

[0177] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0178] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0179] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0180] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, enabling the processor 21 to calculate and process the massive amount of data 223 in the memory 22. It can be Windows, Unix, Linux, etc. In addition to including computer programs capable of implementing the server scheduling method performed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer programs 222 may further include computer programs capable of performing other specific tasks. Data 223 may include data received by the electronic device from external devices, as well as data collected by its own input and output interface 25.

[0181] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the server scheduling method steps disclosed in any of the aforementioned embodiments are implemented.

[0182] An embodiment of the present invention further discloses a computer program product, including a computer program / instruction, which implements the steps of the server scheduling method disclosed in any of the aforementioned embodiments when executed by a processor.

[0183] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0184] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0185] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.

[0186] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0187] The server scheduling method, device, equipment, medium and computer program product provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for general technical personnel in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A server scheduling method, characterized in that: Applied to the target host, including: When a target task is obtained, a target server layer is selected from a server tree based on a first fill factor; wherein the server tree is a tree structure constructed with the target host as a root node and each server in a preset server cluster as a child node; the server tree includes a plurality of server layers, each of the server layers includes at least one server cluster, and each of the server clusters includes at least one server; selecting a target server cluster from the target server tier based on a second fill factor, and selecting a target server from the target server cluster based on a third fill factor; Allocating the target task to the target server for processing; The first fill factor is calculated based on a first maximum number of tasks that each server layer can process and a first number of tasks being processed; the second fill factor is calculated based on a second maximum number of tasks that each server cluster can process and a second number of tasks being processed; and the third fill factor is calculated based on a third maximum number of tasks that each server can process and a third number of tasks being processed. The process of building a server tree based on a preset server cluster includes: The target host is used as the root node of the server tree; the root node is the first server layer; Obtaining a target number of servers from a preset server cluster as child nodes and connecting them to the root node to obtain a new server layer; The new server layer is used as the current server layer, and for each server in the current server layer, a target number of servers are obtained from the unselected servers in the preset server cluster as child nodes to connect to each server to obtain a new server layer; Repeat the step of using the new server layer as the current server layer until all servers in the preset server cluster have been selected as the child nodes to obtain a server tree including multiple server layers; wherein a target number of servers connected to each target node in the server tree constitute a server cluster, and the target node is a root node or any of the child nodes.

2. The server scheduling method according to claim 1, wherein: Also includes: In the current server layer, the target number of servers obtained from the preset server cluster is added to each server in order from left to right.

3. The server scheduling method according to claim 1, wherein: The process of obtaining a target number of servers from the unselected servers in the preset server cluster as child nodes and connecting them to each of the servers to obtain a new server layer further includes: If the number of unselected servers in the preset server cluster does not reach the target number, the current last server cluster of the server tree is constructed based on the unselected servers in the preset server cluster.

4. The server scheduling method according to claim 2, wherein: Also includes: When a new server appears in the preset server cluster, the new server is added to the server tree based on the current structure of the server tree.

5. The server scheduling method according to claim 4, characterized in that: The adding the new server to the server tree based on the current structure of the server tree includes: When the number of servers in the last server cluster of the current last server layer of the server tree does not reach the target number, adding the newly added server to the last server cluster; When the number of servers in the last server cluster of the current last server layer of the server tree reaches the target number, determining whether the total number of servers in the current last server layer reaches the maximum number of servers corresponding to the layer; The newly added server is added to the server tree based on the judgment result.

6. The server scheduling method according to claim 5, characterized in that: Adding the newly added server to the server tree based on the determination result includes: If the total number of servers in the current last server layer does not reach the maximum number of servers corresponding to the layer, then add a new first server cluster in the current last server layer, and add the newly added server to the first server cluster; wherein the parent node of the first server cluster is located in the server layer above the current last server layer, and the parent node is the first server in the server layer above that does not include a child node; If the total number of servers in the current last server layer reaches the maximum number of servers corresponding to the layer, a new server layer is added to the server tree, and a new second server cluster is added to the new server layer to add the newly added servers to the second server cluster; wherein the parent node of the second server cluster is the first server in the current last server layer.

7. The server scheduling method according to claim 1, wherein: The selecting a target server layer from the server tree based on the first fill factor includes: Obtaining a first filling factor corresponding to each server layer in the server tree, and constructing a layer set based on the server layer corresponding to the minimum value of each of the first filling factors; If the number of server layers in the layer set is single, directly using the server layer in the layer set as the target server layer; If there are multiple server layers in the layer set, a server layer is randomly selected from the layer set as the target server layer.

8. The server scheduling method according to claim 1, wherein: The selecting a target server cluster from the target server layer based on the second fill factor includes: Obtaining a second filling factor corresponding to each server cluster in the target server layer, and constructing a cluster set based on the server cluster corresponding to the minimum value of each of the second filling factors; If the number of server clusters in the cluster set is single, directly using the server cluster in the cluster set as the target server cluster; If there are multiple server clusters in the cluster set, a server cluster is randomly selected from the cluster set as the target server cluster.

9. The server scheduling method according to claim 1, wherein: The selecting a target server from the target server cluster based on the third fill factor includes: Obtaining a third filling factor corresponding to each server in the target server cluster, and constructing a server set based on servers corresponding to minimum values of the third filling factors; If the number of servers in the server set is only one, directly use the server in the server set as the target server; If there are multiple servers in the server set, a server is randomly selected from the server set as the target server.

10. The server scheduling method according to claim 1, wherein: Also includes: determining the first fill factor based on a ratio between the first number of tasks being processed by each server layer and a first maximum number of tasks that can be processed; determining the second fill factor based on a ratio between the second number of tasks being processed by each server cluster and the second maximum number of tasks that can be processed; The third fill factor is determined based on a ratio between a third number of tasks being processed by each server and a third maximum number of tasks that can be processed by each server.

11. The server scheduling method according to claim 1, wherein: The target host is locally provided with a first task set for recording the number of tasks being processed by each server layer, a second task set for recording the number of tasks being processed by each server cluster, and a third task set for recording the number of tasks being processed by each server; wherein, there are multiple first task sets, each of which is numbered in ascending order based on the number of tasks, and the largest set number in the first task sets is the first maximum number of tasks that the corresponding server layer can process; there are multiple second task sets, each of which is numbered in ascending order based on the number of tasks, and the largest set number in the second task set is the second maximum number of tasks that the corresponding server cluster can process; there are multiple third task sets, each of which is numbered in ascending order based on the number of tasks, and the largest set number in the third task set is the third maximum number of tasks that the corresponding server can process.

12. The server scheduling method according to claim 11, characterized in that: Each server layer is numbered in sequence according to the arrangement order from top to bottom in the server tree to obtain a corresponding layer number, each server cluster is numbered in sequence according to the arrangement order from left to right in the corresponding server layer to obtain a corresponding cluster number, and each server is numbered in sequence according to the arrangement order from left to right in the corresponding server cluster to obtain a corresponding server number.

13. The server scheduling method according to claim 12, wherein: After allocating the target task to the target server for processing, the method further includes: Determining the original third task set in which the server number of the target server is located, and incrementing the set number of the original third task set by one to obtain a first updated set number, and then moving the server number of the target server from the original third task set to the third task set corresponding to the first updated set number; wherein the value of the set number of the original third task set is consistent with the number of tasks being processed by the target server before receiving the target task; Determine the original second task set where the cluster number of the target server cluster is located, and increment the set number of the original second task set by one to obtain a second updated set number, and then move the cluster number of the target server cluster from the original second task set to the second task set corresponding to the second updated set number; wherein the value of the set number of the original second task set is consistent with the number of tasks being processed by the target server cluster before receiving the target task; Determine the original first task set where the layer number of the target server layer is located, and add one to the set number of the original first task set to obtain a third updated set number, and then move the layer number of the target server layer from the original first task set to the first task set corresponding to the third updated set number; wherein the value of the set number of the original first task set is consistent with the number of tasks being processed by the target server layer before receiving the target task.

14. The server scheduling method according to claim 13, wherein: Also includes: Determine the number of first tasks currently being processed by each server layer based on the set number corresponding to the first task set where the layer number of each server layer currently resides; Determining the number of second tasks currently being processed by each server cluster based on the set number corresponding to the second task set to which the cluster number of each server cluster currently belongs; The number of third tasks currently being processed by each server is determined based on the set number corresponding to the third task set where the server number of each server currently resides.

15. The server scheduling method according to any one of claims 1 to 14, characterized in that: After obtaining the target task, it also includes: If there is no idle server in the server tree currently for executing the target task, the target task is stored in a preset waiting queue; When there are completed tasks in the server tree, based on the number of completed tasks, a preset random algorithm is used to obtain a corresponding number of target tasks from the waiting queue and allocate them to the servers corresponding to the completed tasks for processing.

16. The server scheduling method according to claim 15, characterized in that: Also includes: In the waiting queue, each unexecuted target task is divided into different task rounds based on the target maximum number of tasks that the server tree can process and the order in which tasks are acquired, and each target task is sorted in each task round to obtain a task sequence number; Accordingly, the process of obtaining the target task from the waiting queue using a preset random algorithm includes: Calculating the task probability values of the target tasks corresponding to different task numbers in each task round; wherein the task probability value is negatively correlated with the task round number and the task number, and the sum of the task probability values of all target tasks in each task round is 1; Determine a probability distribution interval corresponding to each target task based on the task probability value; Generate a target random number and determine the target probability distribution interval in which the target random number lies to obtain a target task corresponding to the target probability distribution interval.

17. A server scheduling device, characterized in that: Applied to the target host, including: a layer selection module, configured to, upon acquiring a target task, select a target server layer from a server tree based on a first fill factor; wherein the server tree is a tree structure having the target host as a root node and servers in a preset server cluster as child nodes; the server tree includes a plurality of server layers, each of which includes at least one server cluster, and each of which includes at least one server; a cluster selection module, configured to select a target server cluster from the target server layer based on a second fill factor; A server selection module, configured to select a target server from the target server cluster based on a third fill factor; A task allocation module, configured to allocate the target task to the target server for processing; The first fill factor is calculated based on a first maximum number of tasks that each server layer can process and a first number of tasks being processed; the second fill factor is calculated based on a second maximum number of tasks that each server cluster can process and a second number of tasks being processed; and the third fill factor is calculated based on a third maximum number of tasks that each server can process and a third number of tasks being processed. Among them, the server scheduling device is also used to build a server tree based on a preset server cluster, specifically to use the target host as the root node of the server tree; the root node is the first server layer; a target number of servers are obtained from the preset server cluster as child nodes and connected to the root node to obtain a new server layer; the new server layer is used as the current server layer, and for each server in the current server layer, a target number of servers are obtained from the unselected servers in the preset server cluster as child nodes and connected to each server to obtain a new server layer; the step of using the new server layer as the current server layer is repeated until all servers in the preset server cluster have been selected as the child nodes to obtain a server tree including multiple server layers; wherein the target number of servers connected to each target node in the server tree constitute a server cluster, and the target node is the root node or any of the child nodes.

18. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the server scheduling method according to any one of claims 1 to 16.

19. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the server scheduling method according to any one of claims 1 to 16 are implemented.

20. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the server scheduling method according to any one of claims 1 to 16 are implemented.

Citation Information

Patent Citations

  • Multi-user task scheduling method and device for calculation cluster

    CN107291545A

  • Task set scheduling method and device, storage medium and electronic equipment

    CN119718579A