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

By building a server tree and dynamically selecting the target server using three-level fill factors, the problems of low resource utilization and unbalanced load in the server cluster are solved, and load balancing and resource optimization are achieved.

CN120371542AActive Publication Date: 2025-07-25SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the existing server scheduling methods, resource utilization is low and load is unbalanced, resulting in system performance degradation.

Method used

Build a server tree structure, dynamically select the target server layer, cluster and single server through three-level fill factor, calculate the fill factor based on the maximum number of tasks and the current number of tasks of each layer, cluster and server, and realize load balancing allocation.

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371542A_ABST
    Figure CN120371542A_ABST
Patent Text Reader

Abstract

The invention discloses a server scheduling method and device, equipment, a medium and a computer program product, relates to the technical field of computers, is applied to a target host, and comprises the following steps: when a target task is obtained, 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 the second fill factor, and selecting a target server from the target server cluster based on the third fill factor; distributing the target task to a target server for processing; the first filling factor is calculated based on a first maximum task number which can be processed by each server layer and a first task number which is being processed; the second filling factor is calculated based on a second maximum task number which can be processed by each server cluster and a second task number which is being processed; the third filling factor is calculated based on a third maximum task number which can be processed by each server and a third task number which is being processed. According to the invention, load balancing among the servers can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In a dynamic environment of a distributed system, achieving optimal performance and responsiveness depends to a large extent on the effective utilization of computing resources. Algorithms for controlling server scheduling and synchronization are key factors for coordinating the smooth execution of activities in a distributed environment. Server scheduling is a process of determining the execution order of operations on servers. An efficient scheduling algorithm is crucial for optimizing resource usage, reducing latency, and improving the overall system responsiveness. At the same time, it is also crucial to reasonably allocate server loads in a distributed system to achieve workload balance. Unbalanced server allocation may lead to resource limitations, thereby reducing the performance of the entire system, and the balance of computing loads contributes to the overall stability of the system.

[0003] Existing server scheduling methods mainly include three types: the First Come First Served (FCFS) scheduling algorithm, the Shortest Job First (SJF) scheduling algorithm, and the Priority Scheduling (PS) algorithm. FCFS allocates resources in the order of process arrival. Although it is simple and fair, it may cause the "starvation" problem, making the waiting time of later short tasks long and resulting in a relatively long average waiting time. SJF selects the process with the shortest estimated running time to execute first. Ideally, it can achieve the minimum average waiting time. However, due to the inability to accurately predict the process execution time, it may cause "starvation" of long jobs. The PS method assigns priorities to each process, and the process with a higher priority is executed first, which can ensure the timely execution of high-priority tasks, but may have problems such as "priority inversion" and "starvation".

[0004] In summary, how to improve the resource utilization rate of server cluster tasks and achieve load balance among servers is a problem to be solved currently. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a server scheduling method, apparatus, device, medium, and computer program product, which can improve the resource utilization rate of server cluster tasks and achieve load balance among servers. The specific solutions are as follows: In a first aspect, the present application discloses a server scheduling method applied to a target host, including: When obtaining a target task, select a target server layer from a server tree based on a first filling factor; wherein, the server tree is a tree structure with a target host as the root node and each server in a preset server cluster as the 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; Select a target server cluster from the target server layer based on a second filling factor, and select a target server from the target server cluster based on a third filling factor; Allocate the target task 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 process 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 process 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 process and the third number of tasks being processed.

[0006] Optionally, the process of constructing a server tree based on a preset server cluster includes: Use the target host as the root node of the server tree; the root node is the first server layer; Obtain a 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; Use the new server layer as the current server layer, and for each server in the current server layer, obtain a target number of servers from the unselected servers in the preset server cluster as child nodes and connect them 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 child nodes, so as to obtain a server tree including multiple server layers; wherein, the target number of servers connected to each target node in the server tree constitutes a server cluster, and the target node is the root node or any child node.

[0007] Optionally, the server scheduling method of the present application further includes: In the current server layer, add a target number of servers obtained from the preset server cluster to each server in the order from left to right.

[0008] Optionally, in 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 server to obtain a new server layer, it further includes: If the number of unselected servers in the preset server cluster does not reach the target number, then construct the last server cluster of the current server tree based on the unselected servers in the preset server cluster.

[0009] Optionally, the server scheduling method of the present application further includes: When a new server appears in the preset server cluster, add the new server to the server tree based on the current structure of the server tree.

[0010] Optionally, 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, add the new 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, then determine whether the total number of servers in the current last server layer reaches the maximum number of servers corresponding to this layer; Add the new server to the server tree based on the judgment result.

[0011] Optionally, adding the new server to the server tree based on the judgment result includes: If the total number of servers in the current last server layer does not reach the maximum number of servers corresponding to this layer, add a new first server cluster in the current last server layer, and add the new server to the first server cluster; wherein, the parent node of the first server cluster is 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 this layer, add a new server layer to the server tree, and add a new second server cluster in the new server layer to add the new 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.

[0012] Optionally, selecting a target server layer from the server tree based on the first filling factor includes: Obtain the first filling factors corresponding to each server layer in the server tree, and construct a layer set based on the server layer corresponding to the minimum value among the first filling factors; If the number of server layers in the layer set is single, directly use the server layer in the layer set as the target server layer; If the number of server layers in the layer set is multiple, randomly select one server layer from the layer set as the target server layer.

