A distributed task scheduling method, device and electronic equipment
By combining discrete particle swarm optimization and genetic algorithms, a task scheduling vector is constructed and global iterative optimization is performed, which solves the problem of unbalanced load of discrete tasks in distributed systems and achieves accurate task scheduling and efficient resource utilization.
Patent Information
- Application Number
- CN202211241630.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-11
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-10-11
AI Technical Summary
Existing distributed task scheduling methods are prone to resource waste when handling discrete tasks, especially resource waste caused by load imbalance.
A discrete particle swarm optimization approach is adopted, combined with selection, crossover, and mutation operations in genetic algorithms, to construct a task scheduling vector. Through global position iterative optimization, the load balance is maximized to determine the optimal task scheduling strategy.
It achieves accurate task scheduling and load balancing, reduces resource waste, and improves task allocation efficiency and system performance.
Smart Images

Figure CN115509715B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a distributed task scheduling method and device and electronic equipment. BACKGROUND
[0002] In recent years, with the increasing maturity of cloud computing technology, more and more application tasks are deployed to node servers in various ways. In order to make full use of the computing resources of the node servers and save the computing cost, the application tasks need to be reasonably scheduled to balance the load of the node servers.
[0003] At present, the distributed system in an open network environment often adopts a loosely-coupled service-oriented architecture (SOA) to divide complex application tasks into different services according to the functional characteristics. These services are some coarse-grained and callable software entities, and have the characteristics of high availability, scalability and reusability. In a node server group, with the continuous increase of system business and users, the number of system tasks will also increase. The distributed task processing architecture can improve the concurrency, scalability and fault tolerance to realize the scheduling of continuous tasks. However, the existing scheduling mode can only realize the scheduling of continuous tasks. When the scheduling of discretized tasks is realized, the problem of resource waste caused by uneven load will also be caused. Therefore, the present application provides a reasonable scheduling mode for discretized tasks. SUMMARY
[0004] The present application provides a distributed task scheduling method, device and electronic equipment to solve the scheduling optimization problem of discretized tasks and ensure the accuracy of task scheduling.
[0005] According to an aspect of the present application, a distributed task scheduling method is provided, which comprises:
[0006] obtaining the number of tasks to be scheduled and the total number of node servers corresponding to the distributed node servers;
[0007] constructing a task scheduling vector to be optimized based on the number of tasks, wherein the elements in the task scheduling vector correspond to the tasks one by one, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is allocated;
[0008] The discrete particle swarm optimization method, the task resource constraint condition and the total number of node servers are used to globally iteratively optimize the task scheduling vector as a particle position with a maximum load balancing degree as an optimization target, to obtain a target global optimal position after iteration, wherein the discrete particle swarm optimization method is used to update the particle position and particle velocity based on selection operation, crossover operation and mutation operation in the genetic algorithm.
[0009] A target scheduling strategy is determined based on a target task scheduling vector corresponding to the target global optimal position.
[0010] According to another aspect of the present application, a distributed task scheduling device is provided, which comprises:
[0011] A number acquisition module is configured to acquire a current number of tasks to be scheduled and a total number of node servers corresponding to distributed node servers.
[0012] A scheduling vector construction module is configured to construct a task scheduling vector to be optimized based on the number of tasks, wherein elements in the task scheduling vector correspond to tasks one by one, and each element refers to a discrete server number corresponding to a node server to which a corresponding task is allocated.
[0013] A global optimal position acquisition module is configured to globally iteratively optimize the task scheduling vector as a particle position with a maximum load balancing degree as an optimization target based on a discrete particle swarm optimization method, a task resource constraint condition and the total number of node servers, to obtain a target global optimal position after iteration, wherein the discrete particle swarm optimization method is used to update the particle position and particle velocity based on selection operation, crossover operation and mutation operation in the genetic algorithm.
[0014] A scheduling strategy module is configured to determine a target scheduling strategy based on a target task scheduling vector corresponding to the target global optimal position.
[0015] According to another aspect of the present application, an electronic device is provided, which comprises:
[0016] At least one processor; and
[0017] A memory in communication connection with the at least one processor; wherein,
[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the distributed task scheduling method according to any one of the embodiments of the present application.
[0019] The technical scheme of the present application comprises the following steps: obtaining the number of tasks to be dispatched currently and the total number of node servers corresponding to the distributed node servers; constructing a task scheduling vector to be optimized based on the number of tasks, so as to realize the construction of the discretized tasks into the task scheduling vector; taking the task scheduling vector as the particle position to realize the global position iterative optimization with the maximized load balancing degree as the optimization target, the improved discrete particle swarm optimization mode, the task resource constraint condition and the total number of node servers, and obtaining the target global optimal position after iteration; determining the target scheduling strategy based on the target task scheduling vector corresponding to the target global optimal position, so as to realize the iteration of the task scheduling vector and obtain the target global optimal position after iteration, thereby determining the target scheduling strategy through the target global optimal position, and further solving the discretized task scheduling optimization problem and ensuring the accuracy of the task scheduling.
[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0022] Figure 1 is a flow chart of a distributed task scheduling method according to an embodiment of the present application;
[0023] Figure 2 is a flow chart of another distributed task scheduling method according to an embodiment of the present application;
[0024] Figure 3 is a flow chart of another distributed task scheduling method according to an embodiment of the present application;
[0025] Figure 4 is a flow chart of another distributed task scheduling method according to an embodiment of the present application;
[0026] Figure 5 is a structural schematic diagram of a distributed task scheduling device according to an embodiment of the present application;
[0027] Figure 6 is a structural schematic diagram of an electronic device for implementing the distributed task scheduling method of the present application. DETAILED DESCRIPTION
[0028] In order to make the person skilled in the art better understand the technical scheme of the present application, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the protection scope of the present application.
[0029] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0030] Embodiment one
[0031] Figure 1 A flowchart of a distributed task scheduling method is provided for the first embodiment of the present application. The present embodiment can be applicable to the case of reasonably scheduling discrete tasks. The method can be executed by a distributed task scheduling device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in the figure, the method comprises: Figure 1
[0032] S110, obtaining the number of tasks to be scheduled and the total number of node servers corresponding to the distributed node servers.
[0033] Wherein, the task can refer to a task that needs to occupy the CPU resources of the node server for calculation, and the storage of the calculation data and the self data needs to occupy the memory resources of the node server. The node server can refer to the server in the distributed machine group, which is used to execute the assigned task.
[0034] Specifically, the scheduling server for executing the scheduling task can receive all the tasks currently needing to be scheduled sent by the upstream, determine the number of tasks to be scheduled, and obtain the total number of nodes in the distributed machine group.
[0035] S120, constructing a task scheduling vector to be optimized based on the number of tasks.
[0036] The task scheduling vector can be used to represent the scheduling vector of the allocation of each task to the corresponding node server. For example, the task scheduling vector can be D = {s1, s2, …, sm}. The elements in the task scheduling vector correspond to the tasks one by one, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is allocated. For example, the server number can be sj = {1, 2, …, n}. The elements in the task scheduling vector can only be selected from the discrete server numbers corresponding to the node servers.
[0037] Specifically, the scheduling server can construct a task scheduling vector to be optimized based on the number of tasks to be scheduled at present. For example, there are 4 tasks to be scheduled, i.e., m = 4, which are task 1, task 2, task 3, and task 4; there are 3 node servers, i.e., n = 3. Based on the number of tasks, a task scheduling vector to be optimized D = {1, 3, 1, 2} can be constructed, which indicates that task 1 is allocated to node server 1, task 2 is allocated to node server 3, task 3 is allocated to node server 1, and task 4 is allocated to node server 2.
[0038] S130, based on the discrete particle swarm optimization method, the task resource constraint condition, and the total number of node servers, taking the maximization of the load balancing degree as the optimization target, performing global position iterative optimization on the task scheduling vector as the particle position to obtain the target global optimal position after iteration.
[0039] The discrete particle swarm optimization method is an optimization calculation technology that simulates the process of birds cooperating to find food. The discrete particle swarm optimization method updates the particle position and particle velocity based on the selection operation, crossover operation, and mutation operation in genetic algorithms, so that the discrete particle swarm optimization method can be used to solve the discrete task scheduling optimization problem. The task resource constraint condition can be a condition for constraining the received tasks based on the resource bearing capacity of the node server. For example, the task resource constraint condition can be a resource constraint condition such as the CPU resource upper limit of the node server or the memory resource upper limit of the node server. The load balancing degree can be represented by the task resource constraint condition. The target global optimal position can be a global position after iteration in which the load balancing degree reaches the optimal target.
[0040] Specifically, a load balancing calculation model can be constructed based on the task resource constraint condition and the total number of node servers, and the constructed task scheduling vector to be optimized is input as the particle position into the discrete particle swarm optimization model for global position iterative optimization until the maximization of the load balancing degree, i.e., the optimization target, is reached, and the target global optimal position after iteration is obtained.
[0041] S140, determining a target scheduling strategy based on the target task scheduling vector corresponding to the target global optimal position.
[0042] The target task scheduling vector can refer to an optimal task scheduling vector determined based on the target global optimal position. For example, the optimal task scheduling vector can be D'={1, 2, 1, 1}. The target scheduling strategy can refer to an optimal scheduling strategy obtained by analyzing the target task scheduling vector.
[0043] Specifically, the corresponding target task scheduling vector, such as D'={1, 2, 1, 1}, can be determined based on the obtained target global optimal position, and the target scheduling strategy, i.e., the optimal allocation manner of the four tasks, is determined as task 1 is allocated to node server 1, task 2 is allocated to node server 2, task 3 is allocated to node server 1, and task 4 is allocated to node server 1.
[0044] The technical scheme of the present application obtains the number of tasks to be scheduled and the total number of node servers corresponding to the distributed node servers, constructs a task scheduling vector to be optimized based on the number of tasks, to realize the construction of discrete tasks into a task scheduling vector, and based on the improved discrete particle swarm optimization method, the task resource constraint condition and the total number of node servers, takes the maximization of load balancing degree as the optimization target, takes the task scheduling vector as the particle position to perform global position iterative optimization, obtains the target global optimal position after iteration, determines the target scheduling strategy based on the target task scheduling vector corresponding to the target global optimal position, to realize the iteration of the task scheduling vector and the target global optimal position after iteration, and thus the target scheduling strategy is determined based on the target global optimal position, thereby solving the discrete task scheduling optimization problem and ensuring the accuracy of task scheduling.
[0045] Embodiment Two
[0046] Figure 2 A flowchart of a distributed task scheduling method provided for the second embodiment of the present application is provided, and the process of global position iterative optimization and obtaining the target global optimal position after iteration is described in detail in the embodiment. The explanations of the same or corresponding terms as those in the above disclosed embodiments are not repeated here.
[0047] As shown in Figure 2 The method comprises the following steps:
[0048] In S210, the number of tasks to be scheduled and the total number of node servers corresponding to the distributed node servers are obtained.
[0049] In S220, a task scheduling vector to be optimized is constructed based on the number of tasks.
[0050] The elements in the task scheduling vector correspond to the tasks one by one, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is allocated.
[0051] S230, determining a maximum server number based on the total number of node servers.
[0052] The maximum server number can be less than or equal to the total number of node servers.
[0053] Specifically, the scheduling server can determine the maximum server number based on the total number of node servers, for example, the total number of node servers is 3, and the maximum server number is 3, and the server number can be s j ={1,2,3}.
[0054] S240, initializing the particle position and particle velocity corresponding to each particle in the particle swarm.
[0055] The particle swarm optimization method randomly generates an initialized particle swarm. Each particle has two attributes: particle position and particle velocity. Each particle can represent a possible solution and correspond to a scheduling strategy. Each particle in the particle swarm corresponds to an element in the task scheduling vector. The particle position is represented by the task scheduling vector.
[0056] Specifically, before the first global position iteration optimization of the task scheduling vector as the particle position based on the discrete particle swarm optimization method, the task resource constraint condition and the total number of node servers, the particle position and the particle velocity corresponding to each particle in the initialized particle swarm can be initialized. For example, the initialized particle position can be represented by , and the initialized particle position can be represented by ; wherein, i represents the i th node service, g represents the iteration algebra; the initialized particle position and the particle velocity g=0.
[0057] It should be noted that the task data after the above smoothing processing is obtained by an auto-regressive moving average model (ARMA) to obtain the predicted task quantity, that is, the dimension of the task scheduling vector, and the prediction result is initialized to obtain the task set.
[0058] S250, determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0059] The current particle position can refer to the particle position corresponding to each particle at the current iteration number. The current load balancing degree can refer to the load balancing degree corresponding to each particle at the current iteration number.
[0060] Specifically, for each particle, the current load balancing degree corresponding to the particle can be determined based on the current particle position of the particle at the current iteration number.
[0061] For example, S250 can include: determining at least one assigned task corresponding to each target node server for executing the task based on the current particle position of each particle; determining an average node resource utilization corresponding to each target node server according to the total execution time of the assigned tasks corresponding to the target node server and the execution time, CPU resource and memory resource required when each assigned task is executed; determining an average group resource utilization based on the average node resource utilizations; and determining the current load balancing degree corresponding to each particle based on the average node resource utilization and the average group resource utilization.
[0062] The total execution time of the task can refer to the time required from the start of execution to the completion of the execution of the task. For example, the total execution time of the task assigned to the i-th node server is T, and the execution time, CPU resource and memory resource required when each assigned task is executed are t ci , t mi , and t i , respectively. ci The average node resource utilization can be determined based on the average CPU utilization and the average memory utilization, and is denoted as avg mi .
[0063] Specifically, for each particle, at least one assigned task corresponding to a target node server for executing the task can be determined based on the current particle position of the particle; for each target node server, an average CPU resource utilization corresponding to the target node server can be determined according to the total execution time of the assigned tasks corresponding to the target node server and the execution time and CPU resource required when each assigned task is executed; an average memory resource utilization corresponding to the target node server can be determined according to the total execution time of the assigned tasks corresponding to the target node server and the execution time and memory resource required when each assigned task is executed; and the average CPU resource utilization and the average memory resource utilization are averaged to obtain an average node resource utilization corresponding to the target node server. For example, the total execution time T and the execution time T Si , CPU resource t ci *T si , and memory resource t mi *T si corresponding to a certain target node server can be used to determine the average CPU resource utilization and the average memory resource utilization of the target node server by the following formula:
[0064]
[0065] The average CPU utilization of the i-th node server is determined as avg ci ; and through the following formula:
[0066]
[0067] The average memory utilization of the i-th node server is determined as avg mi ; and through the following formula:
[0068]
[0069] The average node resource utilization corresponding to the i-th node server is determined. If there are n node servers in the server group, the average node resource utilization of each node server can be determined, and through the following formula:
[0070]
[0071] The average group resource utilization is determined; and based on the determined average node resource utilization and average group resource utilization, and through the following formula:
[0072]
[0073] The current load balancing degree LD corresponding to the particle is determined. The greater the value of the current load balancing degree LD, the higher the load balancing degree of the server group, and the more reasonable the scheduling strategy.
[0074] S260, based on the current load balancing degree corresponding to each particle, the current individual optimal position corresponding to each particle and the current global optimal position corresponding to the particle group are updated.
[0075] The individual optimal position can refer to the particle position with the maximum value of the current load balancing degree after each iteration. The global optimal position can refer to the particle position with the maximum value of each load balancing degree up to the current iteration. The global optimal position can be the individual optimal position.
[0076] Specifically, based on the value of the current load balancing degree corresponding to each particle, the particle position with the maximum value of the current load balancing degree is determined and updated as the current individual optimal position, and the value of the current load balancing degree corresponding to the current individual optimal position is compared with the value of the load balancing degree corresponding to the current global optimal position determined in the last iteration. The particle position with the greater value of the load balancing degree is determined and updated as the current global optimal position.
[0077] S270. If the current iteration number is less than the preset iteration number, then based on the current personal best position, the current global best position, and the maximum server number corresponding to each particle, update the current particle position and the current particle velocity corresponding to each particle, and return to execute the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0078] Among them, the preset iteration number can refer to the iteration number set in advance, which is used to limit the total iteration number.
[0079] Specifically, if the current iteration number is less than the preset iteration number G, then based on the current personal best position, the current global best position, and the maximum server number corresponding to each particle, and through the following formula:
[0080]
[0081] Determine and update the current particle position corresponding to each particle; where, f1 is the mutation operation with as the mutation probability; f2 is the OX crossover operation, that is, the order crossover operation; d is the ratio of the number of different bits of the position in the gth generation compared to the position in the (g + 1)th generation to the total number of bits; is the subsequent selection operation; is the probability selection operation; 0 < c1 < 1, 0 < c2 < 1, c1 + c2 = 1, perform the crossover operation with the individual historical best position and the current position with a probability of c1, and perform the crossover operation with the global best position and the current position with a probability of c2; and through the following formula:
[0082]
[0083] Determine and update the current particle velocity corresponding to each particle; and return to execute the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle to determine the new current load balancing degree corresponding to each particle.
[0084] S280. If the current iteration number is equal to the preset iteration number, then detect whether the current global best position meets the task resource constraint conditions. If it meets, then determine the current global best position as the target global best position after iteration.
[0085] Among them, the task resource constraint conditions can include but are not limited to: the total CPU resources required for all tasks parallel on each node server are less than or equal to the CPU resource upper limit of the node server; the total memory resources required for all tasks parallel on each node server are less than or equal to the memory resource upper limit of the node server.
[0086] Specifically, if the current iteration number is equal to the preset iteration number G, it is detected whether the current global optimal position satisfies the task resource constraint condition, such as the total CPU resource required by all tasks in parallel on each node server being less than or equal to the upper limit of the CPU resource of the node server and the total memory resource required by all tasks in parallel on each node server being less than or equal to the upper limit of the memory resource of the node server; if any task resource constraint condition cannot be satisfied, the preset iteration number can be increased or the node server can be increased, and iteration is continued; if all task resource constraint conditions are satisfied, the current global optimal position is determined as the target global optimal position after iteration.
[0087] In S290, a target scheduling strategy is determined based on a target task scheduling vector corresponding to the target global optimal position.
[0088] The technical scheme of the present application determines the maximum server number based on the total number of node servers; initializes the particle position and particle speed corresponding to each particle in the particle swarm, wherein the particle position is represented by a task scheduling vector; determines the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle; updates the current individual optimal position corresponding to each particle and the current global optimal position corresponding to the particle swarm based on the current load balancing degree corresponding to each particle; if the current iteration number is less than the preset iteration number, the current particle position and the current particle speed corresponding to each particle are updated based on the current individual optimal position corresponding to each particle, the current global optimal position, and the maximum server number, and the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle is returned; if the current iteration number is equal to the preset iteration number, it is detected whether the current global optimal position satisfies the task resource constraint condition, and if it does, the current global optimal position is determined as the target global optimal position after iteration, so as to solve the task scheduling vector by iterating the task scheduling vector, improve the diversity of the algorithm iteration result, and obtain the target global optimal position after iteration, so as to determine the target scheduling strategy through the target global optimal position, further solve the discrete task scheduling optimization problem, and ensure the accuracy of task scheduling.
[0089] Embodiment Three
[0090] Figure 3 A flowchart of a distributed task scheduling method provided for Embodiment Three of the present application is provided, and the present embodiment describes in detail the step of "updating the current particle position and the current particle speed corresponding to each particle based on the current individual optimal position corresponding to each particle, the current global optimal position, and the maximum server number" on the basis of the above-described embodiments. The explanations of terms that are the same as or corresponding to those in the above-described embodiments are not repeated here.
[0091] AsFigure 3 The method comprises the following steps of:
[0092] S310, acquiring a current number of tasks to be scheduled and a total number of node servers corresponding to a distributed node server.
[0093] S320, constructing a task scheduling vector to be optimized based on the number of tasks.
[0094] Each element in the task scheduling vector corresponds to a task, and each element indicates a discrete server number corresponding to a node server to which the corresponding task is allocated.
[0095] S330, determining a maximum server number based on the total number of node servers.
[0096] S340, initializing a particle position and a particle velocity corresponding to each particle in a particle swarm, wherein the particle position is represented by the task scheduling vector.
[0097] S350, determining a current load balancing degree corresponding to each particle based on a current particle position corresponding to the particle.
[0098] S360, updating a current individual optimal position corresponding to each particle and a current global optimal position corresponding to the particle swarm based on the current load balancing degree corresponding to each particle.
[0099] S370, if a current iteration number is less than a preset iteration number, comparing a random probability with a current particle velocity corresponding to each particle and a preset probability, respectively.
[0100] The random probability can be a randomly generated probability. The random probability can be represented by r. For example, the random probability can be 0.4, i.e., r=0.4. The preset probability can be a probability with a size between 0 and 1 that is set in advance. The preset probability can be represented by c1 and c2, and 0<c1<1, 0<c2<1, c1+c2=1. For example, the preset probability can be 0.3 and 0.7, i.e., c1=0.3, c2=0.7.
[0101] Specifically, if the current iteration number is less than the preset iteration number G, for each particle, the random probability r in the formula is compared with the current particle velocity corresponding to the particle and the preset probability (c1 and c2), respectively.
[0102] S380, determining at least one target operation from a mutation operation, a first crossover operation and a second crossover operation based on a comparison result.
[0103] The mutation operation is an operation of mutating the current particle position. f1 is a mutation function. is a mutation operation for mutation probability. f2 is an OX crossover operation, i.e., a sequential crossover operation. The first crossover operation is an operation of crossing the current particle position and the current individual optimal position. is the first crossover operation. The second crossover operation is an operation of crossing the current particle position and the current global optimal position. is the second crossover operation. The target operation can refer to an operation for determining the updated current particle position.
[0104] Specifically, based on the comparison result, if and r≤c1, the mutation operation and the first crossover operation are taken as the target operation; if and r>c1, it is indicated that and r≤c2, the mutation operation and the second crossover operation are taken as the target operation; if and r≤c1, the first crossover operation is taken as the target operation; if and r>c1, it is indicated that and r≤c2, the second crossover operation is taken as the target operation.
[0105] Exemplarily, S380 can include: if the random probability is less than the current particle speed corresponding to the particle, taking the mutation operation as one target operation; if the random probability is less than or equal to a preset probability, taking the first crossover operation as one target operation; if the random probability is greater than the preset probability, taking the second crossover operation as one target operation.
[0106] Specifically, if the random probability r is less than the current particle speed corresponding to the particle , the mutation operation is taken as one target operation; if the random probability r is less than or equal to a preset probability c1, the first crossover operation is taken as one target operation; if the random probability r is greater than the preset probability c1, the second crossover operation is taken as one target operation.
[0107] S390, performing at least one target operation on the current particle position corresponding to the particle to determine the updated current particle position corresponding to the particle.
[0108] Specifically, if there is only one target operation, the target operation is directly executed to determine the updated current particle position corresponding to the particle; if there are two target operations, it is necessary to first calculate the first updated particle position based on the mutation operation, and then calculate and determine the updated current particle position corresponding to the particle based on the calculated first updated particle position and the other target operation.
[0109] Exemplarily, the S390 can comprise: if the target operation comprises the mutation operation and the first crossover operation, performing the mutation operation on the current particle position corresponding to the particle to obtain a mutated particle position, and performing the crossover operation on the mutated particle position corresponding to the particle and the current individual optimal position to obtain an updated current particle position;
[0110] if the target operation comprises the mutation operation and the second crossover operation, performing the mutation operation on the current particle position corresponding to the particle to obtain a mutated particle position, and performing the crossover operation on the mutated particle position corresponding to the particle and the current global optimal position to obtain an updated current particle position.
[0111] Specifically, if both the mutation operation and the first crossover operation are the target operation, it is necessary to first calculate the mutated particle position based on the mutation operation Then, the crossover operation is performed on the mutated particle position corresponding to the particle and the current individual optimal position, so as to calculate and determine the updated current particle position corresponding to the particle
[0112] if both the mutation operation and the first crossover operation are the target operation, it is necessary to first calculate the mutated particle position based on the mutation operation Then, the crossover operation is performed on the mutated particle position corresponding to the particle and the current global optimal position, so as to calculate and determine the updated current particle position corresponding to the particle
[0113] It should be noted that if the first crossover operation is the target operation, the crossover operation needs to be performed on the current particle position corresponding to the particle and the current individual optimal position, so as to calculate and determine the updated current particle position corresponding to the particle if the second crossover operation is the target operation, the crossover operation needs to be performed on the current particle position corresponding to the particle and the current global optimal position, so as to calculate and determine the updated current particle position corresponding to the particle
[0114] The S391, if it is detected that there is a target element greater than the maximum value of the server number in the updated current particle position, the element update is performed on the target element to obtain an updated current particle position.
[0115] Specifically, if it is detected that there is a target element greater than the maximum server number in the updated current particle position, indicating that the task corresponding to the target element is allocated to a non-existent server, the target element needs to be updated to the first server, and the server number is taken as the updated current particle position. For example, there are 3 servers; the maximum server number is 3; if it is detected that there is an element of 4 in the updated current particle position, the element is a target element, and the target element is updated to the first server, and the server number is taken as the updated current particle position, that is, the updated target element is 1.
[0116] S392, determining the updated current particle speed corresponding to the particle according to the current particle position before updating and the updated current particle position, and returning to perform the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0117] Specifically, the updated current particle speed corresponding to the particle can be determined according to the difference between the current particle position before updating and the updated current particle position corresponding to the particle, and the operations of S350 to S392 are returned to be performed until it is detected that there is no target element greater than the maximum server number in the updated current particle position, and S393 can be performed.
[0118] Exemplarily, "determining the updated current particle speed corresponding to the particle according to the current particle position before updating and the updated current particle position" in S392 can include: comparing the current particle position before updating and the updated current particle position corresponding to the particle to determine the target bit number corresponding to different elements at the same element position and the ratio between the target bit number and the total bit number; and determining the updated current particle speed corresponding to the particle according to the ratio.
[0119] Specifically, the current particle position before updating and the updated current particle position corresponding to the particle can be compared to determine the target bit number corresponding to different elements at the same element position and the ratio between the target bit number and the total bit number determining the updated current particle speed corresponding to the particle according to the ratio that is
[0120] S393, if the current iteration number is equal to the preset iteration number, detecting whether the current global optimal position satisfies the task resource constraint condition, and if so, determining the current global optimal position as the target global optimal position after iteration.
[0121] S394, determining the target scheduling strategy based on the target task scheduling vector corresponding to the target global optimal position.
[0122] The technical scheme of the present application, by comparing the random probability with the current particle speed corresponding to each particle and the preset probability when the current iteration number is less than the preset iteration number, and determining at least one target operation from the mutation operation, the first crossover operation and the second crossover operation based on the comparison result, thereby updating the particle position and the particle speed by using the mutation operation, the first crossover operation and the second crossover operation to realize the discretized task scheduling, while improving the diversity of the algorithm iteration result, further ensuring the accuracy of the task scheduling.
[0123] Embodiment four
[0124] Figure 4 The flowchart of the distributed task scheduling method provided by the fourth embodiment of the present application, the present embodiment describes in detail the steps of "determining the maximum server number based on the total number of node servers", "updating the current particle position and the current particle speed corresponding to each particle based on the current individual optimal position, the current global optimal position and the maximum server number corresponding to each particle", and "when the current iteration number is equal to the preset iteration number" based on the above embodiments. The explanations of the same or corresponding terms as those in the above disclosed embodiments are not repeated here.
[0125] As shown in Figure 4 , the method comprises:
[0126] S410, obtaining the current task quantity to be scheduled and the total number of node servers corresponding to the distributed node servers.
[0127] S420, constructing a task scheduling vector to be optimized based on the task quantity.
[0128] Among them, the elements in the task scheduling vector correspond one-to-one to the tasks, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is allocated.
[0129] S430, initializing the number of node servers that can be allocated.
[0130] Among them, the initial current number of node servers that can be allocated is less than the total number of node servers.
[0131] Specifically, if the total number of node servers is 6, the initial current number of node servers that can be allocated can be 2, so as to realize reasonable allocation of tasks by using as few node servers as possible, save server resources, and relatively reduce the iteration number, thereby improving the efficiency of task scheduling.
[0132] S440, determining the current maximum server number of the current iteration based on the current number of node servers that can be allocated.
[0133] Specifically, if the number of currently allocatable node servers is 3, it can be determined that the maximum value of the current server number of the current iteration is 3.
[0134] S450, initialize the particle position and the particle velocity corresponding to each particle in the particle swarm, wherein the particle position is characterized by the task scheduling vector.
[0135] S460, determine the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0136] S470, update the current individual optimal position corresponding to each particle and the current global optimal position corresponding to the particle swarm based on the current load balancing degree corresponding to each particle.
[0137] S480, if the current iteration number is less than the preset iteration number, update the current particle position and the current particle velocity corresponding to each particle based on the current individual optimal position corresponding to each particle, the current global optimal position, and the maximum value of the current server number of the current iteration, and return to perform the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0138] Specifically, if the current iteration number is less than the preset iteration number G, update the current particle position and the current particle velocity corresponding to each particle based on the current individual optimal position corresponding to each particle, the current global optimal position, and the maximum value of the current server number of the current iteration, and through the following formula:
[0139]
[0140] determine and update the current particle position corresponding to each particle; wherein f1 is a mutation operation with a mutation probability of ; f2 is an OX crossover operation, i.e., a sequential crossover operation; d is the ratio of the number of different bits of the gth generation position compared with the (g+1)th generation position to the total number of bits; is a subsequent selection operation; is a probability selection operation; 0
[0141]
[0142] determine and update the current particle velocity corresponding to each particle; and return to perform the operations of S460 to S480 until the current iteration number is equal to the preset iteration number, and S490 can be performed.
[0143] Based on the current particle position corresponding to each particle, the operation of determining the current load balancing degree corresponding to each particle is performed to determine the new current load balancing degree corresponding to each particle.
[0144] In S490, if the current iteration number is equal to the preset iteration number, it is detected whether the current global optimal position satisfies the task resource constraint condition.
[0145] In S490, if the current iteration number is equal to the preset iteration number, it is detected whether the current global optimal position satisfies the task resource constraint condition.
[0146] Specifically, if the current iteration number is equal to the preset iteration number G, it is detected whether the current global optimal position satisfies the task resource constraint condition, such as the total CPU resource required by all tasks running in parallel on each node server being less than or equal to the upper limit of the CPU resource of the node server and the total memory resource required by all tasks running in parallel on each node server being less than or equal to the upper limit of the memory resource of the node server.
[0147] In S491, a target scheduling strategy is determined based on a target task scheduling vector corresponding to the target global optimal position.
[0148] The technical scheme of the present application initializes the number of node servers that can be allocated, wherein the initial current number of node servers that can be allocated is less than the total number of node servers, and the current maximum server number of the current iteration is determined based on the current number of node servers that can be allocated,
[0149] Therefore, the task can be reasonably distributed using as few node servers as possible, server resources are saved, and the iteration number can be relatively reduced, thereby improving the efficiency of task scheduling.
[0150] The following are embodiments of the distributed task scheduling device provided in this invention. This device and the distributed task scheduling method of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the distributed task scheduling device, please refer to the embodiments of the above distributed task scheduling method.
[0151] Example 5
[0152] Figure 5 This is a schematic diagram of a distributed task scheduling device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes: a quantity acquisition module 510, a scheduling vector construction module 520, a global optimal position acquisition module 530, and a scheduling strategy module 540.
[0153] The system includes the following modules: a quantity acquisition module 510, which acquires the number of tasks to be scheduled and the total number of distributed node servers; a scheduling vector construction module 520, which constructs a task scheduling vector to be optimized based on the number of tasks, wherein each element in the task scheduling vector corresponds one-to-one with a task, and each element refers to the discrete server number corresponding to the node server to which the task is assigned; a global optimal position acquisition module 530, which, based on discrete particle swarm optimization, task resource constraints, and the total number of node servers, optimizes the task scheduling vector as particle positions for global position iteration based on maximizing load balancing, to obtain the target global optimal position after iteration, wherein the discrete particle swarm optimization is based on selection, crossover, and mutation operations in genetics to update particle positions and particle velocities; and a scheduling strategy module 540, which determines the target scheduling strategy based on the target task scheduling vector corresponding to the target global optimal position.
[0154] The technical solution of this invention obtains the number of tasks to be scheduled and the total number of distributed node servers. Based on the number of tasks, a task scheduling vector to be optimized is constructed to transform discretized tasks into task scheduling vectors. Based on an improved discrete particle swarm optimization method, task resource constraints, and the total number of node servers, with the goal of maximizing load balancing, the task scheduling vectors are used as particle positions for global position iterative optimization to obtain the target globally optimal position after iteration. Based on the target task scheduling vector corresponding to the target globally optimal position, a target scheduling strategy is determined. This solves the problem of discretized task scheduling optimization by iterating the task scheduling vectors and obtaining the target globally optimal position after iteration, thereby determining the target scheduling strategy through the target globally optimal position and ensuring the accuracy of task scheduling.
[0155] Optionally, the global optimal position acquisition module 530 may include:
[0156] a maximum number of server numbers determining sub-module configured to determine a maximum number of server numbers based on the total number of node servers;
[0157] an initialization sub-module configured to initialize a particle position and a particle velocity of each particle in the particle swarm, wherein the particle position is represented by a task scheduling vector;
[0158] a load balancing degree determining sub-module configured to determine a current load balancing degree corresponding to each particle based on a current particle position corresponding to the particle;
[0159] an optimal position updating sub-module configured to update a current individual optimal position corresponding to each particle and a current global optimal position corresponding to the particle swarm based on the current load balancing degree corresponding to each particle;
[0160] a particle data updating sub-module configured to, if the current iteration number is less than the preset iteration number, update the current particle position and the current particle velocity corresponding to each particle based on the current individual optimal position corresponding to each particle, the current global optimal position, and the maximum number of server numbers, and return to perform the operation of determining the current load balancing degree corresponding to each particle based on the current particle position corresponding to each particle.
[0161] a target global optimal position determining sub-module configured to, if the current iteration number is equal to the preset iteration number, detect whether the current global optimal position satisfies the task resource constraint condition, and if so, determine the current global optimal position as an iteration target global optimal position.
[0162] Optionally, the load balancing degree determining sub-module is specifically configured to: determine at least one assigned task corresponding to each target node server for executing a task based on the current particle position corresponding to each particle; determine an average node resource utilization corresponding to each target node server according to a total execution time of the assigned task corresponding to each target node server and an execution time, a CPU resource, and a memory resource required for executing each assigned task; determine an average unit resource utilization based on the average node resource utilizations; and determine the current load balancing degree corresponding to each particle based on the average node resource utilizations and the average unit resource utilization.
[0163] Optionally, the particle data updating sub-module can include:
[0164] a probability comparison unit configured to, for each particle, compare a random probability with the current particle velocity corresponding to the particle and a preset probability respectively;
[0165] a target operation determination unit configured to determine at least one target operation from the mutation operation, the first crossover operation and the second crossover operation based on the comparison result, wherein the mutation operation is an operation of mutating the current particle position, the first crossover operation is an operation of crossing the current particle position and the current individual optimal position, and the second crossover operation is an operation of crossing the current particle position and the current global optimal position;
[0166] a current particle position determination unit configured to perform the at least one target operation on the current particle position corresponding to the particle to determine an updated current particle position corresponding to the particle;
[0167] a current particle position acquisition unit configured to, if it is detected that there is a target element greater than the maximum value of the server number in the updated current particle position, perform element updating on the target element to obtain the updated current particle position;
[0168] a current particle speed determination unit configured to determine an updated current particle speed corresponding to the particle according to the current particle position before updating and the updated current particle position corresponding to the particle.
[0169] Optionally, the target operation determination unit is specifically configured to: if the random probability is less than the current particle speed corresponding to the particle, take the mutation operation as one target operation; if the random probability is less than or equal to a preset probability, take the first crossover operation as one target operation; and if the random probability is greater than the preset probability, take the second crossover operation as one target operation.
[0170] Optionally, the current particle position determination unit is specifically configured to: if the target operation includes the mutation operation and the first crossover operation, perform the mutation operation on the current particle position corresponding to the particle to obtain a mutated particle position, perform the crossover operation on the mutated particle position corresponding to the particle and the current individual optimal position, and take the crossed particle position as the updated current particle position; and if the target operation includes the mutation operation and the second crossover operation, perform the mutation operation on the current particle position corresponding to the particle to obtain a mutated particle position, perform the crossover operation on the mutated particle position corresponding to the particle and the current global optimal position, and take the crossed particle position as the updated current particle position.
[0171] Optionally, the current particle speed determination unit is specifically configured to: compare the current particle position before updating and the updated current particle position corresponding to the particle to determine a target bit number of different elements corresponding to the same element position and a ratio between the target bit number and a total bit number; and determine the updated current particle speed corresponding to the particle according to the ratio.
[0172] Optionally, the maximum number of serial numbers determination submodule is specifically configured to: initialize the number of node servers that can be allocated, wherein the initialized number of node servers that can be allocated is less than the total number of node servers; and determine the maximum number of serial numbers of the current iteration based on the number of node servers that can be allocated.
[0173] The particle data updating submodule is specifically configured to: update the current particle position and the current particle velocity of each particle based on the current individual optimal position of each particle, the current global optimal position, and the maximum number of serial numbers of the current iteration.
[0174] The global optimal position acquisition module 530 further includes:
[0175] The server number updating submodule is configured to: if it is detected that the current global optimal position does not satisfy the task resource constraint condition, and the number of node servers that can be allocated is less than the total number of node servers, then update the number of node servers that can be allocated by 1, and return to perform the operation of determining the maximum number of serial numbers of the current iteration based on the number of node servers that can be allocated.
[0176] The distributed task scheduling device provided in the embodiments of the present application can execute the distributed task scheduling method provided in any of the embodiments of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0177] It should be noted that, in the embodiments of the above distributed task scheduling device, each module included is only divided according to the functional logic, but is not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional module are only for the convenience of mutual differentiation, and do not serve to limit the protection scope of the present application.
[0178] Embodiment six
[0179] Figure 6 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0180] As Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores computer programs executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0181] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0182] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the distributed task scheduling method.
[0183] It should be understood that various forms of flow shown above can be used to reorder, add, or delete steps. For example, each step described in the present application can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0184] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A distributed task scheduling method, characterized in that, include: Get the number of tasks currently waiting to be scheduled and the total number of node servers corresponding to the distributed node server; Based on the number of tasks, a task scheduling vector to be optimized is constructed, wherein the elements in the task scheduling vector correspond one-to-one with the tasks, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is assigned. Based on the discrete particle swarm optimization method, task resource constraints, and the total number of node servers, with the goal of maximizing load balancing, the task scheduling vector is used as the particle position for global position iterative optimization to obtain the target global optimal position after iteration. The discrete particle swarm optimization method updates the particle position and particle velocity based on selection, crossover, and mutation operations in genetics. Based on the target task scheduling vector corresponding to the target's globally optimal position, determine the target scheduling strategy; The step of optimizing a discrete particle swarm optimization method, considering task resource constraints and the total number of node servers, with the goal of maximizing load balancing, and using the task scheduling vector as the particle position for global position iteration optimization to obtain the target global optimal position after iteration, includes: determining the maximum value of the server number based on the total number of node servers; initializing the particle position and particle velocity corresponding to each particle in the particle swarm, wherein the particle position is represented by the task scheduling vector; determining the current load balancing degree corresponding to each particle based on the current particle position; updating the current individual optimal position and the current global optimal position of the particle swarm based on the current load balancing degree; if the current iteration number is less than the preset iteration number, updating the current particle position and current particle velocity corresponding to each particle based on the current individual optimal position, the current global optimal position, and the maximum value of the server number, and returning to execute the operation of determining the current load balancing degree corresponding to each particle based on the current particle position; if the current iteration number is equal to the preset iteration number, checking whether the current global optimal position satisfies the task resource constraints, and if so, determining the current global optimal position as the target global optimal position after iteration.
2. The method according to claim 1, characterized in that, Based on the current particle position corresponding to each particle, determine the current load balance degree for each particle, including: Based on the current particle position corresponding to each particle, determine at least one assigned task for each target node server used to execute the task. Based on the total execution time of the allocated tasks corresponding to each target node server and the execution time, CPU resources and memory resources required for each allocated task, determine the average node resource utilization rate corresponding to each target node server. The average unit resource utilization rate is determined based on the average node resource utilization rate of each node. Based on the average node resource utilization rate and the average unit resource utilization rate, the current load balance degree corresponding to each particle is determined.
3. The method according to claim 1, characterized in that, Based on the current individual optimal position, the current global optimal position, and the maximum value of the server number for each particle, update the current particle position and current particle velocity for each particle, including: For each particle, the random probability is compared with the current particle velocity and the preset probability corresponding to that particle. Based on the comparison results, at least one target operation is determined from the mutation operation, the first crossover operation, and the second crossover operation, wherein the mutation operation is an operation that mutates the current particle position, the first crossover operation is an operation that crosses the current particle position and the current individual optimal position, and the second crossover operation is an operation that crosses the current particle position and the current global optimal position. Perform at least one target operation on the current particle position corresponding to the particle to determine the updated current particle position corresponding to the particle. If a target element with a higher value than the server number is detected in the updated current particle position, the target element is updated to obtain the updated current particle position. Based on the current particle position before the update and the current particle position after the update, determine the current particle velocity corresponding to the particle.
4. The method according to claim 3, characterized in that, Based on the comparison results, at least one target operation is determined from the mutation operation, the first crossover operation, and the second crossover operation, including: If the random probability is less than the current particle velocity corresponding to the particle, then the mutation operation is taken as a target operation; If the random probability is less than or equal to the preset probability, then the first crossover operation is taken as a target operation; If the random probability is greater than the preset probability, then the second crossover operation will be used as a target operation.
5. The method according to claim 3, characterized in that, Performing at least one target operation on the current particle position corresponding to the particle to determine the updated current particle position includes: If the target operation includes a mutation operation and a first crossover operation, then a mutation operation is performed on the current particle position corresponding to the particle to obtain the mutated particle position, and a crossover operation is performed on the mutated particle position corresponding to the particle and the current individual optimal position, and the crossover particle position is used as the updated current particle position. If the target operation includes a mutation operation and a second cross operation, then a mutation operation is performed on the current particle position corresponding to the particle to obtain the mutated particle position, and a cross operation is performed on the mutated particle position corresponding to the particle and the current global optimal position, and the cross-joined particle position is used as the updated current particle position.
6. The method according to claim 3, characterized in that, Based on the particle's position before and after the update, determine the particle's updated current velocity, including: Compare the current particle position before the update with the current particle position after the update to determine the target number of different elements corresponding to the same element position and the ratio between the target number of bits and the total number of bits; Based on the ratio, the updated current particle velocity corresponding to the particle is determined.
7. The method according to claim 1, characterized in that, Determining the maximum server ID based on the total number of node servers includes: Initialize the number of node servers that can be assigned, wherein the initial number of node servers that can be assigned is less than the total number of node servers; Based on the number of currently available node servers, determine the maximum value of the current server number for the current iteration; The step of updating the current particle position and current particle velocity for each particle based on the current individual optimal position, the current global optimal position, and the maximum value of the server number includes: Based on the current individual optimal position, the current global optimal position, and the maximum value of the current server number in the current iteration for each particle, update the current particle position and current particle velocity for each particle; When the current iteration number equals the preset iteration number, it also includes: If it is detected that the current global optimal position does not meet the task resource constraints, and the number of currently allocable node servers is less than the total number of node servers, then the number of currently allocable node servers is incremented by 1, and the operation of determining the maximum value of the current server number in the current iteration based on the number of currently allocable node servers is returned.
8. A distributed task scheduling device, characterized in that, include: The quantity acquisition module is used to obtain the number of tasks currently to be scheduled and the total number of node servers corresponding to the distributed node servers. The scheduling vector construction module is used to construct a task scheduling vector to be optimized based on the number of tasks. The elements in the task scheduling vector correspond one-to-one with the tasks, and each element refers to the discrete server number corresponding to the node server to which the corresponding task is assigned. The global optimal position acquisition module, based on the discrete particle swarm optimization method, task resource constraints, and the total number of node servers, takes maximizing load balancing as the optimization objective. It uses the task scheduling vector as the particle position to perform global position iterative optimization to obtain the target global optimal position after iteration. The discrete particle swarm optimization method is based on selection, crossover, and mutation operations in genetics to update particle positions and particle velocities. The scheduling strategy module is used to determine the target scheduling strategy based on the target task scheduling vector corresponding to the target's globally optimal position. The global optimal position acquisition module includes: a maximum number determination submodule, used to determine the maximum server number based on the total number of node servers; an initialization submodule, used to initialize the particle position and particle velocity corresponding to each particle in the particle swarm, wherein the particle position is represented by the task scheduling vector; a load balance determination submodule, used to determine the current load balance corresponding to each particle based on the current particle position corresponding to each particle; an optimal position update submodule, used to update the current individual optimal position and the current global optimal position corresponding to the particle swarm based on the current load balance corresponding to each particle; a particle data update submodule, used to update the current particle position and current particle velocity corresponding to each particle based on the current individual optimal position, the current global optimal position, and the maximum server number if the current iteration number is less than the preset iteration number, and return to execute the operation of determining the current load balance corresponding to each particle based on the current particle position; and a target global optimal position determination submodule, used to detect whether the current global optimal position meets the task resource constraints if the current iteration number is equal to the preset iteration number, and if it does, determine the current global optimal position as the target global optimal position after iteration.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the distributed task scheduling method according to any one of claims 1-7.
Citation Information
Patent Citations
Storm cluster load balancing method and system based on discrete particle swarms
CN111858029A