A load balancing method, device and terminal equipment based on vehicle Ethernet
By improving the ant colony algorithm and pheromone matrix adaptive mechanism, combined with the load rate, execution time and response time, load balancing scheduling instructions are generated, which solves the problems of uneven load and availability degradation in the vehicle Ethernet, and realizes the optimization of the number of service containers. Load balancing optimization under changing scenarios.
Patent Information
- Application Number
- CN202310242559.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-03-14
AI Technical Summary
The existing load balancing scheduling algorithm is relatively independent of vehicle Ethernet and is only applicable to scenarios where the number of service containers remains unchanged. It cannot effectively solve the problems of uneven load and availability degradation of vehicle Ethernet when the service scale expands.
Improve the ant colony algorithm, combine CPU utilization, memory utilization, execution time and response time to generate load balancing scheduling instructions, select service instances with shorter execution time, faster response speed and lower load level, and use the pheromone matrix The adaptive mechanism is updated to adapt to changes in the number of service containers.
It achieves effective selection of target service instances in the vehicle Ethernet, optimizes load balancing, improves system availability and response speed, and is suitable for scenarios where the number of service containers changes.
Smart Images

Figure CN116723193B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optimized scheduling of cloud computing tasks in data processing, and in particular to a load balancing method, device and terminal equipment based on vehicle-mounted Ethernet. Background Art
[0002] ECU (Electronic Control Unit) is a product of the automotive electronics industry, responsible for implementing corresponding functions for different systems of the vehicle. In the early days, vehicles had few functions, and point-to-point connections between ECUs could meet the needs. Later, with the continuous development of the automotive industry, the computing power of electronic hardware equipment continued to improve, and the on-board electronic systems became complex and diverse. In order to design reasonable communication links between ECUs, various bus-type network architectures such as controller area networks, local area interconnection networks, high-speed fault-tolerant networks, and multimedia transmission networks came into being. However, with more and more subsystems, such as advanced driver assistance systems, being added to the vehicle environment in recent years, the general bus-type network bandwidth can no longer support the explosive growth in broadband demand.
[0003] In-vehicle Ethernet can solve the above-mentioned problem of insufficient bandwidth. When the service scale is not large, for example, when a certain in-vehicle service has only a single provider instance and a receiver instance, its network topology is close to a monolithic application architecture. At this time, this mode can effectively reduce the network load. However, once the service scale expands and the system complexity increases, for example, when a certain in-vehicle service has multiple provider instances and receiver instances, its network topology is close to a microservice architecture. The communication process completely dominated by the service receiver is likely to cause uneven load levels on the service provider, causing load tilt and even service degradation, and ultimately reducing the availability of the entire in-vehicle Ethernet. In order to avoid this situation, a set of reasonable and available load balancing scheduling algorithms is needed. When the computing resources of the in-vehicle ECU are limited, the service receiver can find the most suitable service provider based on the algorithm.
[0004] Common load balancing scheduling algorithms are divided into traditional non-heuristic scheduling algorithms and heuristic intelligent scheduling algorithms. Non-heuristic scheduling algorithms are further divided into static algorithms and dynamic algorithms. Static algorithms include random scheduling, polling algorithms, weighted polling algorithms, etc., and dynamic algorithms include minimum connection number algorithm, weighted minimum connection number algorithm, etc. Heuristic intelligent scheduling algorithms include ant colony algorithm, genetic algorithm, particle swarm algorithm, simulated annealing algorithm, etc. Load balancing scheduling is essentially a task scheduling problem, which is classified as an NP-Hard problem. Traditional non-heuristic algorithms are only applicable to simple scheduling problems with small computational scale and low complexity. Heuristic intelligent scheduling algorithms use heuristic algorithms to solve NP-Hard problems, using local or global optimal solutions as approximate solutions, and have better performance in complex scheduling problems of multi-objective optimization, but they are relatively independent of vehicle Ethernet and are only applicable to scenarios where the number of service containers remains unchanged. Summary of the invention
[0005] The main purpose of the present invention is to propose a load balancing method, device and terminal equipment based on vehicle-mounted Ethernet, so as to solve the problem that the existing load balancing scheduling algorithm is relatively independent of the vehicle-mounted Ethernet and is only applicable to the scenario where the number of service containers remains unchanged.
[0006] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a load balancing method based on vehicle-mounted Ethernet, which is characterized by comprising:
[0007] In a device where J service instances are running, the following steps are included:
[0008] S11. Calculate the load rate of the jth service instance according to the CPU utilization and memory utilization;
[0009] S12, obtaining the execution time of parsing the request data, calculating and generating the response data after the j-th service instance receives the in-vehicle application request, where j is a positive integer less than or equal to J;
[0010] In the device running on the client, the following steps are included:
[0011] S21, obtaining the response time of the in-vehicle application request, where the response time is the time from when the in-vehicle application request is issued to when the client receives the response data;
[0012] Based on the load rate, the execution time and the response time, a load balancing scheduling instruction is generated by an improved ant colony algorithm, so that the client executes the load balancing scheduling instruction;
[0013] The device running the service instance and the device running the client are responsible for communicating with each other through any node of the vehicle Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle application request;
[0014] When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm is updated to obtain an updated load balancing scheduling instruction.
[0015] Optionally, the load rate of the jth service instance is calculated based on the CPU utilization and the memory utilization. The calculation formula is:
[0016] LR j =α*Au j +β*Bu j
[0017] Among them, Au j and Bu j They represent the CPU utilization and memory utilization of the device where the service instance j is located, respectively. α and β are influencing factors and α+β=1.
[0018] Optionally, the storage structure of the execution time and the response time is a key-value pair array;
[0019] Before generating the load balancing scheduling instruction, the execution time and the response time are serialized.
[0020] Optionally, the improved ant colony algorithm includes:
[0021] Modify the heuristic factor, the formula is:
[0022]
[0023] Among them, CT(t i ,S j ) represents the execution time of service instance j for vehicle application request i, RT(t i ,S j ) represents the response time of service instance j to vehicle application request i, LR j Represents the load rate of a single service instance j, LR avg Indicates the average load rate of all service instances in a task allocation combination.
[0024] Optionally, when the load rate of the service instance is greater than the average load rate, a penalty coefficient is set for the heuristic factor.
[0025] Optionally, a load balancing scheduling instruction is generated by improving the ant colony algorithm, including:
[0026] According to the load rate, the execution time, and the response time, all feasible solutions of the improved ant colony algorithm are quickly non-dominated sorted to obtain an ant set of Pareto optimal solutions, wherein the ant set includes a target service instance that executes the in-vehicle application request;
[0027] Wherein, all feasible solutions of the improved ant colony algorithm are represented by pheromone matrix.
[0028] Optionally, when the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instruction by the improved ant colony algorithm is updated, including:
[0029] When the client receives an unavailable event notification of any service instance, the column where the unavailable service instance is located in the pheromone matrix is deleted;
[0030] When a notification of a newly added service instance is received, the average pheromone value of each row in the pheromone matrix is obtained and allocated to the newly added service instance.
[0031] A second aspect of an embodiment of the present invention provides a load balancing system based on vehicle-mounted Ethernet, comprising a load level calculation module, an execution time recording module, a response time recording module, a load balancing scheduling analysis module, and a load balancing scheduling execution module;
[0032] The load level calculation module is used to calculate the load rate of the jth service instance according to the CPU utilization and the memory utilization in the device where J service instances are running;
[0033] The execution time recording module is used to obtain the execution time of parsing request data, calculating and generating response data after the j-th service instance receives the vehicle application request in the device where J service instances are running, where j is a positive integer less than or equal to J;
[0034] The response time recording module is used to obtain the response time of the in-vehicle application request in the device running on the client, and the response time is the time from the issuance of the in-vehicle application request to the receipt of the response data by the client;
[0035] The load balancing scheduling analysis module is used to generate a load balancing scheduling instruction through an improved ant colony algorithm based on the load rate, execution time and response time, so that the load balancing scheduling execution module of the client executes the load balancing scheduling instruction;
[0036] The device running the service instance and the device running the client are responsible for communicating with each other through any node of the vehicle Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle application request;
[0037] When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the load balancing scheduling execution module updates the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm to obtain updated load balancing scheduling instructions.
[0038] The third aspect of an embodiment of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the above memory and executable on the above processor, and when the above processor executes the above computer program, the steps of the method provided in the first aspect are implemented.
[0039] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0040] The load balancing method based on vehicle-mounted Ethernet provided by the embodiment of the present invention improves the traditional ant colony algorithm for the vehicle-mounted Ethernet core protocol, optimizes the three objectives of execution time, response time and load rate, so that by generating load balancing scheduling instructions through the improved ant colony algorithm, it is possible to select a target service instance with shorter execution time, faster response speed and lower load level to execute vehicle-mounted application requests. At the same time, in view of the problem that load balancing scheduling based on the ant colony algorithm is only applicable to the scenario where the number of service containers remains unchanged, that is, the number of service instances remains unchanged, an adaptive mechanism based on pheromone prior knowledge is used. When the number of service containers changes, that is, when the client receives an unavailable event notification of any service instance, or receives a notification of a new service instance, the pheromone matrix is reconstructed several times to adapt to the change in the number of service containers. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic diagram of the implementation flow of a load balancing method based on vehicle-mounted Ethernet provided in an embodiment of the present invention;
[0042] Figure 2 A schematic diagram of the composition structure of a load balancing device based on vehicle-mounted Ethernet provided in an embodiment of the present invention.
[0043] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0045] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0046] In this document, suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module" and "component" can be used interchangeably.
[0047] like Figure 1 As shown, an embodiment of the present invention provides a load balancing method based on vehicle-mounted Ethernet, including but not limited to the following steps:
[0048] S1. In a device where J service instances are running, the following steps are included:
[0049] S11. Calculate the load rate of the jth service instance according to the CPU utilization and memory utilization;
[0050] S12. Obtain the execution time of the jth service instance parsing the request data, calculating and generating the response data after receiving the in-vehicle application request, where j is a positive integer less than or equal to J.
[0051] In the above step S11, the load rate of the jth service instance is calculated according to the CPU utilization and the memory utilization, and the calculation formula is:
[0052] LR j =α*Au j +β*Bu j
[0053] Among them, Au j and Bu j They represent the CPU utilization and memory utilization of the device where the service instance j is located, respectively. α and β are influencing factors and α+β=1.
[0054] According to the above steps S11 and S12, the embodiment of the present invention calculates J load rates when J service instances are running, which are used for generating the load balancing scheduling instruction in the following step S3.
[0055] S2. In the device running on the client, the following steps are included:
[0056] S21. Obtain the response time of the in-vehicle application request, where the response time is the time from when the in-vehicle application request is sent to when the client receives the response data.
[0057] In the above step S12 and step S21, the storage structure of the execution time and the response time is a key-value pair array; before generating the load balancing scheduling instruction, the execution time and the response time are serialized.
[0058] Exemplarily, the storage structure of the execution time is a key-value pair array of <request id, execution time>, and the storage structure of the response time is a key-value pair array of <request id, response time>.
[0059] S3, based on the load rate, the execution time and the response time, generating a load balancing scheduling instruction by using an improved ant colony algorithm, so that the client executes the load balancing scheduling instruction;
[0060] The device on which the service instance runs and the device on which the client runs are responsible for communicating via any node of the vehicle-mounted Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle-mounted application request.
[0061] In the above step S3, the improved ant colony algorithm uses load rate, execution time and response time as constraints, and modifies the heuristic factor in the ant colony algorithm. The modified heuristic factor will enable the ant algorithm to prioritize outputting service instances with shorter execution time, faster response speed and lower load level.
[0062] In the embodiment of the present invention, the heuristic factor is modified, and the formula is:
[0063]
[0064] Among them, CT(t i ,S j ) represents the execution time of service instance j for vehicle application request i, RT(t i ,S j ) represents the response time of service instance j to vehicle application request i, LR j Represents the load rate of a single service instance j, LR avg Indicates the average load rate of all service instances in a task allocation combination.
[0065] The embodiment of the present invention also exemplarily provides a method for calculating the average load rate, which is:
[0066]
[0067] Among them, LR j Represents the load rate of a single service instance j.
[0068] In one embodiment, when the load rate of the service instance is greater than the average load rate, a penalty coefficient is set for the heuristic factor.
[0069] In the embodiment of the present invention, the step S3 of generating a load balancing scheduling instruction by using an improved ant colony algorithm includes:
[0070] According to the load rate, the execution time, and the response time, all feasible solutions of the improved ant colony algorithm are quickly non-dominated sorted to obtain an ant set of Pareto optimal solutions, wherein the ant set includes a target service instance that executes the in-vehicle application request;
[0071] Wherein, all feasible solutions of the improved ant colony algorithm are represented by pheromone matrix.
[0072] According to the above implementation steps, the embodiment of the present invention also introduces a fast non-dominated sorting genetic algorithm when generating load balancing scheduling instructions through the improved ant colony algorithm, that is, a multi-objective optimization idea based on the Pareto optimal concept, and uses a fast non-dominated sorting method to sort the available solutions, thereby reducing the time complexity of the algorithm and improving the convergence speed. Furthermore, by generating the Pareto frontier of the optimal solution to perform a global update of pheromones, the optimal solution can be found in the global solution after the improved ant colony algorithm iteratively calculates to the maximum number of iterations.
[0073] S4. When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm is updated to obtain an updated load balancing scheduling instruction.
[0074] It is conceivable that after obtaining the updated load balancing scheduling instruction, the target service instance is reselected to execute the in-vehicle application request based on the updated load balancing scheduling instruction.
[0075] It should be noted that the embodiments of the present invention communicate based on the vehicle Ethernet, which uses the SOME / IP protocol and serves the distributed system. Its server and client are in an irregular distribution mode, that is, any node in the vehicle Ethernet may be a server or a client, or even a server and a client at the same time. In addition, a client can find all online servers that provide this service content according to its service content and establish connections with them.
[0076] Based on this, after the load rate of the service instance is calculated regularly in step S1, a real-time load rate acquisition service can be provided. When executing step S3, the service can be accessed through RPC to obtain the load rate. Similarly, after the response time is obtained in step S2, a real-time response time acquisition service can be provided. When executing step S3, the service can be accessed through RPC to obtain the response time. As for step S4, by subscribing to the availability event group of the service end, when a certain service end goes offline, all clients that have established contact with it will receive event notifications, and when online service ends increase, the client can locate them through the SD mechanism, that is, the SOME / IP-SD mechanism.
[0077] In one embodiment, in the above step S4, when the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, updating the pheromone matrix used to generate the load balancing scheduling instruction by the improved ant colony algorithm includes:
[0078] When the client receives an unavailable event notification of any service instance, the column where the unavailable service instance is located in the pheromone matrix is deleted;
[0079] When a notification of a newly added service instance is received, the average pheromone value of each row in the pheromone matrix is obtained and allocated to the newly added service instance.
[0080] Through the above steps, the embodiment of the present invention proposes an adaptive mechanism based on pheromone prior knowledge to address the problem that load balancing scheduling based on the ant colony algorithm is only applicable to the scenario where the number of service containers remains unchanged. The mechanism uses the calculation results of the current improved ant colony algorithm as prior knowledge. When the number of service containers changes, the pheromone matrix is reconstructed several times to adapt to the change in the number of service containers.
[0081] The embodiment of the present invention also has practical application and describes the calculation process of the improved ant colony algorithm in detail. It is assumed that there are m providers of service s forming a service instance set SI = {S1, S2, S3, ... Sm}, and there are n tasks based on service s forming a task set T = {t1, t2, t3, ... tn}. Tasks and service instances are independent of each other and have no priority.
[0082] The embodiment of the present invention uses load rate, execution time and response time as constraints to modify the heuristic factor in the ant colony algorithm. Before iterative calculation based on the update of pheromone, the execution time, response time and load rate are used as fitness functions to calculate all feasible solutions of the improved ant colony algorithm. Among them, the execution time is calculated using the maximum completion time of all tasks in a task allocation combination, which is expressed as formula (1):
[0083] CT max=max{CT(t i ,S j )};
[0084] Among them, CT(t i ,S j ) represents the time when service instance j executes task i.
[0085] The response time is calculated using the average response time of all tasks in a task allocation combination, expressed as formula (2):
[0086]
[0087] Among them, RT(t i ,S j ) represents the time from when task i is sent to service instance j to when the result is received.
[0088] The load rate is calculated using the average load rate of all service instances in a task allocation combination, expressed as formula (3):
[0089]
[0090] Among them, LR j Represents the load rate of a single service instance j.
[0091] For all feasible solutions of the improved ant colony algorithm, assume that there are N ants participating in task allocation, and each ant allocates n tasks to m service instances, forming a feasible solution for task allocation. The probability that the kth ant allocates task i to service instance j is expressed as formula (4):
[0092]
[0093] Among them, η ij is the inspiration factor, τ ij is the pheromone concentration value on the path where task i is assigned to service instance j. α and β are the control coefficients of pheromone concentration and heuristic factor respectively. The larger the value of α or β, the greater the effect of pheromone concentration or heuristic factor on probability. The greater the importance. SI is a set of service instances.
[0094] The heuristic factor in the embodiment of the present invention is different from the calculation of the traditional heuristic factor. Generally, it is calculated by taking the time CT (t i ,S j ), but to achieve the optimization of the three goals of execution time, response time and load rate, the modification is made. Based on this, the calculation formula of the heuristic factor in the above formula is recorded as formula (5):
[0095]
[0096] The modified heuristic factor will make ants give priority to service instances with shorter execution time, faster response speed and lower load level.
[0097] The embodiment of the present invention updates the pheromone of the improved ant colony algorithm so that the algorithm can find the optimal solution in the global solution, that is, all feasible solutions after the maximum number of iterations. The pheromone update is divided into local update and global update.
[0098] For the local update of pheromone, after ant k completes the assignment of n tasks to m service instances, it obtains a path plan R k , the calculation formula of the pheromone left by ant k on path ij is expressed as formula (6):
[0099]
[0100] It can be seen from the formula that for a feasible solution consisting of a task assignment, the pheromone concentration left by ant k on the path plan is related to the maximum execution time and average response time of the task. The smaller the latter two are, the greater the pheromone concentration is.
[0101] After all ants have completed a task assignment, the pheromone concentration τ on the path ij is ij Perform local update, and the calculation formula is recorded as formula (7):
[0102]
[0103] Where ρ is the pheromone evaporation coefficient.
[0104] For the global update of pheromones, after all ants have completed a task assignment, all feasible solutions are quickly non-dominated sorted according to the three fitness functions to obtain the Pareto optimal solution. The Pareto optimal solution is the set of the best path solutions for this iteration. Let this set be P, and the path solution R k ∈P, the pheromone left by ant k on any path ij in the path scheme is expressed as formula (8):
[0105]
[0106] According to the obtained Pareto optimal solution, the pheromone concentration τ on the path ij is ij Perform global update, and the calculation formula is recorded as formula (9):
[0107]
[0108] Among them, σ is the global pheromone evaporation coefficient, and A is the set of ants that obtain the Pareto optimal solution.
[0109] In an embodiment of the present invention, all feasible solutions of the improved ant colony algorithm are represented by a pheromone matrix. Based on this, the embodiment of the present invention also uses practical application to explain in detail the implementation of the above step S4, that is, when the client receives an unavailable event notification of any service instance, or receives a notification of a new service instance, the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm is updated to obtain the updated load balancing scheduling instructions.
[0110] First, consider the independent service provider as a service container. The solution obtained by the load balancing scheduling method based on the ant colony algorithm is generally represented by an n×m pheromone matrix A, which is expressed as formula (10):
[0111]
[0112] Among them, τ ij represents the pheromone concentration of task i assigned to service container j. Substituting it into formula (4), we can get the probability of task i being assigned to service container j.
[0113] The pheromone matrix A is continuously updated during the iteration of the ant colony algorithm, and eventually an optimal solution is obtained. The load balancing scheduling method based on the ant colony algorithm performs task scheduling through the matrix and the heuristic factor. The shape of the pheromone matrix A is set during the initialization process of the ant colony algorithm and cannot be changed. Therefore, the load balancing scheduling method based on the ant colony algorithm does not have the robustness in the scenario where the number of service containers changes. Based on this problem, this patent designs an adaptive mechanism based on pheromone prior knowledge. When the number of service containers changes, the current pheromone matrix A is reconstructed several times, so that the load balancing scheduling method based on the ant colony algorithm has the ability to respond to changes in the number of service containers in real time.
[0114] Then, for one of the detailed implementations of step S4, when the client receives an unavailable event notification of any service instance, the column where the unavailable service instance is located in the pheromone matrix is deleted, which is actually manifested as a reduction in service containers. The detailed steps for deleting the column where the unavailable service instance is located in the pheromone matrix are:
[0115] Assume that service container j is offline, delete the column where service container j is located in the pheromone matrix A, and get the n×(m-1) pheromone matrix A1:
[0116]
[0117] Among them, 1 <j≤m。
[0118] For one of the detailed implementation manners of step S4, that is, when receiving the notification of the newly added service instance, obtaining the average pheromone value of each row in the pheromone matrix and allocating it to the newly added service instance, which is actually manifested as the increase of the service container. The detailed allocation steps are as follows:
[0119] Assume that the service container j goes online. Take the average pheromone value of each row and allocate it to the service container j to obtain a temporary pheromone matrix A of n×(m + 1). temp :
[0120]
[0121] Among them, 1 < m < j, and the pheromone τ of the i-th row and j-th column ij is calculated as follows:
[0122]
[0123] In the embodiment of the present invention, when the load rate of the service instance is greater than the average load rate, a penalty coefficient is set for the heuristic factor. Therefore, before the above step puts the pheromone matrix A temp into the load balancing scheduling, based on formula (5), a penalty coefficient ω ij is set for the heuristic factor η of the service container j j :
[0124]
[0125] Among them, 0 < ω j < 1. When the load rate of the service container j is greater than the average load rate, a penalty coefficient ω ij is set for the heuristic factor η j to prevent the service container j from having an excessively high load rate during the load balancing scheduling based on the temporary pheromone matrix A temp .
[0126] Suppose that during the load balancing scheduling based on the temporary pheromone matrix A temp , the actual average execution time of the service container s is CT avg (s), and the actual average response time is RT avg (s). Define the distance ΔD between two service containers i and j ij :
[0127] ΔD ij = |CT avg (i) - CT avg (j)| + |RT avg (i) - RT avg (j)|;
[0128] ΔD ijThe smaller the value is, the closer the service capabilities provided by service containers i and j are. Therefore, based on the pheromone matrix A, using the inverse distance weighted method, the known pheromones obtained through the iteration of the ant colony algorithm are used as prior knowledge to generate the pheromones of the newly added service container j, and a pheromone matrix A1 of n×(m + 1) is constructed:
[0129]
[0130] where 1 < m < j, and the pheromone τ ij in the i-th row and j-th column is calculated as follows:
[0131]
[0132] where ω is represents the weight of the pheromone τ is in the i-th row and s-th column, and is calculated as follows:
[0133]
[0134] where θ is the power value of the inverse distance, generally taking a positive real number, and 0.5 ≤ θ ≤ 3.
[0135] Meanwhile, before putting the pheromone matrix A1 into the load balancing scheduling, cancel the penalty coefficient ω ij set for the heuristic factor η j of the service container j.
[0136] As Figure 2 shown, an embodiment of the present invention provides a load balancing system 20 based on in-vehicle Ethernet, including a load level calculation module 21, an execution time recording module 22, a response time recording module 23, a load balancing scheduling analysis module 24, and a load balancing scheduling execution module 25;
[0137] The load level calculation module 21 is configured to calculate the load rate of the j-th service instance according to the CPU utilization rate and the memory utilization rate in the device where J service instances are running;
[0138] The execution time recording module 22 is configured to obtain the execution time for parsing the request data, calculating, and generating the response data after the j-th service instance receives the in-vehicle application request in the device where J service instances are running, where j is a positive integer less than or equal to J;
[0139] The response time recording module 23 is configured to obtain the response time of the in-vehicle application request in the device running at the client, where the response time is the time from when the in-vehicle application request is sent to when the client receives the response data;
[0140] The load balancing scheduling analysis module 24 is used to generate a load balancing scheduling instruction based on the load rate, execution time and response time by using an improved ant colony algorithm, so that the load balancing scheduling execution module of the client executes the load balancing scheduling instruction;
[0141] The device running the service instance and the device running the client are responsible for communicating with each other through any node of the vehicle Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle application request;
[0142] When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the load balancing scheduling execution module updates the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm to obtain updated load balancing scheduling instructions.
[0143] An embodiment of the present invention further provides a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the machine translation method described in the above embodiment is implemented.
[0144] An embodiment of the present invention further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, each step of the machine translation method described in the above embodiment is implemented.
[0145] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the foregoing embodiments describe the present invention in detail, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or replace some of the technical features therein by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A load balancing method based on vehicle-mounted Ethernet, characterized in that: include: In a device where J service instances are running, the following steps are included: S11. Calculate the load rate of the jth service instance according to the CPU utilization and memory utilization; S12, obtaining the execution time of parsing the request data, calculating and generating the response data after the j-th service instance receives the in-vehicle application request, where j is a positive integer less than or equal to J; In the device running on the client, the following steps are included: S21, obtaining the response time of the in-vehicle application request, where the response time is the time from when the in-vehicle application request is issued to when the client receives the response data; Based on the load rate, the execution time and the response time, a load balancing scheduling instruction is generated by an improved ant colony algorithm, so that the client executes the load balancing scheduling instruction; The device running the service instance and the device running the client are responsible for communicating with each other through any node of the vehicle Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle application request; When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instruction by the improved ant colony algorithm is updated to obtain an updated load balancing scheduling instruction; The improved ant colony algorithm comprises: Modify the heuristic factor, the formula is: Among them, CT(t i ,S j ) represents the execution time of service instance j for vehicle application request i, RT(t i ,S j ) represents the response time of service instance j to vehicle application request i, LR j Represents the load rate of a single service instance j, LR avg Indicates the average load rate of all service instances in a task allocation combination; Generate load balancing scheduling instructions by improving the ant colony algorithm, including: According to the load rate, the execution time, and the response time, all feasible solutions of the improved ant colony algorithm are quickly non-dominated sorted to obtain an ant set of Pareto optimal solutions, wherein the ant set includes a target service instance that executes the in-vehicle application request; Wherein, all feasible solutions of the improved ant colony algorithm are represented by pheromone matrix; When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm is updated, including: When the client receives an unavailable event notification of any service instance, the column where the unavailable service instance is located in the pheromone matrix is deleted; When a notification of a newly added service instance is received, the average pheromone value of each row in the pheromone matrix is obtained and allocated to the newly added service instance.
2. The load balancing method based on vehicle Ethernet according to claim 1, characterized in that: The load rate of the jth service instance is calculated based on the CPU utilization and memory utilization. The calculation formula is: LR j =α*Au j +β*Bu j Among them, Au j and Bu j They represent the CPU utilization and memory utilization of the device where the service instance j is located, respectively. α and β are influencing factors and α+β=1.
3. The load balancing method based on vehicle Ethernet according to claim 1, characterized in that: The storage structure of the execution time and the response time is a key-value pair array; Before generating the load balancing scheduling instruction, the execution time and the response time are serialized.
4. The load balancing method based on vehicle-mounted Ethernet according to claim 1, characterized in that: When the load rate of the service instance is greater than the average load rate, a penalty coefficient is set for the heuristic factor.
5. A load balancing system based on vehicle Ethernet, characterized in that: It includes a load level calculation module, an execution time recording module, a response time recording module, a load balancing scheduling analysis module and a load balancing scheduling execution module; The load level calculation module is used to calculate the load rate of the jth service instance according to the CPU utilization and the memory utilization in the device where J service instances are running; The execution time recording module is used to obtain the execution time of parsing request data, calculating and generating response data after the j-th service instance receives the vehicle application request in the device where J service instances are running, where j is a positive integer less than or equal to J; The response time recording module is used to obtain the response time of the in-vehicle application request in the device running on the client, and the response time is the time from the issuance of the in-vehicle application request to the receipt of the response data by the client; The load balancing scheduling analysis module is used to generate a load balancing scheduling instruction through an improved ant colony algorithm based on the load rate, execution time and response time, so that the load balancing scheduling execution module of the client executes the load balancing scheduling instruction; The device running the service instance and the device running the client are responsible for communicating with each other through any node of the vehicle Ethernet; the load balancing scheduling instruction is used to select a target service instance to execute the vehicle application request; When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the load balancing scheduling execution module updates the pheromone matrix used to generate the load balancing scheduling instruction by the improved ant colony algorithm, and obtains an updated load balancing scheduling instruction; The improved ant colony algorithm comprises: Modify the heuristic factor, the formula is: Among them, CT(t i ,S j ) represents the execution time of service instance j for vehicle application request i, RT(t i ,S j ) represents the response time of service instance j to vehicle application request i, LR j Represents the load rate of a single service instance j, LR avg Indicates the average load rate of all service instances in a task allocation combination; Generate load balancing scheduling instructions by improving the ant colony algorithm, including: According to the load rate, the execution time, and the response time, all feasible solutions of the improved ant colony algorithm are quickly non-dominated sorted to obtain an ant set of Pareto optimal solutions, wherein the ant set includes a target service instance that executes the in-vehicle application request; Wherein, all feasible solutions of the improved ant colony algorithm are represented by pheromone matrix; When the client receives an unavailable event notification of any service instance, or receives a notification of a newly added service instance, the pheromone matrix used to generate the load balancing scheduling instructions by the improved ant colony algorithm is updated, including: When the client receives an unavailable event notification of any service instance, the column where the unavailable service instance is located in the pheromone matrix is deleted; When a notification of a newly added service instance is received, the average pheromone value of each row in the pheromone matrix is obtained and allocated to the newly added service instance.
6. A terminal device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the machine translation method according to any one of claims 1 to 4 is implemented.
7. A storage medium, the storage medium being a computer-readable storage medium, on which a computer program is stored, characterized in that: When the computer program is executed by a processor, each step of the machine translation method according to any one of claims 1 to 4 is implemented.