[0013] Optionally, selecting a target server cluster from the target server layer based on the second filling factor includes: Obtain the second filling factor corresponding to each server cluster in the target server layer, and construct a cluster set based on the server cluster corresponding to the minimum value among the second filling factors; If the number of server clusters in the cluster set is single, directly use the server cluster in the cluster set as the target server cluster; If the number of server clusters in the cluster set is multiple, randomly select a server cluster from the cluster set as the target server cluster.

[0014] Optionally, selecting a target server from the target server cluster based on the third filling factor includes: Obtain the third filling factor corresponding to each server in the target server cluster, and construct a server set based on the server corresponding to the minimum value among the third filling factors; If the number of servers in the server set is single, directly use the server in the server set as the target server; If the number of servers in the server set is multiple, randomly select a server from the server set as the target server.

[0015] Optionally, the server scheduling method of this application further includes: Determine the first filling factor based on the ratio between the number of first tasks being processed and the maximum number of first tasks that can be processed by each server layer; Determine the second filling factor based on the ratio between the number of second tasks being processed and the maximum number of second tasks that can be processed by each server cluster; Determine the third filling factor based on the ratio between the number of third tasks being processed and the maximum number of third tasks that can be processed by each server.

[0016] Optionally, 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 are locally set on the target host; among them, the number of first task sets is multiple, each first task set is numbered in ascending order of the number of tasks, and the largest set number in the first task set is the maximum number of first tasks that the corresponding server layer can process; the number of second task sets is multiple, each second task set is numbered in ascending order of the number of tasks, and the largest set number in the second task set is the maximum number of second tasks that the corresponding server cluster can process; the number of third task sets is multiple, each third task set is numbered in ascending order of the number of tasks, and the largest set number in the third task set is the maximum number of third tasks that the corresponding server can process.

[0017] Optionally, each server layer is numbered in sequence according to the arrangement order from top to bottom in the server tree to obtain the 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 the 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 the corresponding server number.

[0018] Optionally, after allocating the target task to the target server for processing, it further includes: Determine the original third task set where the server number of the target server is located, increment the set number of the original third task set by one 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; wherein, the value of the set number of the original third task set is the same as 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, increment the set number of the original second task set by one 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; wherein, the value of the set number of the original second task set is the same as 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, increment the set number of the original first task set by one 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 the same as the number of tasks being processed by the target server layer before receiving the target task.

[0019] Optionally, the server scheduling method of the present application further 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 is currently located; Determine 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 is currently located; Determine 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 is currently located.

[0020] Optionally, after obtaining the target task, it further includes: If there is no idle server for executing the target task in the server tree currently, store the target task in a preset waiting queue; When there are completed tasks in the server tree, based on the number of completed tasks, a corresponding number of target tasks are obtained from the waiting queue using a preset random algorithm and assigned to the servers corresponding to the completed tasks for processing.

[0021] Optionally, the server scheduling method of the present application further includes: In the waiting queue, different task rounds are divided for each unexecuted target task based on the maximum number of target tasks that the server tree can process and the order of task acquisition, and each target task is sorted in each task round to obtain a task serial number. Correspondingly, the process of obtaining target tasks from the waiting queue using a preset random algorithm includes: Calculating the task probability values of the target tasks corresponding to different task serial numbers in each task round; wherein, the task probability value is negatively correlated with the task round and the task serial 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 where the target random number is located to obtain the target task corresponding to the target probability distribution interval.

[0022] In a second aspect, the present application discloses a server scheduling device, which is applied to a target host and includes: A layer selection module, configured to select a target server layer from the server tree based on a first filling factor when a target task is obtained; wherein, the server tree is a tree structure with the target host as the root node and each server in a 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. A cluster selection module, configured to select a target server cluster from the target server layer based on a second filling factor. A server selection module, configured to select a target server from the target server cluster based on a third filling factor. A task assignment module, configured to assign the target task 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 process 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 process 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 process and the third number of tasks being processed.

[0023] In a third aspect, the present application discloses an electronic device, including: A memory, configured to store a computer program. A processor for executing a computer program to implement the steps of the server scheduling method disclosed above.

[0024] 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 server scheduling method disclosed above are implemented.

[0025] In a fifth aspect, the present application discloses a computer program product including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the server scheduling method disclosed above are implemented.

[0026] It can be seen that when the target host in the present application obtains a target task, it selects a target server layer from the server tree based on a first filling factor; wherein, the server tree is a tree structure with the target host as the root node and each server in a 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; a target server cluster is selected from the target server layer based on a second filling factor, and a target server is selected from the target server cluster based on a third filling factor; the target task is allocated 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 process 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 process 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 process and the third number of tasks being processed.

[0027] Advantageous effects: In this application, 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, and the structure of the server tree is specifically disclosed. Among them, 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. Moreover, in this application, a first filling factor is calculated based on the first maximum number of tasks that each server layer can process and the first number of tasks being processed, a second filling factor is calculated based on the second maximum number of tasks that each server cluster can process and the second number of tasks being processed, and a third filling factor is calculated based on the third maximum number of tasks that each server can process 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, first, the target server layer is selected from the server tree according to the first filling factor representing the load of each server layer, then the target server cluster is selected from the target server layer according to the second filling factor representing the load of each server cluster, and finally, the target server is selected from the target server cluster according to the third filling factor representing the load of each server. That is to say, in this application, the server tree structure is hierarchically divided into three levels, and servers are scheduled according to the filling factor in the three-level structure, so as to achieve global balanced allocation of server cluster resources through hierarchical load perception, greatly improving the resource utilization rate of task processing in the server cluster and realizing load balancing among servers. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings according to the provided drawings without creative efforts.

