A resource scheduling method and device, and a computer readable storage medium
By improving the Sparrow Search optimization random forest algorithm and combining resource value, balance value and similarity value, the optimal scheduling node is determined, which solves the problems of low resource utilization and poor balance in Kubernetes clusters and achieves more efficient resource scheduling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-12-06
- Publication Date
- 2026-05-19
AI Technical Summary
Existing Kubernetes resource scheduling methods result in poor cluster balance and low resource utilization, failing to effectively utilize node resources.
An improved sparrow search optimization random forest algorithm is adopted. By obtaining information on the processes and nodes to be scheduled, the total resource value, total balance value and total similarity value are calculated. Combined with preset calculation criteria and vectorization processing, the optimal scheduling node is determined and resource binding scheduling is performed.
This improves the utilization rate of node resources and the balance of the cluster, ensuring the efficiency of node scheduling and the rational allocation of resources.
Smart Images

Figure CN116302373B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of resource scheduling, and more particularly to a resource scheduling method and apparatus, and a computer-readable storage medium. Background Technology
[0002] Kubernetes is an open-source automated container operation platform that provides functions such as application deployment, maintenance, and scaling mechanisms. As a container cluster management system, it can schedule node resources based on the current resource usage of the cluster. Existing resource scheduling methods can meet the requirements of efficient utilization of Kubernetes resources, reduce single points of failure and enhance high availability, and evenly distribute processes of different QoS levels to improve the platform's service quality. However, they suffer from poor cluster balance and low resource utilization. Summary of the Invention
[0003] This invention provides a resource scheduling method and apparatus, and a computer-readable storage medium, which can solve the problems of poor cluster balance and low resource utilization.
[0004] The technical solution of this invention is implemented as follows:
[0005] This invention provides a resource scheduling method, the method comprising:
[0006] Obtain the process to be scheduled and its corresponding information, as well as the queue of reserve nodes and its corresponding information; wherein, the information of the queue of reserve nodes includes information corresponding to each of the multiple nodes;
[0007] Based on the information of the processes to be scheduled and the information corresponding to each of the multiple nodes, the total resource value, total balance value and total similarity value are calculated according to the preset calculation criteria.
[0008] Based on the total resource value, the total balance value, and the total similarity value, the optimal scheduling node is obtained by performing calculations using a random forest algorithm optimized by sparrow search.
[0009] The process to be scheduled is bound to the optimal scheduling node to complete the scheduling.
[0010] In the above scheme, before obtaining the process to be scheduled and its corresponding information, and the queue of reserve nodes and its corresponding information, the method further includes:
[0011] Obtain the process to be scheduled and its corresponding information, as well as multiple nodes and their respective node information;
[0012] The multiple nodes are filtered and vectorized to obtain a queue of candidate nodes and their corresponding information.
[0013] In the above scheme, the step of filtering the multiple nodes and performing vectorization processing to obtain a queue of candidate nodes and corresponding candidate node queue information includes:
[0014] The multiple nodes are filtered using a pre-selection strategy to obtain a queue of available nodes and the corresponding information about the available node queue.
[0015] Compare and filter the information corresponding to any two nodes in the available node queue to obtain the initial reserve node queue and the corresponding initial reserve node queue information.
[0016] The initial preparation node queue and its information are vectorized to obtain the preparation node queue and its corresponding information.
[0017] In the above scheme, the calculation of the total resource value, total balance value, and total similarity value based on the information of the process to be scheduled and the information corresponding to each of the multiple nodes, according to a preset calculation criterion, includes:
[0018] Based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, the resource value of each node is calculated according to a preset resource calculation criterion, thereby obtaining the total resource value; wherein, the resource value of each node is the resource value of any one of the multiple nodes; the total resource value is the set of the resource values of the multiple nodes.
[0019] Based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, the total balance value is calculated using a preset balance calculation criterion.
[0020] Based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, the similarity value of the nodes is calculated by using a preset similarity calculation criterion, thereby obtaining the total similarity value; wherein, the similarity value of each node is the similarity value of any one of the multiple nodes; the total similarity value is the set of the similarity values of the multiple nodes.
[0021] In the above scheme, the information corresponding to each of the multiple nodes includes: the node's first processor resource information, first memory resource information, first network resource information, and first hard disk resource information; the information of the process to be scheduled includes: the process's second processor resource information, second memory resource information, second network resource information, and second hard disk resource information.
[0022] The process of calculating the resource value of a node based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, according to a preset resource calculation criterion, and thus obtaining the total resource value, includes:
[0023] Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, calculations are performed according to a preset first resource calculation criterion to obtain the first processor resource value, the first memory resource value, the first network resource value, and the first hard disk resource value, respectively.
[0024] Based on the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight are calculated according to a preset weight calculation criterion.
[0025] Based on the first processor resource value, the first memory resource value, the first network resource value, the first hard disk resource value, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight, the resource value of the node is calculated by means of a preset second resource calculation criterion, thereby obtaining the total resource value.
[0026] In the above scheme, the step of calculating the total balance value based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, using a preset balance calculation criterion, includes:
[0027] Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, the first standard deviation is calculated using the first standard deviation calculation criterion to obtain the first standard deviation.
[0028] Based on the first processor resource information, first memory resource information, first network resource information, first hard disk resource information, second processor resource information, second memory resource information, second network resource information, and second hard disk resource information, the second standard deviation is calculated using the second standard deviation calculation criterion to obtain the second standard deviation.
[0029] Based on the first standard deviation and the second standard deviation, the total balance value is obtained by performing a difference operation.
[0030] In the above scheme, before obtaining the optimal scheduling node by performing calculations using an improved random forest algorithm optimized for sparrow search based on the total resource value, the total balance value, and the total similarity value, the method further includes:
[0031] Obtain historical node scheduling records to determine training and test data;
[0032] The parameters of the random forest algorithm are initialized, and the optimal training parameters are determined by performing calculations using an improved sparrow search algorithm based on the training data and the test data.
[0033] Using the optimal training parameters as parameters for the random forest algorithm, the improved sparrow search optimized random forest algorithm is obtained.
[0034] In the above scheme, the initialization of the parameters of the random forest algorithm, based on the training data and the test data, is performed using an improved sparrow search algorithm to determine the optimal training parameters, including:
[0035] Based on the training data, the improved sparrow search algorithm is executed until the termination condition is met, the sparrow position is output, and the training parameters are obtained.
[0036] Based on the test data, the training parameters are verified using the improved sparrow search algorithm. If the verification result does not meet the expected requirements, the training data is used repeatedly for calculation until the training parameters meet the expected requirements, and the training parameters are then taken as the optimal training parameters.
[0037] In the above scheme, before executing the improved sparrow search algorithm based on the training data until the termination condition is met and the sparrow position is output, the method further includes:
[0038] The original parameters of the sparrow search algorithm are initialized by using chaotic mapping to obtain the initialized parameters;
[0039] Based on the initialized parameters, the fitness value of the sparrow is calculated by the sparrow search algorithm, and the local optimal position, the local worst position, the global optimal position and the corresponding fitness value of the sparrow, and the global worst position and the corresponding fitness value of the sparrow are determined.
[0040] Based on the global optimal position, the cosine adjustment formula, and the current discoverer position, the discoverer update formula is determined.
[0041] Based on the global optimal position, the global worst position, and the current follower position, determine the follower update formula;
[0042] Based on the global optimal position, the global worst position, and the current position of the early warning provider, the early warning provider update formula is determined;
[0043] The improved sparrow search algorithm is determined based on the discoverer update formula, the follower update formula, and the early warning update formula.
[0044] In the above scheme, after calculating the sparrow's fitness value based on the parameters and determining the local optimal position, local worst position, global optimal position and corresponding fitness value, and global worst position and corresponding fitness value, the method further includes:
[0045] The global optimal position is updated by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position, and a new global optimal position is obtained.
[0046] By comparing the fitness value of the current position with the fitness value corresponding to the global worst position, the global worst position is updated to obtain a new global worst position.
[0047] In the above scheme, the step of updating the global optimal position by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position to obtain a new global optimal position includes:
[0048] If the fitness value of the current position is greater than the fitness value corresponding to the global optimal position, the global optimal position is updated, and the new global optimal position is the local optimal position;
[0049] If the fitness value of the current position is less than the fitness value corresponding to the global optimal position, then the global optimal position is not updated.
[0050] In the above scheme, updating the global worst-case position by comparing the current position fitness value with the fitness value corresponding to the global worst-case position to obtain a new global worst-case position includes:
[0051] If the fitness value of the current position is less than the fitness value corresponding to the global worst position, update the global worst position, and the new global worst position is the local worst position;
[0052] If the fitness value of the current position is greater than the fitness value corresponding to the worst global position, then the worst global position is not updated.
[0053] In the above scheme, determining the discoverer update formula based on the global optimal position, the cosine adjustment formula, and the current sparrow position includes:
[0054] If the warning value is less than the preset safety value, the first position update formula for the discoverer is determined based on the current discoverer position, the cosine adjustment formula, and the global optimal position.
[0055] If the warning value is greater than the preset safety value, the second location update formula for the discoverer is determined by summing the random number and the current location of the discoverer.
[0056] The discoverer update formula is determined based on the first position update formula and the second position update formula of the discoverer.
[0057] In the above scheme, determining the follower update formula based on the global optimal position, the global worst position, and the current follower position includes:
[0058] If the current sparrow number is greater than half of the total number of sparrows, determine the update formula for the first position of the follower based on the worst global position and the current follower position.
[0059] If the current sparrow number is not greater than half of the total number of sparrows, determine the follower's second position update formula based on the current follower position and the global optimal position;
[0060] The follower update formula is determined based on the follower first position update formula and the follower second position update formula.
[0061] In the above scheme, the formula for updating the alerter based on the globally optimal position, the globally worst position, and the current alerter position includes:
[0062] If the fitness value of the current sparrow position during a single execution is not equal to the optimal fitness value during a single execution, the update formula for the first position of the early warning player is determined based on the current position of the early warning player and the global optimal position.
[0063] If the fitness value of the current sparrow position in a single execution is equal to the optimal fitness value in a single execution, the first position update formula for the early warning agent is determined based on the worst global position and the best global position.
[0064] Based on the first position update formula and the second position update formula of the early warning agent, the early warning agent update formula is determined.
[0065] In the above scheme, the step of obtaining the optimal scheduling node by performing calculations using an improved sparrow search optimization random forest algorithm based on the total resource value, the total balance value, and the total similarity value includes:
[0066] Based on the total resource value, the total balance value, and the total similarity value, a set of node resources is determined;
[0067] The set of node resources is input into the improved sparrow search optimization random forest algorithm to perform optimization calculations and obtain the optimal scheduling node.
[0068] This invention provides a resource scheduling device, characterized in that it includes an acquisition unit and a scheduling unit; wherein,
[0069] The acquisition unit is used to acquire the process to be scheduled and its corresponding information, and the queue of reserve nodes and its corresponding information; wherein, the queue of reserve nodes includes information corresponding to each of the multiple nodes; based on the information of the process to be scheduled and the information corresponding to each of the multiple nodes, a total resource value, a total balance value, and a total similarity value are calculated according to a preset calculation criterion; based on the total resource value, the total balance value, and the total similarity value, the optimal scheduling node is obtained by performing calculations using a random forest algorithm optimized by sparrow search;
[0070] The scheduling unit is used to bind the process to be scheduled to the optimal scheduling node to complete the scheduling.
[0071] This invention provides a resource scheduling device, characterized in that it includes:
[0072] Memory, used to store executable instructions;
[0073] A processor is configured to execute executable instructions stored in the memory, and when the executable instructions are executed, the processor executes the resource scheduling method.
[0074] This invention provides a computer-readable storage medium, characterized in that the storage medium stores executable instructions, and when the executable instructions are executed by one or more processors, the processors execute the resource scheduling method.
[0075] This invention provides a resource scheduling method and apparatus, and a computer-readable storage medium. The method includes: acquiring a process to be scheduled and its corresponding information, and a queue of pre-selected nodes and its corresponding pre-selected node queue information; wherein the pre-selected node queue information includes information corresponding to multiple nodes; calculating a total resource value, a total balance value, and a total similarity value based on the information of the process to be scheduled and the information corresponding to the multiple nodes, using a preset calculation criterion; calculating an optimal scheduling node based on the total resource value, the total balance value, and the total similarity value, using an improved sparrow search-optimized random forest algorithm; and binding the process to be scheduled to the optimal scheduling node to complete the scheduling. This solution utilizes the information of the process to be scheduled and the information corresponding to the multiple nodes to calculate the total resource value, the total balance value, and the total similarity, fully considering the impact of the process to be scheduled on node balance and the similarity between the process to be scheduled and the node to be bound. The improved random forest algorithm predicts the optimal scheduling node based on the acquired data, maintaining node balance while ensuring the efficiency of node scheduling and improving the utilization rate of node resources. Attached Figure Description
[0076] Figure 1This invention provides an optional flowchart of a resource scheduling method according to an embodiment of the present invention. Figure 1 ;
[0077] Figure 2 This invention provides an optional flowchart of a resource scheduling method according to an embodiment of the present invention. Figure 2 ;
[0078] Figure 3 An optional scheduling process block diagram is provided for an embodiment of the resource scheduling method of the present invention;
[0079] Figure 4 This invention provides an optional flowchart of a resource scheduling method according to an embodiment of the present invention. Figure 3 ;
[0080] Figure 5 This invention provides an optional flowchart of a resource scheduling method according to an embodiment of the present invention. Figure 4 ;
[0081] Figure 6 This invention provides an optional flowchart of a resource scheduling method according to an embodiment of the present invention. Figure 5 ;
[0082] Figure 7 This invention provides an optional flowchart of a resource scheduling method. Figure 6 ;
[0083] Figure 8 An optional flowchart of a resource scheduling method provided in an embodiment of the present invention. Figure 7 ;
[0084] Figure 9 An optional flowchart of a resource scheduling method provided in an embodiment of the present invention. Figure 8 ;
[0085] Figure 10 An optional flowchart of a resource scheduling method provided in this embodiment of the invention. Figure 9 ;
[0086] Figure 11 A schematic diagram of the structure of a resource scheduling device provided in this embodiment of the invention. Figure 1 ;
[0087] Figure 12 A schematic diagram of the structure of a resource scheduling device provided in this embodiment of the invention. Figure 2 . Detailed Implementation
[0088] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0089] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 1 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 1 , will combine Figure 1 The steps shown are explained.
[0090] In some embodiments of this invention, Kubernetes is an open-source automated container operation platform that provides functions such as application deployment, maintenance, and scaling mechanisms. As a container cluster management system, it can schedule node resources based on the current resource usage of the cluster.
[0091] S101. Obtain the process to be scheduled and its corresponding information, as well as the queue of prepared nodes and its corresponding information.
[0092] In some embodiments of the present invention, the terminal is a scheduler, which may be a Kubernetes scheduler. The embodiments of the present invention are not limited thereto. The preparatory node queue contains multiple candidate nodes.
[0093] In some embodiments of the present invention, the terminal can obtain the process to be scheduled and the corresponding information; obtain the pre-node queue and the information corresponding to the pre-node queue, wherein the pre-node queue information includes information corresponding to each of the multiple nodes.
[0094] S102. Based on the information of the process to be scheduled and the information corresponding to each of the multiple nodes, the total resource value, total balance value and total similarity value are calculated by using preset calculation criteria.
[0095] In some embodiments of the present invention, the preset calculation criteria include preset resource calculation criteria, preset balance calculation criteria, and preset similarity calculation criteria.
[0096] In some embodiments of the present invention, the terminal can calculate the total resource value, the total balance value, and the total similarity value by using preset calculation criteria to calculate the information of the process to be scheduled and the information corresponding to each of the multiple nodes.
[0097] In some embodiments of the present invention Figure 2 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 2Step S102 can be implemented by S1021-S1023, as follows:
[0098] S1021. Based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, the resource value of the nodes is calculated by using preset resource calculation criteria, thereby obtaining the total resource value.
[0099] In some embodiments of the present invention, the information corresponding to each of the multiple nodes includes: the node's first processor resource information, first memory resource information, first network resource information, and first hard disk resource information; the information of the process to be scheduled includes: the process's second processor resource information, second memory resource information, second network resource information, and second hard disk resource information.
[0100] In some embodiments of the present invention, the terminal can calculate the resource value of a node by using preset resource calculation criteria for the first processor resource information, first memory resource information, first network resource information, first hard disk resource information of a node, and the second processor resource information, second memory resource information, second network resource information, and second hard disk resource information of the process to be scheduled, thereby obtaining the total resource value of the preparatory node queue. The resource value of a node is the resource value of any one of the multiple nodes; the total resource value is a set of the resource values of the multiple nodes.
[0101] In some embodiments of the present invention, step S1021 can be implemented by S10211, S10212 and S10213, as follows:
[0102] S10211. Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, the first resource resource value, the first memory resource value, the first network resource value, and the first hard disk resource value are calculated according to the preset first resource calculation criteria.
[0103] In some embodiments of the present invention, the first processor resource information includes the total resources of the first processor and the resources currently used by the first processor; the first memory resource information includes the total resources of the first memory and the resources currently used by the first memory; the first network resource information includes the total resources of the first network and the resources currently used by the first network; and the first hard disk resource information includes the total resources of the first hard disk and the resources currently used by the first hard disk.
[0104] In some embodiments of the present invention, the terminal can calculate the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information by using a preset first resource calculation criterion to obtain the first processor resource value, the first memory resource value, the first network resource value, and the first hard disk resource value.
[0105] S10212. Based on the second processor resource information, second memory resource information, second network resource information, and second hard disk resource information, the second processor resource weight, second memory resource weight, second network resource weight, and second hard disk resource weight are calculated according to the preset weight calculation criteria.
[0106] In some embodiments of the present invention, the second processor resource information is the processor resources required by the process to be scheduled, the second memory resource information is the memory resources required by the process to be scheduled, the second network resource information is the network resources required by the process to be scheduled, and the second hard disk resource information is the hard disk resources required by the process to be scheduled.
[0107] In some embodiments of the present invention, the terminal can calculate the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information by using a preset weight calculation criterion to obtain the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight.
[0108] S10213. Based on the first processor resource value, the first memory resource value, the first network resource value, the first hard disk resource value, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight, the resource value of the node is calculated by means of a preset second resource calculation criterion, thereby obtaining the total resource value.
[0109] In some embodiments of the present invention, the terminal can calculate the resource value of the node by using a preset second resource calculation criterion, which includes the first processor resource value, the first memory resource value, the first network resource value, the first hard disk resource value, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight, thereby obtaining the total resource value.
[0110] For example, the total resource value of the preparatory node queue is S. total The resource value of node Ni in the pre-scheduled node queue relative to the process to be scheduled can be obtained by the following formula (1).
[0111]
[0112] in, Let w be the resource value of node Ni relative to the process to be scheduled. c w m w n and w d These are the second processor resource weights, the second memory resource weights, the second network resource weights, and the second hard disk resource weights, respectively. and These are the first processor resource value, first memory resource value, first network resource value, and first hard disk resource value of node Ni, respectively.
[0113] The above and It can be obtained through the following formula (2).
[0114]
[0115] in, and These represent the first processor resource value, first memory resource value, first network resource value, and first hard disk resource value of node Ni, respectively; capitalityCPU, capitalityMem, capitalityNetwork, and capitalityDisk represent the total first processor resource, total first memory resource, total first network resource, and total first hard disk resource of node Ni, respectively; used1, used2, used3, and used4 represent the currently used first processor resource, currently used first memory resource, currently used first network resource, and currently used first hard disk resource of node Ni, respectively.
[0116] w in the above c w m w n and w d It can be obtained through the following formula (3).
[0117]
[0118] Among them, w c w m w n and w d These are the second processor resource weights, second memory resource weights, second network resource weights, and second hard disk resource weights, respectively; capacityCPU P ,capicityMem P ,capicityNetwork P and CapacityDisk P These are the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information, respectively.
[0119] It is understood that, in some embodiments of the present invention, the terminal can calculate the resource value of a node by using the information corresponding to each of multiple nodes and the information of the process to be scheduled, and then calculate the total resource value by using a preset resource calculation criterion, thereby providing conditions for subsequent resource scheduling.
[0120] S1022. Based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, the total balance value is calculated by using a preset balance calculation criterion.
[0121] In some embodiments of the present invention, the terminal can calculate the total balance value by using preset balance calculation criteria to calculate the information corresponding to each of the multiple nodes and the information of the processes to be scheduled.
[0122] In some embodiments of the present invention, step S1022 can be implemented by S10221, S10222 and S10223, as follows:
[0123] S10221. Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, the first standard deviation is calculated using the first standard deviation calculation criterion to obtain the first standard deviation.
[0124] In some embodiments of the present invention, the terminal can calculate the first standard deviation by using the first standard deviation calculation criterion to calculate the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information.
[0125] S10222: Based on the first processor resource information, first memory resource information, first network resource information, first hard disk resource information, second processor resource information, second memory resource information, second network resource information, and second hard disk resource information, the second standard deviation is calculated using the second standard deviation calculation criterion to obtain the second standard deviation.
[0126] In some embodiments of the present invention, the terminal can calculate the second standard deviation by using the second standard deviation calculation criterion on the first processor resource information, the first memory resource information, the first network resource information, the first hard disk resource information, the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information.
[0127] S10223. Based on the first standard deviation and the second standard deviation, the total balance value is obtained by performing a difference operation.
[0128] In some embodiments of the present invention, the terminal can obtain the total balance value by performing a difference operation on the first standard deviation and the second standard deviation.
[0129] For example, the total balance value can be obtained by the following formula (4).
[0130] σ Q-H =(σ Q -σ H (4)
[0131] Where, σ Q-H This represents the overall balance value; σQ The first standard deviation, which is the standard deviation of the remaining resources in the candidate node queue, represents the cluster balance before scheduling; σ H The second standard deviation is calculated by deducting the resources P required by the processes to be scheduled from the nodes in the reserve node queue, and then calculating the standard deviation of the remaining resources in the cluster. This represents the cluster balance after scheduling.
[0132] σ in the above Q It can be obtained through the following formula (5).
[0133]
[0134] σ in the above H It can be obtained through the following formula (6).
[0135]
[0136] Where, N i A vector composed of its corresponding node resources σ Q The first standard deviation; It is an average vector composed of the resources of its corresponding nodes; σ H The second standard deviation; P is a vector consisting of its required resources (capacity CPU). P ,capicityMem P capitalityNetwork P capitalityDisk P ).
[0137] The above It can be obtained through the following formula (7).
[0138]
[0139] in, These are the average values of the first processor resource information, the average value of the first memory resource information, the average value of the first network resource information, and the average value of the first hard disk resource information, respectively.
[0140] It is understood that, in some embodiments of the present invention, the terminal can calculate the balance value of a node by using the information corresponding to each of multiple nodes and the information of the process to be scheduled, and thus obtain the total balance value, providing conditions for subsequent resource scheduling.
[0141] S1023. Based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, the similarity value of the nodes is calculated by using a preset similarity calculation criterion, thereby obtaining the total similarity value.
[0142] In some embodiments of the present invention, the terminal can calculate the similarity value of the nodes and the information of the process to be scheduled for each of the multiple nodes by using a preset similarity calculation criterion, thereby obtaining the total similarity value. The similarity value of a node is the similarity value of any one of the multiple nodes; the total similarity value is the set of the similarity values of the multiple nodes.
[0143] For example, N i The similarity value of nodes can be obtained by the following formula (8).
[0144]
[0145] Wherein, cosθ i For N i The similarity value of nodes; P is a vector consisting of their required resources (capacityCPU). P ,capicityMem P capitalityNetwork P capitalityDisk P );N i A vector composed of its corresponding node resources The total similarity value is cosθ=(cosθ1,cosθ2……,cosθ n The smaller the included angle, the higher the similarity, i.e., cosθ i The closer the similarity is to 1, the higher the similarity.
[0146] It is understood that, in some embodiments of the present invention, the terminal can use the information corresponding to each of multiple nodes and the information of the process to be scheduled to calculate the similarity value of the nodes through a preset similarity calculation criterion, thereby obtaining the total similarity value, and providing conditions for subsequent resource scheduling.
[0147] S103. Based on the total resource value, total balance value, and total similarity value, the optimal scheduling node is obtained by performing calculations using an improved random forest algorithm optimized by sparrow search.
[0148] In some embodiments of the present invention, the terminal inputs the total resource value, total balance value, and total similarity value as a new node vector into the improved sparrow search optimization random forest algorithm for calculation to obtain the optimal scheduling node.
[0149] In some embodiments of the present invention, step S103 can be implemented by S1031 and S1032, as follows:
[0150] S1031. Determine the node resource set based on the total resource value, total balance value, and total similarity value.
[0151] In some embodiments of the present invention, the terminal determines the node resource set by the total resource value, total balance value and total similarity value of the nodes in the preparatory node queue.
[0152] For example, X = (S n B n C n ), where X node resource set queue; S n Total resource value; B n C represents the overall balance value. n This represents the total similarity value.
[0153] S1032. Input the set of node resources into the improved sparrow search optimization random forest algorithm, perform optimization calculation, and obtain the optimal scheduling node.
[0154] In some embodiments of the present invention, the improved random forest algorithm for sparrow search optimization is obtained by first improving the sparrow search algorithm, then using the improved sparrow search algorithm to optimize the parameters of the random forest algorithm, and finally obtaining the improved random forest algorithm for sparrow search optimization.
[0155] In some embodiments of the present invention, the terminal inputs the set of node resources into the improved sparrow search optimization random forest algorithm to perform optimization calculations and obtain the optimal scheduling node.
[0156] It is understood that, in some embodiments of the present invention, the terminal determines the node resource set based on the total resource value, the total balance value, and the total similarity value; the node resource set is input into the improved sparrow search optimization random forest algorithm for calculation to obtain the optimal scheduling node, thereby improving the efficiency of resource scheduling.
[0157] S104. Bind the process to be scheduled to the optimal scheduling node to complete the scheduling.
[0158] In some embodiments of the present invention, the terminal binds the process to be scheduled to the optimal scheduling node to complete the scheduling.
[0159] For example, Figure 3 This is an optional scheduling process flowchart of a resource scheduling method provided by an embodiment of the present invention. The process to be scheduled and the queue of potential nodes are input into the scheduler. The scheduler calculates the optimal scheduling node, binds the process to be scheduled to the optimal scheduling node, and completes the scheduling.
[0160] It is understood that, in some embodiments of the present invention, the terminal can obtain the optimal scheduling node through the improved sparrow search optimization random forest algorithm, thereby realizing resource scheduling, maintaining node balance, and improving the utilization rate of node resources.
[0161] In some embodiments of the present invention Figure 4 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 3 Before step S101, steps S105 and S106 are also executed, as follows:
[0162] S105. Obtain the process to be scheduled and its corresponding information, as well as multiple nodes and their respective node information.
[0163] In some embodiments of the present invention, the terminal can obtain the process to be scheduled and its corresponding information, as well as multiple nodes and their respective node information.
[0164] S106. Filter multiple nodes and vectorize them to obtain the preparatory node queue and the corresponding preparatory node queue information.
[0165] In some embodiments of the present invention, the terminal can filter multiple nodes by comparing pre-selection strategies and node information, remove unusable nodes, and vectorize the node information of the remaining nodes to obtain a pre-selection node queue and corresponding pre-selection node queue information.
[0166] It is understood that, in some embodiments of the present invention, the terminal can filter and vectorize multiple nodes to obtain a queue of candidate nodes and the corresponding candidate node queue information, thereby improving the efficiency of node resources.
[0167] In some embodiments of the present invention, step S106 can be implemented by S1061, S1062 and S1063, as follows:
[0168] S1061. Multiple nodes are filtered through a pre-selection strategy to obtain the available node queue and the corresponding available node queue information.
[0169] In some embodiments of the present invention, the terminal filters multiple nodes through a pre-selection strategy, removes unusable nodes, and leaves usable nodes, thereby obtaining a queue of usable nodes and the corresponding usable node queue information.
[0170] S1062. Compare and filter the information corresponding to any two nodes in the available node queue to obtain the initial reserve node queue and the corresponding initial reserve node queue information.
[0171] In some embodiments of the present invention, the terminal compares the projections of each attribute corresponding to any pair of nodes in the available node queue, removes the poorer nodes, and obtains the initial reserve node queue and the corresponding initial reserve node queue information.
[0172] For example, the projections of each attribute between any two nodes in the available node queue are compared. If there exists a node A whose projection in any dimension is less than that of node B, then node A is removed from the available node queue, thereby obtaining the initial reserve node queue and the corresponding initial reserve node queue information.
[0173] S1063. Vectorize the initial preparatory node queue and its information to obtain the preparatory node queue and its corresponding information.
[0174] In some embodiments of the present invention, the terminal can perform vectorization processing on the initial preparation node queue and the initial preparation node queue information to obtain the preparation node queue and the corresponding preparation node queue information.
[0175] It is understood that, in some embodiments of the present invention, the terminal can filter individual nodes to obtain a queue of ready nodes and the corresponding ready node queue information, thereby reducing useless nodes and improving the efficiency of node resources.
[0176] In some embodiments of the present invention Figure 5 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 4 Before obtaining the optimal scheduling node, based on the total resource value, total balance value, and total similarity value, the Random Forest algorithm optimized by the improved Sparrow Search is executed, steps S201-S203 are performed as follows:
[0177] S201. Obtain historical node scheduling records to determine training and test data.
[0178] In some embodiments of the present invention, the terminal can obtain historical node scheduling records, use a portion of them as training data, and use the remainder as test data.
[0179] S202. Initialize the parameters of the random forest algorithm. Based on the training and test data, perform calculations using an improved sparrow search algorithm to determine the optimal training parameters.
[0180] In some embodiments of the present invention, the terminal initializes the parameters of the random forest algorithm, performs calculations on the training data using an improved sparrow search algorithm to obtain the sparrow positions, uses the sparrow positions as training parameters, verifies the training parameters using test data, and determines the optimal training parameters.
[0181] In some embodiments of the present invention, step S202 can be implemented by S2021 and S2022, as follows:
[0182] S2021. Based on the training data, execute the improved sparrow search algorithm until the termination condition is met, output the sparrow position, and obtain the training parameters.
[0183] In some embodiments of the present invention, the terminal can use training data to execute an improved sparrow search algorithm until a termination condition is met, output the sparrow's position, and obtain training parameters.
[0184] S2022. Based on the test data, the training parameters are verified using the improved sparrow search algorithm. If the verification results do not meet the expected requirements, the training data is reused for calculation until the training parameters meet the expected requirements. The training parameters are then used as the optimal training parameters.
[0185] In some embodiments of the present invention, the terminal verifies the training parameters using the test data through an improved sparrow search algorithm. If the verification result does not meet the expected requirements, the training parameters are taken as the optimal training parameters. If the verification result does not meet the expected requirements, the training data is used repeatedly for calculation until the training parameters meet the expected requirements, and the training parameters are taken as the optimal training parameters.
[0186] It is understood that, in some embodiments of the present invention, the terminal executes an improved sparrow search algorithm based on training data until a termination condition is reached, outputs the sparrow's position, and obtains training parameters; the training parameters are verified through test data to obtain the final optimal training parameters, providing conditions for subsequent resource scheduling.
[0187] S203. Using the optimal training parameters as parameters for the random forest algorithm, we obtain an improved random forest algorithm optimized for sparrow search.
[0188] In some embodiments of the present invention, the terminal uses the optimal training parameters as parameters for the random forest algorithm, thereby obtaining an improved random forest algorithm for sparrow search optimization.
[0189] It is understood that, in some embodiments of the present invention, the terminal can obtain historical node scheduling records as training data and test data; initialize the parameters of the random forest algorithm; and determine the optimal training parameters by performing calculations using an improved sparrow search algorithm based on the training data and test data; and use the optimal training parameters as the parameters of the random forest algorithm to obtain an improved sparrow search-optimized random forest algorithm, thus providing conditions for subsequently obtaining the optimal scheduling node.
[0190] In some embodiments of the present invention Figure 6 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 5 Based on the training data, the improved sparrow search algorithm is executed until the termination condition is met. Before outputting the sparrow's position, steps S301-S306 are executed as follows:
[0191] S301. Initialize the original parameters of the Sparrow Search algorithm through chaotic mapping to obtain the initialized parameters.
[0192] In some embodiments of the present invention, the terminal can initialize the parameters of the sparrow search algorithm through chaotic mapping, making the initial population distribution more random and avoiding the problem of the algorithm ending prematurely due to a too small search range.
[0193] For example, chaotic mapping is performed using the following formula (9).
[0194]
[0195] Among them, X t These are the initial values of various parameters, X t+1 It is the iteration value.
[0196] S302. Based on the initialized parameters, calculate the fitness value of the sparrow, and determine the local optimal position, local worst position, global optimal position and corresponding fitness value, and the global worst position and corresponding fitness value.
[0197] In some embodiments of the present invention, the terminal can calculate the fitness value of a sparrow using a sparrow search algorithm based on the initialized parameters, and determine the sparrow's local optimal position, local worst position, global optimal position and corresponding fitness value, and the sparrow's global worst position and corresponding fitness value.
[0198] S303. Based on the global optimal position, the cosine adjustment formula, and the current discoverer position, determine the discoverer update formula.
[0199] In some embodiments of the present invention, the terminal can determine the discoverer update formula by using the global optimal position, the cosine adjustment formula, and the current discoverer position.
[0200] In some embodiments of the present invention, step S303 can be implemented by S3031, S3032 and S3033, as follows:
[0201] S3031. If the warning value is less than the preset safety value, determine the first position update formula of the discoverer based on the current location of the discoverer, the cosine adjustment formula, and the global optimal position.
[0202] In some embodiments of the present invention, the warning value and the preset safety value are both set in advance.
[0203] In some embodiments of the present invention, the terminal can determine the first position update formula of the discoverer by judging the size of the warning value and the preset safety value. If the warning value is less than the preset safety value, the terminal can determine the first position update formula of the discoverer based on the current position of the discoverer, the cosine adjustment formula and the global optimal position.
[0204] S3032. If the warning value is greater than the preset safety value, perform a sum operation using a random number and the current discoverer's position to determine the discoverer's second position update formula.
[0205] In some embodiments of the present invention, the terminal can determine the discoverer's second position update formula by judging the magnitudes of the warning value and the preset safety value. If the warning value is greater than the preset safety value, perform a sum operation using a random number and the current discoverer's position.
[0206] S3033. Based on the discoverer's first position update formula and the discoverer's second position update formula, determine the discoverer's update formula.
[0207] In some embodiments of the present invention, the terminal can determine the discoverer's update formula through the discoverer's first position update formula and the discoverer's second position update formula.
[0208] Exemplarily, the discoverer's update formula can be obtained through the following formula (10).
[0209]
[0210] Where, t represents the iteration number, j represents the dimension of the parameter, i represents the i-th sparrow, MaxT represents the maximum iteration number. R2 represents the warning value, and its value range is [0, 1]. ST represents the safety value, and its value range is [0.5, 1]. Q is a random number obeying the normal distribution of [0, 1], g best is the global optimal position, is the current sparrow position. R2 < ST indicates that the area near the discoverer is safe. The discoverer will adaptively adjust and update the discoverer's position according to the iteration number, dynamically control the influence of the global optimal on the position update through the above cosine formula, prioritize global search in the early stage of iteration, and focus on local search in the later stage to achieve convergence faster. If it is not safe, the population needs to migrate to other safe areas.
[0211] It can be understood that in some embodiments of the present invention, the terminal can determine the discoverer's update formula through the global optimal position, the cosine adjustment formula, and the current discoverer's position, improving the accuracy of the sparrow search algorithm.
[0212] S304. Based on the global optimal position, the global worst position, and the current follower's position, determine the follower's update formula.
[0213] In some embodiments of the present invention, the terminal can determine the follower's update formula through the global optimal position, the global worst position, and the current follower's position.
[0214] In some embodiments of the present invention, step S304 can be implemented by S3041, S3042, and S3043, as follows:
[0215] S3041. If the current sparrow number is greater than half of the total number of sparrows, determine the first position of the follower and update the formula based on the worst position globally and the current follower position.
[0216] In some embodiments of the present invention, the terminal can compare the current sparrow number with half the total number of sparrows. If the current sparrow number is greater than half the total number of sparrows, the first position update formula of the follower is determined based on the global worst position and the current follower position.
[0217] S3042. If the current sparrow number is not greater than half of the total number of sparrows, determine the second position update formula of the follower based on the current follower position and the global optimal position.
[0218] In some embodiments of the present invention, the terminal can compare the current sparrow number with half the total number of sparrows. If the current sparrow number is not greater than half the total number of sparrows, the terminal can determine the follower's second position update formula based on the current follower position and the global optimal position.
[0219] S3043. Based on the follower's first position update formula and the follower's second position update formula, determine the follower update formula.
[0220] In some embodiments of the present invention, the terminal can determine the follower update formula by means of the follower first position update formula and the follower second position update formula.
[0221] For example, the follower update formula can be obtained by the following formula (11).
[0222]
[0223] Where t represents the number of iterations, j represents the dimension of the parameters, i represents the i-th sparrow, and A is a 1×d matrix, with each element randomly assigned a value of 1 or -1. + Represented as A T (AA T ) -1 g best For the globally optimal position, g worst This is the worst position globally. Let L be the current position of the sparrow, and L be a 1×d matrix, with each element of the matrix assigned a value of 1. Here, the global best and worst positions are used for calculation to update the follower's position, making the follower move away from the global worst position and closer to the global best position.
[0224] It is understood that, in some embodiments of the present invention, the terminal can determine the follower update formula by using the global optimal position, the global worst position, and the current follower position, thereby improving the accuracy of the sparrow search algorithm.
[0225] S305. Based on the global optimal position, the global worst position, and the current position of the early warning provider, determine the early warning provider update formula.
[0226] In some embodiments of the present invention, the terminal can determine the warning update formula by using the global optimal position, the global worst position, and the current warning position.
[0227] In some embodiments of the present invention, step S305 can be implemented by S3051, S3052 and S3053, as follows:
[0228] S3051. If the fitness value of the current position of the sparrow is not equal to the optimal fitness value during a single execution, determine the update formula for the first position of the early warning player based on the current position of the early warning player and the global optimal position.
[0229] In some embodiments of the present invention, the terminal can compare the current sparrow position fitness value and the optimal fitness value during a single execution process. If the current sparrow position fitness value is not equal to the optimal fitness value during a single execution process, the terminal can determine the first position update formula for the early warning player based on the current position of the early warning player and the global optimal position.
[0230] S3052. If the fitness value of the current position of the sparrow is equal to the optimal fitness value during a single execution, determine the update formula for the first position of the early warning player based on the worst global position and the best global position.
[0231] In some embodiments of the present invention, the terminal can compare the current sparrow position fitness value and the optimal fitness value during a single execution process. If the current sparrow position fitness value is equal to the optimal fitness value during a single execution process, the terminal can determine the first position update formula for the early warning agent based on the worst global position and the best global position.
[0232] S3053. Based on the update formula for the first position of the early warning agent and the update formula for the second position of the early warning agent, determine the update formula for the early warning agent.
[0233] In some embodiments of the present invention, the terminal can determine the warning update formula by using the warning first position update formula and the warning second position update formula.
[0234] For example, the early warning update formula can be obtained by the following formula (12).
[0235]
[0236] Where β is the pace adjustment coefficient, which is a random number that follows a normal distribution, has a mean of 0, and a variance of 1.best For the globally optimal position, g worst This is the worst position globally. τ represents the current position of the sparrow. i,t τ represents the fitness value of the current sparrow position during a single execution. best This represents the optimal fitness value during a single execution. At τ i,t ≠τ best That is, when a sparrow detects danger at the edge, it updates its position to one of the points between its current position and the midpoint of the global optimum, or the center point of the global optimum, to avoid being attacked and move closer to the global optimum, thus accelerating its convergence speed; at τ i,t =τ best That is, when a sparrow detects danger at the center point, it updates its position to a point between the sparrow's global optimal and global worst positions, causing the population to migrate, escape the local optimum, and start a global search again.
[0237] It is understood that, in some embodiments of the present invention, the terminal can determine the warning update formula by using the global optimal position, the global worst position, and the current warning position, thereby improving the accuracy of the sparrow search algorithm.
[0238] S306. Based on the discoverer update formula, follower update formula, and early warning update formula, determine the improved sparrow search algorithm.
[0239] In some embodiments of the present invention, the terminal can determine an improved sparrow search algorithm based on the discoverer update formula, the follower update formula, and the early warning update formula.
[0240] It is understood that, in some embodiments of the present invention, the terminal can improve the sparrow search algorithm by improving the discoverer update formula, follower update formula and early warning update formula in the sparrow search algorithm, thereby improving the accuracy of the sparrow search algorithm.
[0241] In some embodiments of the present invention Figure 7 This is an optional flowchart illustrating a resource scheduling method provided by an embodiment of the present invention. Figure 6 After step S303, steps S307-S308 are also executed, as follows:
[0242] S307. By comparing the fitness value of the current position with the fitness value corresponding to the global optimal position, the global optimal position is updated to obtain a new global optimal position.
[0243] In some embodiments of the present invention, the terminal can update the global optimal position by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position, and obtain a new global optimal position.
[0244] In some embodiments of the present invention, step S307 can be implemented by S3071-S3072, as follows:
[0245] S3071. If the fitness value of the current position is greater than the fitness value corresponding to the global optimal position, update the global optimal position. The new global optimal position is the local optimal position.
[0246] In some embodiments of the present invention, the terminal can compare the fitness value of the current position with the fitness value corresponding to the global optimal position. If the fitness value of the current position is greater than the fitness value corresponding to the global optimal position, the global optimal position is updated, and the new global optimal position is the local optimal position.
[0247] S3072. If the fitness value of the current position is less than the fitness value corresponding to the global optimal position, then the global optimal position is not updated.
[0248] In some embodiments of the present invention, the terminal can compare the fitness value of the current position with the fitness value corresponding to the global optimal position. If the fitness value of the current position is less than the fitness value corresponding to the global optimal position, the global optimal position will not be updated.
[0249] For example, the global optimal position update can be obtained by the following formula (13).
[0250]
[0251] in, Let g be the local optimum position at the current iteration number t. best For the globally optimal position, τ t Let τ be the fitness value at the current iteration number t. gb This represents the fitness value corresponding to the globally optimal position.
[0252] It is understood that, in some embodiments of the present invention, the terminal can update the global optimal position through the global optimal position update formula, thereby providing conditions for subsequent calculations using the improved sparrow search algorithm to obtain training parameters.
[0253] S308. By comparing the fitness value of the current position with the fitness value corresponding to the worst global position, update the worst global position to obtain a new worst global position.
[0254] In some embodiments of the present invention, the terminal can update the global worst position by comparing the fitness value of the current position with the fitness value corresponding to the global worst position, and obtain a new global worst position.
[0255] It is understood that, in some embodiments of the present invention, the terminal can update the global optimal position and the global worst position to provide conditions for subsequent calculations using the improved sparrow search algorithm to obtain training parameters.
[0256] In some embodiments of the present invention, step S308 can be implemented by S3081-S3082, as follows:
[0257] S3081. If the fitness value of the current position is less than the fitness value corresponding to the worst global position, update the worst global position. The new worst global position is the worst local position.
[0258] In some embodiments of the present invention, the terminal can compare the fitness value of the current position with the fitness value corresponding to the global worst position. If the fitness value of the current position is less than the fitness value corresponding to the global worst position, the global worst position is updated and the new global worst position is the local worst position.
[0259] S3082. If the fitness value of the current position is greater than the fitness value corresponding to the worst position in the world, then the worst position in the world is not updated.
[0260] In some embodiments of the present invention, the terminal can compare the fitness value of the current position with the fitness value corresponding to the worst global position. If the fitness value of the current position is greater than the fitness value corresponding to the worst global position, then the worst global position will not be updated.
[0261] For example, the global worst position update can be obtained by the following formula (14).
[0262]
[0263] in, Let g be the local worst position at the current iteration number t. worst For the worst-case position globally, τ t Let τ be the fitness value at the current iteration number t. gw This represents the fitness value corresponding to the worst position globally.
[0264] It is understood that in some embodiments of the present invention, the terminal can update the global worst position using the global worst position update formula, thereby providing conditions for subsequent calculations using the improved sparrow search algorithm to obtain training parameters.
[0265] The following will describe an exemplary application of the embodiments of the present invention in a practical application scenario.
[0266] An optional flowchart of a resource scheduling method provided in this embodiment of the invention. Figure 7 ,like Figure 8As shown, multiple nodes are obtained, unavailable nodes are removed through pre-selection strategies and optimization methods, the resource values of the remaining nodes are calculated, and the optimal scheduling node is determined.
[0267] An optional flowchart of a resource scheduling method provided in this embodiment of the invention. Figure 8 ,like Figure 9 As shown, combined with Figure 9 The flowchart shown illustrates that the resource scheduling method mainly includes the following steps:
[0268] 1. Preliminary selection stage.
[0269] In some embodiments of the present invention, the terminal can obtain information on multiple nodes, remove unavailable nodes through a pre-selection phase scheduling strategy, and further filter nodes through a preferred phase scheduling method to prepare a node queue.
[0270] 2. Data acquisition stage.
[0271] In some embodiments of the present invention, the terminal can calculate the total node resource score S (equivalent to the total resource value), calculate the standard deviation of node resource scheduling before and after scheduling to obtain the node balance change difference queue B (equivalent to the total balance value), and calculate the similarity between the Pod to be scheduled (equivalent to the process) and the node to obtain the node similarity queue C (equivalent to the total similarity value).
[0272] 3. Using the acquired data and the trained random forest algorithm, obtain the optimal scheduling node.
[0273] In some embodiments of the present invention, the terminal inputs the node's total resource score S, balance change difference queue B, and similarity queue C into a trained random forest algorithm (equivalent to an improved sparrow search optimization random forest algorithm) to obtain the optimal scheduling node.
[0274] In some embodiments of the present invention, Figure 10 This is an optional flowchart of a resource scheduling method provided in an embodiment of the present invention. Figure 9 The training process of random forest optimized by sparrow search is as follows: Figure 10 As shown, the process is divided into two parts: historical data acquisition and model training. The data acquisition process involves calculating historical scheduling records to obtain historical data; the model training process involves training the sparrow search algorithm.
[0275] 4. Bind the Pod to be scheduled to the optimal scheduling node to complete the scheduling.
[0276] In some embodiments of the present invention, the terminal can bind the Pod to be scheduled to the optimal scheduling node to complete the scheduling.
[0277] It is understood that in some embodiments of the present invention, the terminal can improve the Sparrow Search Optimized Random Forest algorithm, predict the optimal scheduling node, bind it to the Pod to be scheduled, and complete the scheduling, thereby improving scheduling efficiency.
[0278] Based on the resource scheduling method of the above embodiments, this invention also provides a resource scheduling apparatus, such as... Figure 11 The above, Figure 11 A schematic diagram of the structure of a resource scheduling device provided in an embodiment of the present invention. Figure 1 The device includes: an acquisition unit 1101 and a determination unit 1102; wherein,
[0279] The acquisition unit 1101 is used to acquire the process to be scheduled and its corresponding information, and the queue of reserve nodes and its corresponding information; wherein, the queue of reserve nodes includes information corresponding to each of the multiple nodes; based on the information of the process to be scheduled and the information corresponding to each of the multiple nodes, a total resource value, a total balance value, and a total similarity value are calculated according to a preset calculation criterion; based on the total resource value, the total balance value, and the total similarity value, the optimal scheduling node is obtained by performing calculations using an improved sparrow search-optimized random forest algorithm;
[0280] The scheduling unit 1102 is used to bind the process to be scheduled to the optimal scheduling node to complete the scheduling.
[0281] In some embodiments of the present invention, the acquisition unit 1101 is used to acquire the process to be scheduled and its corresponding information, and multiple nodes and their respective node information; to filter the multiple nodes and perform vectorization processing to obtain a pre-node queue and its corresponding pre-node queue information.
[0282] In some embodiments of the present invention, the acquisition unit 1101 is used to filter the plurality of nodes through a pre-selection strategy to obtain an available node queue and corresponding available node queue information; compare and filter the information corresponding to any two nodes in the available node queue to obtain an initial reserve node queue and corresponding initial reserve node queue information; and perform vectorization processing on the initial reserve node queue and initial reserve node queue information to obtain the reserve node queue and corresponding reserve node queue information.
[0283] In some embodiments of the present invention, the acquisition unit 1101 is configured to: calculate the resource value of a node based on the preparatory node queue information and the information corresponding to each of the plurality of nodes, using a preset resource calculation criterion, thereby obtaining the total resource value; calculate the total balance value based on the information corresponding to each of the plurality of nodes and the information of the process to be scheduled, using a preset balance calculation criterion, wherein the resource value of a node is the resource value of any one of the plurality of nodes; the total resource value is a set of the resource values of the plurality of nodes; and calculate the similarity value of a node based on the preparatory node queue information and the information corresponding to each of the plurality of nodes, using a preset similarity calculation criterion, thereby obtaining the total similarity value; wherein the similarity value of a node is the similarity value of any one of the plurality of nodes; the total similarity value is a set of the similarity values of the plurality of nodes.
[0284] In some embodiments of the present invention, the information corresponding to each of the plurality of nodes includes: first processor resource information, first memory resource information, first network resource information, and first hard disk resource information of the node; the information of the process to be scheduled includes: second processor resource information, second memory resource information, second network resource information, and second hard disk resource information of the process to be scheduled.
[0285] The acquisition unit 1101 is configured to calculate, based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, according to a preset first resource calculation criterion, to obtain the first processor resource value, the first memory resource value, the first network resource value, and the first hard disk resource value, respectively; based on the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information, according to a preset weight calculation criterion, to obtain the second processor resource weight value, the second memory resource weight value, the second network resource weight value, and the second hard disk resource weight value, respectively; based on the first processor resource value, the first memory resource value, the first network resource value, the first hard disk resource value, the second processor resource weight value, the second memory resource weight value, the second network resource weight value, and the second hard disk resource weight value, according to a preset second resource calculation criterion, to obtain the resource value of the node, thereby obtaining the total resource value.
[0286] In some embodiments of the present invention, the acquisition unit 1101 is configured to calculate a first standard deviation based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, using a first standard deviation calculation criterion; calculate a second standard deviation based on the first processor resource information, the first memory resource information, the first network resource information, the first hard disk resource information, the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information, using a second standard deviation calculation criterion; and obtain the total balance value by performing a difference operation based on the first standard deviation and the second standard deviation.
[0287] In some embodiments of the present invention, the resource scheduling device further includes a determining unit 1103; wherein,
[0288] The determining unit 1103 is used to acquire historical node scheduling records, determine training data and test data; initialize the parameters of the random forest algorithm, and perform calculations based on the training data and the test data using an improved sparrow search algorithm to determine the optimal training parameters;
[0289] The acquisition unit 1101 is used to use the optimal training parameters as parameters of the random forest algorithm to obtain the improved sparrow search optimized random forest algorithm.
[0290] In some embodiments of the present invention, the acquisition unit 1101 is used to execute the improved sparrow search algorithm based on the training data until a termination condition is reached, output the sparrow position, and obtain training parameters; based on the test data, verify the training parameters through the improved sparrow search algorithm; if the verification result does not meet the expected requirements, repeat the calculation using the training data until the training parameters meet the expected requirements, and use the training parameters as the optimal training parameters.
[0291] In some embodiments of the present invention, the improved sparrow search algorithm includes a discoverer, a follower, and a warning.
[0292] The acquisition unit 1101 is used to initialize the original parameters of the sparrow search algorithm through chaotic mapping to obtain the initialized parameters;
[0293] The determining unit 1103 is used to calculate the fitness value of a sparrow using a sparrow search algorithm based on the initialized parameters, and to determine the sparrow's local optimal position, local worst position, global optimal position and corresponding fitness value, and global worst position and corresponding fitness value; to determine the discoverer update formula based on the global optimal position, the cosine adjustment formula and the current discoverer position; to determine the follower update formula based on the global optimal position, the global worst position and the current follower position; to determine the warning update formula based on the global optimal position, the global worst position and the current warning position; and to determine the improved sparrow search algorithm based on the discoverer update formula, the follower update formula and the warning update formula.
[0294] In some embodiments of the present invention, the acquisition unit 1101 is used to update the global optimal position by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position, and to obtain a new global optimal position; and to update the global worst position by comparing the fitness value of the current position with the fitness value corresponding to the global worst position, and to obtain a new global worst position.
[0295] In some embodiments of the present invention, the resource scheduling device further includes an update unit 1104;
[0296] The update unit 1104 is used to update the global optimal position if the fitness value of the current position is greater than the fitness value corresponding to the global optimal position, and the new global optimal position is the local optimal position; if the fitness value of the current position is less than the fitness value corresponding to the global optimal position, the global optimal position is not updated.
[0297] In some embodiments of the present invention, the update unit 1104 is configured to update the global worst position if the fitness value of the current position is less than the fitness value corresponding to the global worst position, wherein the new global worst position is the local worst position; and not update the global worst position if the fitness value of the current position is greater than the fitness value corresponding to the global worst position.
[0298] In some embodiments of the present invention, the determining unit 1103 is configured to: if the warning value is less than a preset safety value, determine a first position update formula for the discoverer based on the current discoverer position, the cosine adjustment formula, and the global optimal position; if the warning value is greater than the preset safety value, determine a second position update formula for the discoverer by performing a summation operation using a random number and the current discoverer position; and determine the discoverer update formula based on the first position update formula and the second position update formula.
[0299] In some embodiments of the present invention, the determining unit 1103 is configured to: if the current sparrow number is greater than half the total number of sparrows, determine a first follower position update formula based on the global worst position and the current follower position; if the current sparrow number is not greater than half the total number of sparrows, determine a second follower position update formula based on the current follower position and the global best position; and determine the follower update formula based on the first follower position update formula and the second follower position update formula.
[0300] In some embodiments of the present invention, the determining unit 1103 is configured to: if the current sparrow position fitness value during a single execution is not equal to the optimal fitness value during a single execution, determine a first position update formula for the early warning player based on the current position of the early warning player and the global optimal position; if the current sparrow position fitness value during a single execution is equal to the optimal fitness value during a single execution, determine a first position update formula for the early warning player based on the global worst position and the global optimal position; and determine the early warning player update formula based on the first position update formula for the early warning player and the second position update formula for the early warning player.
[0301] In some embodiments of the present invention, the determining unit 1103 is used to determine a set of node resources based on the total resource value, the total balance value, and the total similarity value;
[0302] The acquisition unit 1101 is used to input the set of node resources into the improved sparrow search optimization random forest algorithm to perform optimization calculations and obtain the optimal scheduling node.
[0303] Based on the resource scheduling method described in the above embodiments, this invention also provides a resource scheduling apparatus, such as... Figure 12 As shown, Figure 12 A schematic diagram of the structure of a resource scheduling device provided in an embodiment of the present invention. Figure 2 The device includes a processor 1201 and a memory 1202; the memory 1202 stores one or more programs executable by the processor, and when one or more programs are executed, the processor 1201 executes any of the resource scheduling methods described in the previous embodiments.
[0304] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0305] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0306] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0307] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0308] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention.
Claims
1. A resource scheduling method, characterized in that, include: Obtain the process to be scheduled and its corresponding information, as well as the queue of reserve nodes and its corresponding information; wherein, the information of the queue of reserve nodes includes information corresponding to each of the multiple nodes; Based on the information of the processes to be scheduled and the information corresponding to each of the multiple nodes, the total resource value, total balance value and total similarity value are calculated according to the preset calculation criteria. Based on the total resource value, the total balance value, and the total similarity value, the optimal scheduling node is obtained by performing calculations using a random forest algorithm optimized by sparrow search. Bind the process to be scheduled to the optimal scheduling node to complete the scheduling; Before obtaining the optimal scheduling node by performing calculations using an improved random forest algorithm for sparrow search optimization based on the total resource value, the total balance value, and the total similarity value, the method further includes: Obtain historical node scheduling records to determine training and test data; The parameters of the random forest algorithm are initialized, and the optimal training parameters are determined by performing calculations using an improved sparrow search algorithm based on the training data and the test data. Using the optimal training parameters as parameters for the random forest algorithm, the improved sparrow search optimized random forest algorithm is obtained; The step of obtaining the optimal scheduling node by performing calculations using an improved random forest algorithm for sparrow search optimization based on the total resource value, the total balance value, and the total similarity value includes: Based on the total resource value, the total balance value, and the total similarity value, a node resource set is determined; the node resource set is X = (Sn, Bn, Cn), where Sn is the total resource value, Bn is the total balance value, and Cn is the total similarity value. The set of node resources is input into the improved sparrow search optimization random forest algorithm to perform optimization calculations and obtain the optimal scheduling node.
2. The method according to claim 1, characterized in that, Before obtaining the process to be scheduled and its corresponding information, and the queue of reserve nodes and its corresponding information, the method further includes: Obtain the process to be scheduled and its corresponding information, as well as multiple nodes and their respective information; The multiple nodes are filtered and vectorized to obtain a queue of candidate nodes and the corresponding information of the queue.
3. The method according to claim 2, characterized in that, The process of filtering the multiple nodes and performing vectorization to obtain a queue of candidate nodes and corresponding candidate node queue information includes: The multiple nodes are filtered using a pre-selection strategy to obtain a queue of available nodes and the corresponding information about the available node queue. Compare and filter the information corresponding to any two nodes in the available node queue to obtain the initial reserve node queue and the corresponding initial reserve node queue information. The initial preparation node queue and its information are vectorized to obtain the preparation node queue and its corresponding information.
4. The method according to any one of claims 1-3, characterized in that, The process, based on the information of the process to be scheduled and the information corresponding to each of the multiple nodes, calculates the total resource value, total balance value, and total similarity value using preset calculation criteria, including: Based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, the resource value of each node is calculated according to a preset resource calculation criterion, thereby obtaining the total resource value; wherein, the resource value of each node is the resource value of any one of the multiple nodes; the total resource value is the set of the resource values of the multiple nodes. Based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, the total balance value is calculated using a preset balance calculation criterion. Based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, the similarity value of the nodes is calculated by using a preset similarity calculation criterion, thereby obtaining the total similarity value; wherein, the similarity value of each node is the similarity value of any one of the multiple nodes; the total similarity value is the set of the similarity values of the multiple nodes.
5. The method according to claim 4, characterized in that, The information corresponding to each of the plurality of nodes includes: the node's first processor resource information, first memory resource information, first network resource information, and first hard disk resource information; the information of the process to be scheduled includes: the process's second processor resource information, second memory resource information, second network resource information, and second hard disk resource information. The process of calculating the resource value of a node based on the information corresponding to each of the multiple nodes and the information of the process to be scheduled, according to a preset resource calculation criterion, and thus obtaining the total resource value, includes: Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, calculations are performed according to a preset first resource calculation criterion to obtain the first processor resource value, the first memory resource value, the first network resource value, and the first hard disk resource value, respectively. Based on the second processor resource information, the second memory resource information, the second network resource information, and the second hard disk resource information, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight are calculated according to a preset weight calculation criterion. Based on the first processor resource value, the first memory resource value, the first network resource value, the first hard disk resource value, the second processor resource weight, the second memory resource weight, the second network resource weight, and the second hard disk resource weight, the resource value of the node is calculated by means of a preset second resource calculation criterion, thereby obtaining the total resource value.
6. The method according to claim 4, characterized in that, The step of calculating the total balance value based on the information corresponding to each of the multiple nodes and the information of the processes to be scheduled, using a preset balance calculation criterion, includes: Based on the first processor resource information, the first memory resource information, the first network resource information, and the first hard disk resource information, the first standard deviation is calculated using the first standard deviation calculation criterion to obtain the first standard deviation. Based on the first processor resource information, first memory resource information, first network resource information, first hard disk resource information, second processor resource information, second memory resource information, second network resource information, and second hard disk resource information, the second standard deviation is calculated using the second standard deviation calculation criterion to obtain the second standard deviation. Based on the first standard deviation and the second standard deviation, the total balance value is obtained by performing a difference operation.
7. The method according to any one of claims 1-6, characterized in that, The initialization of the parameters for the random forest algorithm, based on the training data and the test data, is performed using an improved sparrow search algorithm to determine the optimal training parameters, including: Based on the training data, the improved sparrow search algorithm is executed until the termination condition is met, the sparrow position is output, and the training parameters are obtained. Based on the test data, the training parameters are verified using the improved sparrow search algorithm. If the verification result does not meet the expected requirements, the training data is used repeatedly for calculation until the training parameters meet the expected requirements, and the training parameters are then taken as the optimal training parameters.
8. The method according to claim 7, characterized in that, Before executing the improved sparrow search algorithm based on the training data until the termination condition is met and the sparrow position is output, the method further includes: The original parameters of the sparrow search algorithm are initialized by using chaotic mapping to obtain the initialized parameters; Based on the initialized parameters, the fitness value of the sparrow is calculated by the sparrow search algorithm, and the local optimal position, the local worst position, the global optimal position and the corresponding fitness value of the sparrow, and the global worst position and the corresponding fitness value of the sparrow are determined. Based on the global optimal position, the cosine adjustment formula, and the current discoverer position, the discoverer update formula is determined. Based on the global optimal position, the global worst position, and the current follower position, determine the follower update formula; Based on the global optimal position, the global worst position, and the current position of the early warning provider, the early warning provider update formula is determined; The improved sparrow search algorithm is determined based on the discoverer update formula, the follower update formula, and the early warning update formula.
9. The method according to claim 8, characterized in that, After calculating the sparrow's fitness value based on the parameters, and determining the local optimal position, local worst position, global optimal position and corresponding fitness value, and the global worst position and corresponding fitness value, the method further includes: The global optimal position is updated by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position, and a new global optimal position is obtained. By comparing the fitness value of the current position with the fitness value corresponding to the global worst position, the global worst position is updated to obtain a new global worst position.
10. The method according to claim 9, characterized in that, The step of updating the global optimal position by comparing the fitness value of the current position with the fitness value corresponding to the global optimal position to obtain a new global optimal position includes: If the fitness value of the current position is greater than the fitness value corresponding to the global optimal position, the global optimal position is updated, and the new global optimal position is the local optimal position; If the fitness value of the current position is less than the fitness value corresponding to the global optimal position, then the global optimal position is not updated.
11. The method according to claim 9, characterized in that, The step of updating the global worst position by comparing the fitness value of the current position with the fitness value corresponding to the global worst position to obtain a new global worst position includes: If the fitness value of the current position is less than the fitness value corresponding to the global worst position, update the global worst position, and the new global worst position is the local worst position; If the fitness value of the current position is greater than the fitness value corresponding to the worst global position, then the worst global position is not updated.
12. The method according to claim 8, characterized in that, The step of determining the discoverer update formula based on the global optimal position, the cosine adjustment formula, and the current discoverer position includes: If the warning value is less than the preset safety value, the first position update formula for the discoverer is determined based on the current discoverer position, the cosine adjustment formula, and the global optimal position. If the warning value is greater than the preset safety value, the second location update formula for the discoverer is determined by summing the random number and the current location of the discoverer. The discoverer update formula is determined based on the first position update formula and the second position update formula of the discoverer.
13. The method according to claim 8, characterized in that, The step of determining the follower update formula based on the global optimal position, the global worst position, and the current follower position includes: If the current sparrow number is greater than half of the total number of sparrows, determine the update formula for the first position of the follower based on the worst global position and the current follower position. If the current sparrow number is not greater than half of the total number of sparrows, determine the follower's second position update formula based on the current follower position and the global optimal position; The follower update formula is determined based on the follower first position update formula and the follower second position update formula.
14. The method according to claim 8, characterized in that, The step of determining the alerter update formula based on the globally optimal position, the globally worst position, and the current alerter position includes: If the fitness value of the current sparrow position during a single execution is not equal to the optimal fitness value during a single execution, the update formula for the first position of the early warning player is determined based on the current position of the early warning player and the global optimal position. If the fitness value of the current sparrow position in a single execution is equal to the optimal fitness value in a single execution, the first position update formula for the early warning agent is determined based on the worst global position and the best global position. Based on the first position update formula and the second position update formula of the early warning agent, the early warning agent update formula is determined.
15. A resource scheduling device, characterized in that, It includes an acquisition unit, a scheduling unit, and a determination unit; among which, The acquisition unit is used to acquire the process to be scheduled and its corresponding information, as well as the queue of reserve nodes and its corresponding information; based on the information of the process to be scheduled and the information of the queue of reserve nodes, it calculates the total resource value, the total balance value, and the total similarity value according to a preset calculation criterion; based on the total resource value, the total balance value, and the total similarity value, it performs calculations using an improved random forest algorithm optimized by sparrow search to obtain the optimal scheduling node; The scheduling unit is used to bind the process to be scheduled to the optimal scheduling node and complete the scheduling to receive the data to be compressed sent by the client. The determining unit is used to acquire historical node scheduling records, determine training data and test data; initialize the parameters of the random forest algorithm, and determine the optimal training parameters based on the training data and the test data by performing calculations using an improved sparrow search algorithm. The acquisition unit is further configured to use the optimal training parameters as parameters of the random forest algorithm to obtain the improved sparrow search optimized random forest algorithm; The determining unit is further configured to determine a node resource set based on the total resource value, the total balance value, and the total similarity value; the node resource set is X = (Sn, Bn, Cn), where Sn is the total resource value, Bn is the total balance value, and Cn is the total similarity value; The acquisition unit is further configured to input the set of node resources into the improved sparrow search optimization random forest algorithm to perform optimization calculations and obtain the optimal scheduling node.
16. A resource scheduling device, characterized in that, include: Memory, used to store executable instructions; A processor for executing executable instructions stored in the memory to implement the method as claimed in any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that, The storage medium stores executable instructions that, when executed, cause the processor to perform the method as described in any one of claims 1 to 14.