[0029] Figure 1 It is a flowchart of a server scheduling method disclosed in the present application; Figure 2 It is a schematic structural diagram of a server tree disclosed in the present application; Figure 3 It is a schematic architectural diagram of a root node disclosed in the present application; Figure 4 It is a schematic diagram of a server node disclosed in the present application; Figure 5 It is a flowchart of a specific server scheduling method disclosed in the present application; Figure 6 It is a flowchart of the processing when the server tree is in a fully loaded state with tasks; Figure 7 A server scheduling flowchart disclosed in this application; Figure 8 A unit structure diagram of a waiting queue disclosed in this application; Figure 9 A schematic structural diagram of a server scheduling device disclosed in this application; Figure 10 A structural diagram of an electronic device disclosed in this application. Specific implementation manners

[0030] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0031] The existing server scheduling methods mainly include three types: the first-come-first-served scheduling algorithm (FCFS), the shortest job first scheduling algorithm (SJF), and the priority scheduling algorithm (PS). FCFS allocates resources in the order of process arrival. Although it is simple and fair, it may cause the "starvation" problem, making the waiting time of later short tasks long and resulting in a relatively long average waiting time. SJF selects the process with the shortest estimated running time to execute first. Ideally, it can achieve the minimum average waiting time. However, due to the inability to accurately predict the process execution time, it may cause long jobs to "starve". The PS method assigns priorities to each process, and the process with the higher priority is executed first, which can ensure that high-priority tasks are executed in a timely manner, but may also have problems such as "priority inversion" and "starvation".

[0032] For this reason, the embodiments of the present application disclose a server scheduling method, device, equipment, medium, and computer program product, which can improve the resource utilization rate of server cluster task processing and achieve load balancing among servers.

[0033] See Figure 1 As shown, the embodiments of the present application disclose a server scheduling method applied to a target host. The method includes: Step S11: When a target task is obtained, select a 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 a 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.

[0034] 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. The present application also specifically discloses the structure of the server tree. Among them, 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.

[0035] Moreover, the present 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 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 according to the first filling factor used to represent the load of each server layer.

[0036] It should be noted that the process of constructing the 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 the servers in the preset server cluster have been selected as child nodes to obtain a server tree including multiple server layers; where the target number of servers connected to each target node in the server tree constitutes a server cluster, and the target node is the root node or any child node.

[0037] That is, as Figure 2 shown, the present 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 taken as the root node of the server tree. Starting from the root node, each node is connected to a 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, and then it is stratified downward in turn. Each time a child node branch is passed, the node layer number increases by one layer. Figure 2The superscript in the upper right corner of the shown server node represents the layer number of the server. The individual servers in the server cluster are added to the tree structure through a tree-like structure until all the servers in the server cluster have been selected as child nodes and added to the server tree, thus obtaining a server tree including multiple server layers. Among them, the n servers connected under each node form a sub-unit under the layer, which is called a server cluster. That is, each node in each layer contains a server cluster composed of n servers in the next layer, and so on.

[0038] Furthermore, it should also be noted that the above method further includes: in the current server layer, a target number of servers obtained from the preset server cluster are added to each server in the order from left to right. 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 be added in the order from left to right.

[0039] Among them, in 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 server to obtain a new server layer, it further includes: if the number of unselected servers in the preset server cluster does not reach the target number, a server tree is constructed based on the unselected servers in the preset server cluster to obtain the last server cluster of the current server tree. That is, when the number of the last added servers is less than n, the servers with a number less than n form a cluster unit and serve as the last server cluster of the current server tree.

[0040] In addition, the above method further 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. It can be understood that when a new server node is added to improve the performance of the server cluster, the position where the new server is allocated in the server tree should also meet the above requirements, and specifically, the new server needs to be added to the server tree based on the current structure of the server tree.

[0041] In the specific implementation manner, 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 new 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, then judging whether the total number of servers in the current last server layer reaches the maximum number of servers corresponding to this layer; adding the new server to the server tree based on the judgment result.

[0042] That is, when the number of servers in the last server cluster of the last server layer of the entire server tree has not reached the target number, that is, has not reached n, the newly added server can be added to the last server cluster. When the number of servers in the last server cluster of the 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 this layer. It can be understood 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, so as to determine how to add the newly added server to the server tree according to the judgment result.

[0043] Specifically, adding the newly added server to the server tree based on the judgment result includes: if the total number of servers in the current last server layer has not reached the maximum number of servers corresponding to this layer, a new first server cluster is added in the current last server layer, and the newly added server is added to the first server cluster; wherein, the parent node of the first server cluster is located in the previous server layer of the current last server layer, and the parent node is the first server in the previous 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 this layer, a new server layer is added to the server tree, and a new second server cluster is added in 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.

[0044] It can be understood that in a specific implementation manner, if the total number of servers in the current last server layer has not reached the maximum number of servers corresponding to this layer, it means that there are still spare server nodes in the corresponding previous server layer that are not connected with child nodes. Therefore, a new first server cluster is added in the current last server layer, and the newly added server can be added to the first server cluster. Among them, the parent node of the first server cluster is located in the previous server layer of the current last server layer, and the parent node is the first server in the previous server layer that does not include child nodes.

[0045] In another specific embodiment, when the total number of servers in the current last server layer has reached the maximum number of servers corresponding to this layer, it indicates that all server nodes in the previous server layer are connected to the server cluster of this layer, and the server cluster of this layer is also fully filled. At this time, 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 servers to the second server cluster. Among them, the parent node of the second server cluster is the first server in the current last server layer. That is, starting from the leftmost server node in the current last server layer, a cluster is added to the next layer. Further, as server nodes are added to this cluster and the number of servers in this cluster reaches n, new clusters are sequentially opened from left to right for the server nodes in the upper layer.

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

[0047] 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.

[0048] In this embodiment, after obtaining the target server layer, a target server cluster is selected from the target server layer according to the second filling factor representing the load of each server cluster, and finally a target server is selected from the target server cluster according to the third filling factor representing the load of each server.

[0049] That is, the present application hierarchically divides the server tree structure into three levels, and schedules servers according to the filling factor in the three levels, so as to achieve global balanced allocation of server cluster resources through hierarchical load perception, greatly improving the resource utilization rate of task processing in the server cluster and realizing load balancing among servers.

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

[0051] In this embodiment, the obtained target task is allocated to the selected target server for processing.

[0052] It can be seen that in this application, a server tree is constructed with the target host as the root node and each server in the preset server cluster as the child nodes, and the structure of the server tree is specifically disclosed. Among them, 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. Moreover, in this application, a first filling factor is calculated based on the first maximum number of tasks that each server layer can process and the first number of tasks being processed, a second filling factor is calculated based on the second maximum number of tasks that each server cluster can process and the second number of tasks being processed, and a third filling factor is calculated based on the third maximum number of tasks that each server can process 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, first, the target server layer is selected from the server tree according to the first filling factor used to represent the load of each server layer, then the target server cluster is selected from the target server layer according to 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 according to the third filling factor used to represent the load of each server. That is to say, in this application, the server tree structure is hierarchically divided into three levels, and servers are scheduled according to the filling factor in the three-level structure, so as to achieve global balanced allocation of server cluster resources through hierarchical load perception, greatly improving the resource utilization rate of task processing in the server cluster and realizing load balancing among servers.

[0053] See Figure 5 As shown, this embodiment of the application discloses a specific server scheduling method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes: Step S21: When the target task is obtained, select the target server layer 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 the 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; the first filling factor is calculated based on the first maximum number of tasks that each server layer can process and the first number of tasks being processed.

[0054] 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, each of which 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 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.

[0055] Among them, each server layer is numbered in sequence from top to bottom in the server tree to obtain the corresponding layer number, each server cluster is numbered in sequence from left to right in the corresponding server layer to obtain the corresponding cluster number, and each server is numbered in sequence 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 side of the lower right bracket represents the current cluster number, and the number on the right side represents the cluster server number of the server in the current cluster.

[0056] That is, in the memory of the target host, three types of sets are set, namely the first task set, the second task set and the third task set, and 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 in sequence. When the server tree is not in use, the layer number, cluster number and server number in all server node codes are placed in 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 in the second task set with a task number of 0. Similarly, the server number in each cluster is also allocated in 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_maxAmong them, it should be noted that when increasing the processing performance of the server tree by adding server nodes to the server tree, the maximum set number M of the set to which the layer number, cluster number, and server number belong d_max , M d_c_max and M d_c_n_max will also be updated accordingly according to the tree position of the added server node.

[0057] Among 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 within the cluster; M d_max represents the maximum number of tasks that the server layer with layer number d can handle, and M d_c_max represents the maximum number of tasks that the 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 within the cluster. Then M d_c_n_max is the maximum number of tasks that a single server can handle.

[0058] For example, when the completely empty server tree receives the target task sent by the client, first a layer number is randomly generated by the target host, then a cluster number is randomly generated within the layer number, and a server number is randomly generated within the cluster, and they are assigned 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 the task number 1 respectively. And so on, when the server within the same layer and the same cluster is assigned a task, the number of tasks of the server within the cluster is incremented by one, which will cause the number of tasks in the same cluster to increase by one, and extend to the number of tasks of the servers in the same layer to increase by one. The corresponding layer number, cluster number, and server number within the cluster are then added to the task set with the corresponding task number. As the task assignment in the server tree increases, the specific server assigned the task will cause the current layer number attribution to the first task set with a higher task number, and at the same time, the current cluster number will also be added to the second any set with a higher task number under the current layer. When the server tree processes tasks up to the maximum value M max , the layer number, cluster number, and server number within the cluster of each layer will also belong to the task sets of the layer, cluster, and server task maximum values M d_max , M d_c_max and M d_c_n_max .

[0059] Meanwhile, when the server of the relevant node returns the message of task completion to the target host, the target host will return the message to the corresponding task request client, and kick out the layer number, cluster number, and in-cluster server number to which the corresponding node belongs from the currently affiliated task set and belong to the task set with the number of tasks in the layer, cluster, and server reduced by one. The set always maintains the recursive relationship of the layer number, cluster number, and in-cluster server number. For example, when a certain server completes task processing and returns the result to the target host, the layer number of the layer where the server is located, the cluster number of the cluster where it is located, and the server number will be removed from the corresponding original task set and successively belong to the task set with the number of tasks reduced by 1.

[0060] Further, the above method further includes: determining the first number of 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 is currently located; determining the second number of 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 is currently located; determining the third number of 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 is currently located. It can be understood that from the foregoing content, as the number of tasks processed by a single server changes, the task sets to which its corresponding server number, the cluster number of the cluster where it is located, and the layer number of the layer where it is located currently belong will all change accordingly. Therefore, the first number of tasks M currently being processed by each server layer can be determined based on the set number corresponding to the first task set where the layer number of each server layer is currently located. d Similarly, the second number of tasks M currently being processed by each server cluster can be determined based on the set number corresponding to the second task set where the cluster number of each server cluster is currently located. d_c Based on the set number corresponding to the third task set where the server number of each server is currently located, the third number of tasks M currently being processed by each server can be determined. d_c_n .

[0061] Specifically, the above method further includes: determining the 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 the 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; determining the 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.

[0062] That is, in the memory of the target host, corresponding filling factors will be established for each layer, each cluster, and each server, namely the first filling factor f d , the second filling factor f d_c and the third filling factor f d_c_n . Their calculation methods are as follows: ; ; ; As can be seen from the above calculation method, the fill factor f d , f d_c and f d_c_n have a value range of [0, 1].

[0063] In a specific implementation manner, selecting a target server layer from a server tree based on a first fill factor includes: obtaining first fill factors corresponding to each server layer in the server tree, and constructing a layer set based on the server layer corresponding to the minimum value among the first fill 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 the number of server layers in the layer set is multiple, randomly selecting a server layer from the layer set as the target server layer.

[0064] That is, each server layer will obtain a corresponding first fill factor according to the above calculation formula. This application needs to determine the minimum value among the first fill factors and construct a layer set based on the server layer corresponding to the minimum value, and then further select a target server layer from this layer set. Among them, 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, and if the number of server layers in the layer set is multiple, randomly selecting a server layer from the layer set as the target server layer. It can be understood that layers with the same fill factor belong to the same set of the same category in the memory of the target host and are dynamically adjusted according to the assignment and completion of tasks.

[0065] Step S22: 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; the second fill factor is calculated based on the second maximum number of tasks that each server cluster can process and the second task being processed; the third fill factor is calculated based on the third maximum number of tasks that each server can process and the third task being processed.

[0066] In the specific implementation manner, selecting a target server cluster from the target server layer based on the second filling factor includes: obtaining the second filling factors corresponding to the server clusters in the target server layer, and constructing a cluster set based on the server cluster corresponding to the minimum value among 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 the number of server clusters in the cluster set is multiple, randomly selecting a server cluster from the cluster set as the target server cluster. That is, each server cluster will obtain the corresponding second filling factor according to the above calculation formula. This application needs to determine the minimum value among the second filling factors and construct a cluster set based on the server cluster corresponding to the minimum value, and further select a target server cluster from the cluster set. Among them, 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, and if the number of server clusters in the cluster set is multiple, randomly selecting a server cluster from the cluster set as the target server cluster. It can be understood that clusters with the same filling factor belong to the same set of the corresponding category in the memory of the target host and are dynamically adjusted according to the allocation and completion of tasks.

[0067] Similarly, selecting a target server from the target server cluster based on the third filling factor includes: obtaining the third filling factors corresponding to the servers in the target server cluster, and constructing a server set based on the server corresponding to the minimum value among the third filling factors; if the number of servers in the server set is single, directly using the server in the server set as the target server; if the number of servers in the server set is multiple, randomly selecting 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 among the third filling factors and construct a server set based on the server corresponding to the minimum value, and further select a target server from the server set. Among them, if the number of servers in the server set is single, directly using the server in the server set as the target server, and if the number of servers in the server set is multiple, randomly selecting a server from the server set as the target server.

[0068] That is, when the server tree structure receives a new target task, it first performs task allocation according to the first filling factor, and preferentially allocates the task to the layer set with the smallest first filling factor, and selects a layer number from the layer set with the smallest filling factor as the task allocation layer through a random algorithm. In the task allocation layer, select the cluster set with the smallest second filling factor, and randomly select a task allocation cluster for task allocation. In the task allocation cluster, select the server set with the smallest third filling factor, and randomly select a server from the server set for task allocation. It can be seen that the present application hierarchically divides the server tree structure into three levels according to the filling factor, recursively includes the server layer, clusters, and the server numbers within the clusters, then performs combined classification according to the filling factor in the three-level structure, dynamically adjusts the set according to 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 rate of each node in the entire server cluster.

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

[0070] Step S24: Determine the original third task set where the server number of the target server is located, increment the set number of the original third task set by one 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.

[0071] In this embodiment, after allocating the target task to the target server for processing, it is necessary to update the task set to which the server number of the target server belongs. Specifically, first determine the original third task set where the server number of the target server is located, and the value of the set number of the original third task set is the same as the number of tasks being processed by the target server before receiving the target task. Then increment the set number of the original third task set by one 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.

[0072] Step S25: 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 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.

[0073] In this embodiment, after allocating the target task to the target server for processing, it is necessary to update the task set to which the cluster number of the cluster where the target server is located belongs. Specifically, first determine the original second task set where the cluster number of the target server cluster is located. The value of the set number of the original second task set is the same as the number of tasks being processed by the target server cluster before receiving the target task. Then, perform an increment operation on 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.

[0074] Step S26: Determine the original first task set where the layer number of the target server layer is located, perform an increment operation on 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.

[0075] In this embodiment, after allocating the target task to the target server for processing, it is necessary to update the task set to which the layer number of the layer where the target server is located belongs. Specifically, first determine the original first task set where the layer number of the target server layer is located. The value of the set number of the original first task set is the same as the number of tasks being processed by the target server layer before receiving the target task. Then, perform an increment operation on 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.

[0076] Among them, for a more specific processing procedure of the above step S23, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be elaborated here.

[0077] It can be seen that this application hierarchically divides the server tree structure into three levels according to the fill factor, recursively includes the server layer, cluster, and server number within the cluster, then combines and classifies them according to the fill factor in the three-level structure, dynamically adjusts the set according to the allocation and completion of tasks, and randomly allocates tasks to the layer set, cluster set, and server set with the smallest fill factor, thereby greatly improving the resource utilization rate 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 task sets to which the corresponding server number, the cluster number of the cluster where it is located, and the layer number of the layer where it is located belong will all change accordingly.

[0078] Further, refer toFigure 6 and Figure 7 As shown in and , based on the foregoing embodiments, after obtaining the target task, the method of the present application further includes: Step S31: If there is no idle server in the server tree for executing the target task currently, store the target task in a preset waiting queue.

[0079] In this embodiment, when the server tree is full of tasks, that is, there is no idle server in the server tree for executing the target task currently, the target task is first stored in a 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 FIG. is the unit structure diagram of the waiting queue, which is mainly composed of a task memory and an arithmetic unit.

[0080] Step S32: When there are completed tasks in the server tree, based on the number of completed tasks, use a preset random algorithm 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.

[0081] In this embodiment, when there are completed tasks in the server tree, nodes with a filling factor not equal to 1 will be generated. Here, the processor then uses a preset random algorithm to obtain a corresponding number of target tasks from the waiting queue based on the number of completed tasks and allocate them to the servers corresponding to the completed tasks for processing. That is, the processor obtains the same number of target tasks as the completed tasks from the waiting queue through a preset random algorithm and allocates them to the corresponding servers for processing.

[0082] In the specific implementation manner, the above method further includes: dividing the unexecuted target tasks in the waiting queue into different task rounds based on the maximum number of target tasks that the server tree can process and the task acquisition order, and sorting the target tasks in each task round to obtain task numbers. It can be understood that there is a memory in the waiting queue. Denote the maximum number of target tasks that all servers in the server tree can process as M max , when the elements in the waiting queue have reached M max , a new round of allocation will be performed on the newly acquired tasks. Taking 1 to M max as one 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 number of the task in this round. Specifically, the mark is , where m represents the task requirement obtained, i represents the task round number, and j represents the task number of the task in the corresponding task round.

[0083] When a task enters the waiting queue, the task will be marked according to the above method. Each task that needs to wait will be marked once and added to the memory. When obtaining the corresponding task from the waiting queue in different rounds, the waiting tasks in the corresponding round will be reordered from 1 to the end of the current round's set in the previous order. For example, when the tasks in the i-th round are full and the task is sent to the server tree for task processing, the number of tasks in the i-th round will be reduced by one, and the total number of tasks will become M max -1. At this time, for the waiting tasks in the i-th round, the subscripts after will be reduced by one, and the number of tasks at the end of the queue will change from to . At this time, will become the new . And so on. Whenever a task element in a different set is completed, the sequence numbers of the elements in this set after this task element will be reduced by one in turn until all task elements in this round's set are completed. When all tasks in this round are completely completed, the number of rounds after this round will be reduced by one, that is, the (i + 1)-th round will be updated to the i-th round until all task elements in all round sets are completed and the number of tasks stored in the memory of the waiting queue is 0.

[0084] Correspondingly, the process of obtaining the target task from the waiting queue using the preset random algorithm includes: calculating the task probability value of the target task corresponding to different task sequence numbers in each task round; wherein, the task probability value is negatively correlated with the task round and the task sequence 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 where the target random number is located to obtain the target task corresponding to the target probability distribution interval.

[0085] It can be understood that in order to implement obtaining the target task from the waiting queue using the preset random algorithm in this application, first, it is necessary to calculate the task probability value of the target task corresponding to different task sequence numbers in each task round. The specific calculation formula used is as follows: ; In the above formula, is the number of tasks at the end of the i-th round, and this value is dynamically updated according to the tasks added to the latest server tree; is the total number of task rounds included in the waiting task queue, and this value is dynamically updated according to the task rounds completed in the waiting queue. The value of l ranges from 1 to , is the task probability value for the j-th task 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, for the task queue waiting for a larger number of rounds, the larger the denominator for probability dilution. Therefore, the selection probability for smaller rounds can be increased by increasing the value of a; is the number of tasks at the end of the l-th round, and the value of k ranges from 1 to .

[0086] It can be seen from the formula that the larger the task round number and the larger the task serial number, the smaller the corresponding task probability value.

[0087] In addition, the probability for each layer is : ; And, by adding up the probability values of all tasks in the waiting queue from the first round to the last round, we get: ; The probability distribution interval for each round is , , The probability distribution of is 0. By generating a target random number b from the interval (0, 1], the task round number i assigned to the server tree is determined by the interval where this number is located. The tasks in the waiting sequence for each round are filled in order. The probability distribution interval for tasks with different task serial numbers in each round is , , and 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.

[0088] In this application, probability distribution intervals are assigned to different layers through a random algorithm. Among them, the round number factor is added to the task probability, where l is the current task round number. The smaller the task round number, the greater the probability of task execution.

[0089] Suppose there are two rounds in the current waiting queue, the probability dilution factor a is selected as 2, there are 4 tasks in the first-round waiting messages, and 5 tasks in the second-round waiting messages. Then , , , .

[0090] Specifically: ; ; And so on.

[0091] Finally, the obtained probabilities are as follows: , , , ; , , , , .

[0092] It can be seen that when the server tree tasks are all full, that is, when there is no idle server in the server tree for executing the target task, the target task will be stored in a preset waiting queue first. By dynamically and randomly allocating the waiting task sequence in this application, the fairness of the server cluster in processing the waiting message queue can be effectively improved, so that tasks with smaller task rounds and smaller task numbers have a greater probability of being selected. It can effectively avoid the infinite blocking problem that occurs during the process of allocating server computing resources for tasks and effectively balance the average waiting time of tasks.

[0093] See Figure 9 As shown in Layer selection module 11, configured to select a target server layer from the server tree based on a first filling factor when obtaining a target task; wherein, the server tree is a tree structure with the target host as the root node and each server in a preset server cluster as the 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; the first filling factor is calculated based on the first maximum number of tasks that each server layer can process and the first number of tasks being processed.

[0094] Cluster selection module 12, 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 the second maximum number of tasks that each server cluster can process and the second number of tasks being processed.

[0095] Server selection module 13, 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 the third maximum number of tasks that each server can process and the third number of tasks being processed.

[0096] Task allocation module 14, configured to allocate the target task to the target server for processing.

[0097] It can be seen that in this application, a server tree is constructed with the target host as the root node and each server in the preset server cluster as the child nodes, and the structure of the server tree is specifically disclosed. Among them, 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. Moreover, in this application, the first filling factor is calculated based on the first maximum number of tasks that each server layer can process 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 process and the second number of tasks being processed, and the third filling factor is calculated based on the third maximum number of tasks that each server can process 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, first, the target server layer is selected from the server tree according to the first filling factor representing the load of each server layer, then the target server cluster is selected from the target server layer according to the second filling factor representing the load of each server cluster, and finally the target server is selected from the target server cluster according to the third filling factor representing the load of each server. That is to say, in this application, the server tree structure is hierarchically divided into three levels, and the servers are scheduled according to the filling factor in the three-level structure, so as to achieve the global balanced allocation of the server cluster resources through hierarchical load perception, greatly improving the resource utilization rate of task processing in the server cluster and realizing the load balance among the servers.

[0098] Since the embodiments of the device part correspond to the above-mentioned embodiments, the embodiments of the device part are described with reference to the embodiments of the above-mentioned method part and will not be elaborated here.

[0099] Figure 10 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. Specifically, it 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. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the server scheduling method executed by the electronic device disclosed in any of the foregoing embodiments.

[0100] In this embodiment, the power supply 23 is used to provide working 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 external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of this application, and no specific limitation is imposed here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application requirements, and no specific limitation is made here.

[0101] 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 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for the rendering and drawing of the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

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

[0103] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20 to enable the processor 21 to perform operations and processing on the massive data 223 in the memory 22. It may be Windows, Unix, Linux, etc. In addition to the computer program that can be used to complete the server scheduling method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program that can be used to complete other specific tasks. The data 223 may include not only the data transmitted by external devices received by the electronic device but also the data collected by its own input / output interface 25, etc.

[0104] Furthermore, the embodiments of the present application also disclose a computer-readable storage medium. When the computer program stored in the storage medium is loaded and executed by the processor, the steps of the server scheduling method disclosed in any of the foregoing embodiments are implemented.

[0105] An embodiment of the present invention also discloses a computer program product, including computer programs / instructions, which, when executed by a processor, implement the steps of the server scheduling method disclosed in any of the foregoing embodiments.

[0106] The embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part.

[0107] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

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

[0109] Finally, it should also be noted that in this article, relational terms such as first and second are only used 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 term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the said element.

[0110] The server scheduling method, device, equipment, medium and computer program product provided by the present invention have been introduced in detail above. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A server scheduling method, characterized in that, Applied to a target host, including: When a target task is obtained, select a target server layer from a server tree based on a first filling factor; wherein, the server tree is a tree structure with the target host as the root node and each server in a preset server cluster as the 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; Select a target server cluster from the target server layer based on a second filling factor, and select a target server from the target server cluster based on a third filling factor; Allocate the target task 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 process 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 process 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 process and the third number of tasks being processed.

2. The server scheduling method according to claim 1, wherein The process of constructing a server tree based on a preset server cluster includes: Use the target host as the root node of the server tree; the root node is the first server layer; Obtain a 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; Use the new server layer as the current server layer, and for each server in the current server layer, obtain a target number of servers from the unselected servers in the preset server cluster as child nodes and connect them 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, the target number of servers connected to each target node in the server tree constitutes a server cluster, and the target node is the root node or any one of the child nodes.

3. The server scheduling method according to claim 2, wherein It also includes: 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.

4. The server scheduling method according to claim 2, wherein In 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 server to obtain a new server layer, it also includes: If the number of unselected servers in the preset server cluster does not reach the target number, construct the last server cluster of the current server tree based on the unselected servers in the preset server cluster.

5. The server scheduling method according to claim 3, wherein It also includes: When a new server appears in the preset server cluster, add the new server to the server tree based on the current structure of the server tree.

6. The server scheduling method according to claim 5, wherein 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, add 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, then determine whether the total number of servers in the current last server layer reaches the maximum number of servers corresponding to this layer; Add the newly added server to the server tree based on the judgment result.

7. The server scheduling method according to claim 6, wherein The adding the newly added server to the server tree based on the judgment result includes: If the total number of servers in the current last server layer does not reach the maximum number of servers corresponding to this layer, 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 in the previous server layer of the current last server layer, and the parent node is the first server in the previous 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 this layer, add a new server layer to the server tree, and add a new second server cluster in 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.

8. The server scheduling method according to claim 1, wherein The selecting a target server layer from the server tree based on the first filling factor includes: Obtain the first filling factors corresponding to each server layer in the server tree, and construct a layer set based on the server layer corresponding to the minimum value among the first filling factors; If the number of server layers in the layer set is single, directly use the server layer in the layer set as the target server layer; If the number of server layers in the layer set is multiple, randomly select a server layer from the layer set as the target server layer.

9. The server scheduling method according to claim 1, wherein The selecting a target server cluster from the target server layer based on the second filling factor includes: Obtain the second filling factors corresponding to each server cluster in the target server layer, and construct a cluster set based on the server cluster corresponding to the minimum value among the second filling factors; If the number of server clusters in the cluster set is single, directly use the server cluster in the cluster set as the target server cluster; If the number of server clusters in the cluster set is multiple, randomly select a server cluster from the cluster set as the target server cluster.

10. The server scheduling method according to claim 1, wherein The selecting a target server from the target server cluster based on the third filling factor includes: Obtain the third filling factors corresponding to each server in the target server cluster, and construct a server set based on the server corresponding to the minimum value among the third filling factors; If the number of servers in the server set is single, directly use the server in the server set as the target server; If the number of servers in the server set is multiple, randomly select a server from the server set as the target server.

11. The server scheduling method according to claim 1, characterized in that It also includes: Determine the first filling factor based on the ratio between the number of first tasks being processed by each server layer and the maximum number of first tasks that can be processed; Determine the second filling factor based on the ratio between the number of second tasks being processed by each server cluster and the maximum number of second tasks that can be processed; Determine the third filling factor based on the ratio between the number of third tasks being processed by each server and the maximum number of third tasks that can be processed.

12. 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, the number of the first task sets is multiple, each of the first task sets is numbered in ascending order of the number of tasks, and the maximum set number in the first task set is the maximum number of first tasks that the corresponding server layer can process; the number of the second task sets is multiple, each of the second task sets is numbered in ascending order of the number of tasks, and the maximum set number in the second task set is the maximum number of second tasks that the corresponding server cluster can process; the number of the third task sets is multiple, each of the third task sets is numbered in ascending order of the number of tasks, and the maximum set number in the third task set is the maximum number of third tasks that the corresponding server can process.

13. The server scheduling method according to claim 12, wherein Each of the server layers is sequentially numbered according to the arrangement order from top to bottom in the server tree to obtain the corresponding layer number, each server cluster is sequentially numbered according to the arrangement order from left to right in the corresponding server layer to obtain the corresponding cluster number, and each server is sequentially numbered according to the arrangement order from left to right in the corresponding server cluster to obtain the corresponding server number.

14. The server scheduling method according to claim 13, wherein After allocating the target task to the target server for processing, it further includes: Determine the original third task set where the server number of the target server is located, perform an increment operation on the set number of the original third task set 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; Determine the original second task set where the cluster number of the target server cluster is located, perform an increment operation on the set number of the original second task set 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, increment the set number of the original first task set by one 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.

15. The server scheduling method according to claim 14, wherein It further 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 is currently located; Determine 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 is currently located; Determine 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 is currently located.

16. The server scheduling method according to any one of claims 1 to 15, characterized in that, After obtaining the target task, it further includes: If there is no idle server in the server tree for executing the target task, store the target task in a preset waiting queue; When there are completed tasks in the server tree, based on the number of completed tasks, use a preset random algorithm 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.

17. The server scheduling method according to claim 16, wherein It further includes: Divide the unexecuted target tasks in the waiting queue into different task rounds based on the maximum number of target tasks that the server tree can process and the task acquisition order, and sort the target tasks in each task round to obtain task serial numbers; Correspondingly, the process of obtaining target tasks from the waiting queue using a preset random algorithm includes: Calculate the task probability values of the target tasks corresponding to different task serial numbers in each task round; wherein, the task probability value is negatively correlated with the task round and the task serial number, and the sum of the task probability values of all target tasks in each task round is 1; Determine the 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 where the target random number is located to obtain the target task corresponding to the target probability distribution interval.

18. A server scheduling device, characterized in that, Applied to a target host, it includes: A layer selection module, configured to select a target server layer from the server tree based on a first filling factor when obtaining a target task; wherein, the server tree is a tree structure with the target host as the root node and each server in a preset server cluster as the sub-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; A cluster selection module, configured to select a target server cluster from the target server layer based on a second filling factor; A server selection module, configured to select a target server from the target server cluster based on a third filling factor. A task allocation module, configured to allocate the target task 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 process 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 process 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 process and the third number of tasks being processed.

19. An electronic device, characterized in that, Comprising: A memory, configured to store a computer program; 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 17.

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

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

Citation Information

Patent Citations

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

    CN107291545A

  • Server non-perception vector query method and system based on unstructured data set

    CN116501828A

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

    CN119718579A

  • Scheduling method and device for server cluster, equipment, storage medium and product

    CN119922192A

  • Method of assigning application to assigned service cluster and device

    WO2017148296A1