CN114979157B - Load balancing method, system, storage medium and computer based on SOME/IP protocol - Google Patents
Load balancing method, system, storage medium and computer based on SOME/IP protocol Download PDFInfo
- Publication number
- CN114979157B CN114979157B CN202210535561.6A CN202210535561A CN114979157B CN 114979157 B CN114979157 B CN 114979157B CN 202210535561 A CN202210535561 A CN 202210535561A CN 114979157 B CN114979157 B CN 114979157B
- Authority
- CN
- China
- Prior art keywords
- service
- service node
- weight value
- nodes
- list
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000012216 screening Methods 0.000 claims abstract description 15
- 238000004590 computer program Methods 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000004891 communication Methods 0.000 description 14
- 238000004422 calculation algorithm Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 230000006872 improvement Effects 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 230000003044 adaptive effect Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 239000002699 waste material Substances 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000011144 upstream manufacturing Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention provides a load balancing method, a system, a storage medium and a computer based on SOME/IP protocol, wherein the method comprises the following steps: when a service call request sent by a client is obtained, a service node list is obtained according to the service call request; comparing the priority values of the service nodes in the service node list, and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes; if yes, taking a plurality of service nodes with the same lowest priority value as a new service node list; and calculating the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by using the optimal service node. The invention can uniformly call the service nodes in a certain service cluster, and prevent the single service node from being distributed with too much or too little request flow, so that the service node is down in fault or wasted in performance.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a load balancing method, system, storage medium, and computer based on a SOME/IP protocol.
Background
With the development of intelligent network-connected automobiles, the intelligent automobile software architecture is changed from a traditional E/E architecture to a service-oriented architecture. The Service-oriented architecture (SOA) effectively solves the problems of difficult software development, high debugging difficulty, low code multiplexing rate and the like of the traditional E/E architecture. The method abstracts the code logic running on the automobile ECU into services and provides interfaces for service call outwards, so that other ECUs can conveniently and flexibly use the functions on the ECU, loose coupling among service applications is realized, the isomerism of software and hardware is shielded, the interoperability of a platform is improved, the multiplexing rate of software is increased, and the like.
The AUTOSAR self-adaptive platform (AUTOSAR Adaptive Platform, AP) is a novel automobile electronic system architecture standard proposed by the AUTOSAR alliance in 2015, provides a solution for the development of an on-board high-performance ECU, adopts a service-oriented architecture, and realizes service-oriented communication by using a SOME/IP (Scalable service-Oriented MiddlewarE over IP) protocol. SOME/IP is a standard protocol for service-oriented communications designed specifically for the automotive field. Compared with traditional bus protocols such as CAN, PROFIBUS and the like, SOME/IP has more dynamic flexibility and expandability, so that the SOME/IP CAN be used for realizing functions of vehicle-mounted diagnosis, information entertainment, even safety-related auxiliary driving and the like in an automobile.
At present, a plurality of ECUs are arranged on an automobile, and single or a plurality of ECUs are combined to provide a certain service function outwards, so that the ECUs are effectively managed based on a service-oriented architecture, and a distributed system of an on-board terminal is formed. Because of the large number of ECUs and complex service dependency, a complete service call link involves a plurality of upstream services and downstream services, and if a certain service is unavailable, the ECU on the link will be affected to execute tasks. In order to avoid the problem that a single ECU deploys a large number of service call requests to cause failure and downtime, the hot spot services are usually required to be laterally expanded, namely the same service is deployed on a plurality of different ECUs, a plurality of service instances of the same service are realized, and then a proper load balancing algorithm is selected to uniformly distribute the request flow to a plurality of ECUs for processing.
At present, although the load balancing technology is widely applied to the internet related industry, the load balancing technology is not widely popularized and used in the automobile field, and the following reasons are:
1. and no adaptive application layer protocol. The load balancing technology relies on an application layer protocol, such as Nginx uniformly distributes traffic accessing a Web server based on an HTTP protocol; the Dubbo service framework customizes application layer protocols on a TCP basis, providing other service governance related functions in addition to load balancing. The automobile field has just introduced ethernet technology, and has previously used the conventional bus protocol as an internal communication mode of the automobile.
2. Automobiles have higher requirements for safety and real-time performance. While SOA architecture is now the mainstay of automotive software architecture, relying on a load balancer to distribute calls to the appropriate ECU for each service call increases the communication time cost and also increases the risk of service call failure.
3. Automobile software development tools are expensive. Although the AUTOSAR Association has promulgated the AP and SOME/IP related design criteria outward, few companies have the ability to implement the criteria on the floor. Currently, VECTOR provides Adaptive MICROSAR development suite, ETAS and BOSCH together to push RTA-VRTE development tools, but because of the high purchase cost, developers are less and corresponding free community resources are scarce.
Disclosure of Invention
Based on this, an object of the present invention is to provide a load balancing method, system, storage medium and computer based on the SOME/IP protocol, so as to at least solve the above-mentioned drawbacks.
The invention provides a load balancing method based on SOME/IP protocol, which comprises the following steps:
when a service call request sent by a client is obtained, a corresponding service node list is obtained according to the service call request;
comparing the priority values of the service nodes in the service node list, and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes;
if a plurality of service nodes with the same lowest priority value exist in the service nodes, the service nodes with the same lowest priority value are used as a new service node list;
calculating the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by using the optimal service node.
Further, before the step of obtaining the service call request sent by the client, the method further includes:
and acquiring SOME/IP service providing messages sent by a plurality of service terminals when the service is released, and adding load balancing parameters corresponding to the service terminals in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance.
Further, before the step of obtaining the service call request sent by the client, the method further includes:
and acquiring SOME/IP service searching messages sent by a plurality of clients when searching for services, setting instance IDs in the SOME/IP service searching messages to a preset format, searching for all service instances of the service instance list within a preset range, and forming a corresponding service node list.
Further, the step of screening out the optimal service node in the new service node list according to the current weight value includes:
acquiring an initial weight value of each service node in the new service node list;
and superposing the current weight value of each service node in the new service node list and the initial weight value, and screening the service node with the maximum weight value as the optimal service node.
Further, the calculation formula of the weight value of the optimal service node is as follows:
CurrentWeight i +=OriginalWeight i ;
BestNode=Max(CurrentWeight i )→Node;
BestNode.CurrentWeight-=Sum(OriginalWeight i );
in the CurrentWeight i And origin weight i The current weight and the initial weight of the ith node are respectively represented, and the Bestnode represents the optimal service node.
The invention also provides a load balancing system based on the SOME/IP protocol, which comprises:
the first acquisition module is used for acquiring a corresponding service node list according to a service call request sent by a client when the service call request is acquired;
the judging module is used for comparing the priority values of the service nodes in the service node list and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes or not;
the processing module is used for taking the service nodes with the same lowest priority value as a new service node list if the service nodes with the same lowest priority value exist in the service nodes;
the computing module is used for computing the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by utilizing the optimal service node.
Further, the system further comprises:
the second acquisition module is used for acquiring SOME/IP service providing messages sent by a plurality of service ends when the service is released, and adding load balancing parameters corresponding to the service ends in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance.
Further, the system further comprises:
and the third acquisition module is used for acquiring SOME/IP service searching messages sent by the plurality of clients when searching for services, setting the instance ID in each SOME/IP service searching message into a preset format, searching for all the service instances of the service instance list within a preset range, and forming a corresponding service node list.
Further, the computing module includes:
an obtaining unit, configured to obtain an initial weight value of each service node in the new service node list;
and the calculating unit is used for superposing the current weight value of each service node in the new service node list and the initial weight value, and screening the service node with the largest weight value as the optimal service node.
The invention also proposes a storage medium on which a computer program is stored which, when executed by a processor, implements the load balancing method based on the SOME/IP protocol described above.
The invention also provides a computer, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the load balancing method based on the SOME/IP protocol is realized when the processor executes the computer program.
According to the SOME/IP protocol-based load balancing method, system, storage medium and computer, the optimal service node is selected according to the priority value by calling the corresponding service node list and comparing the priority values of the service nodes in the service node list, when a plurality of service nodes with the same lowest priority value exist in the service nodes, the current weight values of the service nodes with the same lowest priority value are calculated, and the optimal service node is selected according to the current weight values; by using the SOME/IP protocol as an application layer protocol between services and combining a smooth weighted polling algorithm, the load balancing is realized, so that the SOME/IP application can uniformly call the service nodes in a certain service cluster, excessive or insufficient request flow distributed to a single service node is prevented, and the service nodes are down in fault or waste in performance.
Drawings
Fig. 1 is a flowchart of a load balancing method based on the SOME/IP protocol according to a first embodiment of the present invention;
FIG. 2 is a detailed flowchart of step S104 in FIG. 1;
fig. 3 is a flowchart of a load balancing method based on the SOME/IP protocol according to a second embodiment of the present invention;
FIG. 4 is a flowchart of a service provider Server side and a service consumer Client side service publishing and subscribing process according to a second embodiment of the present invention;
FIG. 5 is a flowchart of a service call from a customer Client of a service consumer in a second embodiment of the present invention;
FIG. 6 is a diagram showing a comparison of the improvement of the VSOMEIP communication frame according to a second embodiment of the invention;
FIG. 7 is a diagram illustrating the operation of an analogous SWRR algorithm in a second embodiment of the invention;
fig. 8 is a block diagram of a load balancing system based on the SOME/IP protocol according to a third embodiment of the present invention;
fig. 9 is a block diagram showing the structure of a computer according to a fourth embodiment of the present invention.
Description of main reference numerals:
memory device | 10 | Judgment module | 12 |
Processor and method for controlling the same | 20 | Processing module | 13 |
Computer program | 30 | Calculation module | 14 |
First acquisition module | 11 |
The invention will be further described in the following detailed description in conjunction with the above-described figures.
Detailed Description
In order that the invention may be readily understood, a more complete description of the invention will be rendered by reference to the appended drawings. Several embodiments of the invention are presented in the figures. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "mounted" on another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like are used herein for illustrative purposes only.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items.
Firstly, it should be noted that the present invention aims to solve the problem that the load balancing technique is difficult to be applied to the SOA distributed system in the automotive field, and realize a load balancing technique based on the SOME/IP protocol and a smooth weighted polling algorithm, so as to effectively ensure the reliability and the high efficiency of the service.
Example 1
Referring to fig. 1, a load balancing method based on the SOME/IP protocol in a first embodiment of the present invention is shown, and the method specifically includes steps S101 to S104:
s101, when a service call request sent by a client is obtained, a corresponding service node list is obtained according to the service call request;
in the specific implementation, service-based communication is realized through an SOME/IP protocol, an open-source VSOMEIP communication frame is selected as a bottom communication component, source codes are modified and a load balancing function is added on the basis of the VSOMEIP, when a service call request sent by a client is obtained, a service call message sent by the client is received, and a service node list of the current request of the client is obtained according to the service call message;
it can be appreciated that the service node list can upload all node information in the service node list to the corresponding service registration center when the client searches for the service, so as to generate the service node list containing all node information of the client.
S102, comparing the priority values of the service nodes in the service node list, and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes;
in the specific implementation, after the service node list is obtained, the priority values of the service nodes in the service node list are compared by using the SWRR algorithm, whether a plurality of service nodes with the same lowest priority value exist in the priority values of the service nodes is judged, if a plurality of service nodes with the same lowest priority value do not exist in the priority values of the service nodes, the priority of the service nodes is calculated according to the priority values of the service nodes, the service node with the highest priority is used as the optimal service node of the request, and then service binding is carried out through the optimal service node.
S103, if a plurality of service nodes with the same lowest priority value exist in the service nodes, taking the service nodes with the same lowest priority value as a new service node list;
s104, calculating the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by utilizing the optimal service node.
Further, referring to fig. 2, the step S104 specifically includes steps S1041 to S1042:
s1041, obtaining an initial weight value of each service node in the new service node list;
s1042, superposing the current weight value of each service node in the new service node list and the initial weight value, and screening the service node with the largest weight value as the optimal service node.
In the implementation, if a plurality of service nodes with the same lowest priority value exist in each service node, the service nodes with the same lowest priority value are used as a new service node list, the initial weight value of each service node in the new service node list is obtained, the current weight value of each service node in the new service node list and the initial weight value are overlapped, the service node with the largest weight value is screened out to be used as an optimal service node, and then the optimal service node is used for carrying out service binding on the client.
The calculation formula of the weight value of the optimal service node is as follows:
CurrentWeight i +=OriginalWeight i ;
BestNode=Max(CurrentWeight i )→Node;
BestNode.CurrentWeight-=Sum(OriginalWeight i );
in the CurrentWeight i And origin weight i The current weight and the initial weight of the ith node are respectively represented, and the Bestnode represents the optimal service node.
In summary, in the load balancing method based on the SOME/IP protocol in the foregoing embodiment of the present invention, by calling a corresponding service node list, selecting an optimal service node according to a priority value of each service node in the comparison service node list, and when there are a plurality of service nodes with the same lowest priority value in each service node, calculating current weight values of a plurality of service nodes with the same lowest priority value, and selecting the optimal service node according to the current weight values; by using the SOME/IP protocol as an application layer protocol between services and combining a smooth weighted polling algorithm, the load balancing is realized, so that the SOME/IP application can uniformly call the service nodes in a certain service cluster, excessive or insufficient request flow distributed to a single service node is prevented, and the service nodes are down in fault or waste in performance.
Example two
Referring to fig. 3, a load balancing method based on the SOME/IP protocol according to a second embodiment of the present invention is shown, and the method specifically includes steps S201 to S206:
s201, acquiring SOME/IP service providing messages sent by a plurality of service terminals when releasing services, and adding load balancing parameters corresponding to the service terminals in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance;
s202, acquiring SOME/IP service searching messages sent by a plurality of clients when searching for services, setting instance IDs in the SOME/IP service searching messages to a preset format, searching for all service instances of the service instance list within a preset range, and forming a corresponding service node list;
s203, when a service call request sent by a client is obtained, obtaining the service node list according to the service call request;
s204, comparing the priority values of the service nodes in the service node list, and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes;
s205, if a plurality of service nodes with the same lowest priority value exist in the service nodes, the service nodes with the same lowest priority value are used as a new service node list;
s206, calculating the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by utilizing the optimal service node.
In a specific implementation, a Load Balancing Option (load balancing option) field is added in a SOME/IP-SD message of an office when a Service provider Server (Service end) issues a Service to a Service registry, so as to transmit the priority and weight value of the Service instance provided by the Service node. The method comprises the steps that when a Client side (Client side) of a Service consumer searches for a Service, an instance ID (instance ID) of an Entry in an SOME/IP-SD message of a Find Service is set to 0xFFFF, a corresponding Service instance list comprising a Service instance address, a priority, a weight value and the like is obtained from a Service registry, information is transmitted to a load balancer, and each time the Client side performs Service call, the load balancer selects an optimal node through a SWRR algorithm to perform Service binding and sends a call request. The Server and Client service publish-subscribe flow chart is shown in FIG. 4, and the Client service call flow chart is shown in FIG. 5.
Further, the format of Offer Service Entry in SOME/IP-SD OS is shown in Table 1 below:
TABLE 1
The format of IPv4 Endpoint Option in SOME/IP-SD OS is shown in Table 2 below:
TABLE 2
The format of Load Balancing Option in SOME/IP-SD OS is shown in Table 3 below:
TABLE 3 Table 3
In this embodiment, the service provider Server sends the SOME/IP-SD message containing Load Balancing Option field to release the service in UDP multicast mode. Specific information of a Server terminal Service Instance is added in the message, (Service ID, instance ID, IP Address, port, priority, weight) and the like, so that the Client terminal depending on the Service senses the existence of the Service Instance and stores the Service Instance information for the load balancer to use. Where the Priority and Weight values of Load Balancing Option are the necessary information for the load balancer to perform the SWRR algorithm. The Priority and Weight can be set to static values through configuration files, and can be dynamically adjusted according to the CPU and memory states of the ECU. The lower the Priority value, the higher the Priority, the higher the Weight value, and the greater the likelihood that the service instance will be selected.
Specifically, the format of Find Service Entry in SOME/IP-SD FS is shown in Table 4 below:
TABLE 4 Table 4
In this embodiment, the Client of the service consumer sends a SOME/IP-SD message to find the service through UDP multicast. The message is added with Service Instance information (Service ID, instance ID) required by the Client, wherein the Instance ID is set to 0xFFFF to indicate that the Client not only aims at a single Service Instance, but also searches all Service instances under the Service ID in the network range to form a Service node list for a load balancer to use, so that Service availability and reliability are improved.
In the embodiment, service-based communication is realized through an SOME/IP protocol, an open-source VSOMEIP communication frame is selected as a bottom communication component, and source codes are modified and a load balancing function is added on the basis of the VSOMEIP.
Specifically, the application program uses the interface provided by the vsome ip to implement simple functions such as service registration, service discovery, service request, service routing, and the like. The VSOMEIP shields the complex message packaging and analysis process of the bottom layer, so that an application program can dynamically sense the service existing in the network. The improved VSOMEIP also supports the construction of service clusters of the same service multiple instances, and the application program flexibly selects the service nodes to carry out service call through the load balancer. Before and after the vsome ip improvement, as shown in fig. 6, the application program must set the service instance ID in advance before the improvement, and when the service is called, only the corresponding Endpoint (communication port) can be selected to communicate with the service instance. After improvement, setting the service instance ID to 0xFFFF, and when the service is called, VSOMEIP dynamically selects an Endpoint through a load balancer to establish connection communication with a proper service instance.
Further, the Client of the Service consumer receives the Offer Service message and then stores the corresponding Service instance information. When initiating service call, the load balancer firstly selects the node with the lowest Priority value from the service node list, if a plurality of nodes have the same Priority value and the lowest Priority value, the SWRR algorithm is executed, and the optimal service instance is selected from the rest nodes.
The SWRR algorithm formula is as follows:
CurrentWeight i +=OriginalWeight i ;
BestNode=Max(CurrentWeight i )→Node;
BestNode.CurrentWeight-=Sum(OriginalWeight i );
in the CurrentWeight i And origin weight i The current weight and the initial weight of the ith node are respectively represented, and the Bestnode represents the optimal service node.
a. Adding currentWeight (current weight) to the original weight (initial weight) of each node in the list, where currentWeight is equal to the original weight at the beginning;
b. screening out the service node with the largest currentWeight from the list as the optimal node;
c. currentWeight of the optimal node minus the sum of the initial weights of all nodes.
Wherein the SWRR pseudo code is implemented as follows:
for example, referring to fig. 7, a simulated SWRR algorithm is shown, in this example, with three service nodes A, B, C listed, with initial weights of 6, 2, and 1, respectively. The algorithm resumes the current weight value of each node to the initial weight value at the end of run 9. In the first 9 running processes, the frequency of the node A being called is highest, and the time of the node A being called is not concentrated, so that the problem that the request is concentrated and inclined to a certain service node in a short time, which results in that the node is busy and other nodes are too idle, is avoided.
In summary, in the load balancing method based on the SOME/IP protocol in the foregoing embodiment of the present invention, by calling a corresponding service node list, selecting an optimal service node according to a priority value of each service node in the comparison service node list, and when there are a plurality of service nodes with the same lowest priority value in each service node, calculating current weight values of a plurality of service nodes with the same lowest priority value, and selecting the optimal service node according to the current weight values; by using the SOME/IP protocol as an application layer protocol between services and combining a smooth weighted polling algorithm, the load balancing is realized, so that the SOME/IP application can uniformly call the service nodes in a certain service cluster, excessive or insufficient request flow distributed to a single service node is prevented, and the service nodes are down in fault or waste in performance.
Example III
In another aspect, please refer to fig. 8, which shows a load balancing system based on the SOME/IP protocol in a third embodiment of the present invention, where the system includes:
the first obtaining module 11 is configured to obtain, when a service call request sent by a client is obtained, a corresponding service node list according to the service call request;
the judging module 12 is configured to compare priority values of the service nodes in the service node list, and judge whether a plurality of service nodes with the same lowest priority value exist in the service nodes;
a processing module 13, configured to take, if a plurality of service nodes with the same lowest priority value exist in the service nodes, the service nodes with the same lowest priority value as a new service node list;
the calculating module 14 is configured to calculate a current weight value of each service node in the new service node list, screen an optimal service node in the new service node list according to the current weight value, and perform service binding on the client by using the optimal service node.
Further, the computing module 14 includes:
an obtaining unit, configured to obtain an initial weight value of each service node in the new service node list;
and the calculating unit is used for superposing the current weight value of each service node in the new service node list and the initial weight value, and screening the service node with the largest weight value as the optimal service node.
In some alternative embodiments, the system further comprises:
the second acquisition module is used for acquiring SOME/IP service providing messages sent by a plurality of service ends when the service is released, and adding load balancing parameters corresponding to the service ends in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance.
In some alternative embodiments, the system further comprises:
and the third acquisition module is used for acquiring SOME/IP service searching messages sent by the plurality of clients when searching for services, setting the instance ID in each SOME/IP service searching message into a preset format, searching for all the service instances of the service instance list within a preset range, and forming a corresponding service node list.
The functions or operation steps implemented when the above modules and units are executed are substantially the same as those in the above method embodiments, and are not described herein again.
The load balancing system based on the SOME/IP protocol provided by the embodiment of the invention has the same implementation principle and technical effects as those of the embodiment of the method, and for the sake of brief description, the corresponding contents in the embodiment of the method can be referred to for the parts of the embodiment of the system which are not mentioned.
Example IV
The present invention also proposes a computer, referring to fig. 9, which shows a computer according to a fourth embodiment of the present invention, including a memory 10, a processor 20, and a computer program 30 stored in the memory 10 and capable of running on the processor 20, where the processor 20 implements the load balancing method based on the SOME/IP protocol when executing the computer program 30.
The memory 10 includes at least one type of storage medium including flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. Memory 10 may in some embodiments be an internal storage unit of a computer, such as a hard disk of the computer. The memory 10 may also be an external storage device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), etc. Further, the memory 10 may also include both internal storage units and external storage devices of the computer. The memory 10 may be used not only for storing application software installed in a computer and various types of data, but also for temporarily storing data that has been output or is to be output.
The processor 20 may be, in some embodiments, an electronic control unit (Electronic Control Unit, ECU), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chip, for executing program codes or processing data stored in the memory 10, such as executing an access restriction program, or the like.
It should be noted that the structure shown in fig. 9 does not constitute a limitation of the computer, and in other embodiments, the computer may include fewer or more components than shown, or may combine certain components, or may have a different arrangement of components.
The embodiment of the invention also provides a storage medium, on which a computer program is stored, which when being executed by a processor, implements the load balancing method based on the SOME/IP protocol.
Those of skill in the art will appreciate that the logic and/or steps represented in the flow diagrams or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.
Claims (5)
1. A method for load balancing based on a SOME/IP protocol, the method comprising:
when a service call request sent by a client is obtained, a corresponding service node list is obtained according to the service call request;
comparing the priority values of the service nodes in the service node list, and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes;
if a plurality of service nodes with the same lowest priority value exist in the service nodes, the service nodes with the same lowest priority value are used as a new service node list;
calculating the current weight value of each service node in the new service node list, screening out the optimal service node in the new service node list according to the current weight value, and carrying out service binding on the client by using the optimal service node, wherein the step of screening out the optimal service node in the new service node list according to the current weight value comprises the following steps:
acquiring an initial weight value of each service node in the new service node list;
superposing the current weight value and the initial weight value of each service node in the new service node list, and screening the service node with the maximum weight value as the optimal service node;
before the step of acquiring the service call request sent by the client, the method further comprises the following steps:
acquiring SOME/IP service providing messages sent by a plurality of service terminals when releasing services, and adding load balancing parameters corresponding to the service terminals in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance;
before the step of acquiring the service call request sent by the client, the method further comprises the following steps:
and acquiring SOME/IP service searching messages sent by a plurality of clients when searching for services, setting instance IDs in the SOME/IP service searching messages to a preset format, searching for all service instances of the service instance list within a preset range, and forming a corresponding service node list.
2. The load balancing method based on the SOME/IP protocol according to claim 1, wherein the calculation formula of the weight value of the optimal service node is:
CurrentWeight i +=OriginalWeight i ;
BestNode=Max(CurrentWeight i )→Node;
BestNode.CurrentWeight-=Sum(OriginalWeight i );
in the CurrentWeight i And OriginalWeight i The current weight and the initial weight of the ith node are respectively represented, and the Bestnode represents the optimal service node.
3. A system for load balancing based on a SOME/IP protocol, the system comprising:
the first acquisition module is used for acquiring a corresponding service node list according to a service call request sent by a client when the service call request is acquired;
the judging module is used for comparing the priority values of the service nodes in the service node list and judging whether a plurality of service nodes with the same lowest priority value exist in the service nodes or not;
the processing module is used for taking the service nodes with the same lowest priority value as a new service node list if the service nodes with the same lowest priority value exist in the service nodes;
the computing module is configured to compute a current weight value of each service node in the new service node list, screen an optimal service node in the new service node list according to the current weight value, and perform service binding on the client by using the optimal service node, where the computing module includes:
an obtaining unit, configured to obtain an initial weight value of each service node in the new service node list;
the computing unit is used for superposing the current weight value and the initial weight value of each service node in the new service node list, and screening the service node with the largest weight value as an optimal service node;
wherein the system further comprises:
the second acquisition module is used for acquiring SOME/IP service providing messages sent by a plurality of service terminals when the service is released, and adding load balancing parameters corresponding to the service terminals in the SOME/IP service providing messages to construct a corresponding service instance list, wherein the load balancing parameters comprise the priority of the service instance and the weight value of the service instance;
and the third acquisition module is used for acquiring SOME/IP service searching messages sent by the plurality of clients when searching for services, setting the instance ID in each SOME/IP service searching message into a preset format, searching for all the service instances of the service instance list within a preset range, and forming a corresponding service node list.
4. A storage medium having stored thereon a computer program which, when executed by a processor, implements a load balancing method based on the SOME/IP protocol as claimed in any one of claims 1 to 2.
5. A computer comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a load balancing method based on the SOME/IP protocol as claimed in any one of claims 1 to 2 when executing the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210535561.6A CN114979157B (en) | 2022-05-17 | 2022-05-17 | Load balancing method, system, storage medium and computer based on SOME/IP protocol |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210535561.6A CN114979157B (en) | 2022-05-17 | 2022-05-17 | Load balancing method, system, storage medium and computer based on SOME/IP protocol |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114979157A CN114979157A (en) | 2022-08-30 |
CN114979157B true CN114979157B (en) | 2024-03-22 |
Family
ID=82983367
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210535561.6A Active CN114979157B (en) | 2022-05-17 | 2022-05-17 | Load balancing method, system, storage medium and computer based on SOME/IP protocol |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114979157B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116319505A (en) * | 2023-02-10 | 2023-06-23 | 安芯网盾(北京)科技有限公司 | Route distribution method and device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110740164A (en) * | 2019-09-04 | 2020-01-31 | 无锡华云数据技术服务有限公司 | Server determination method, regulation and control method, device, equipment and storage medium |
CN112948104A (en) * | 2019-12-11 | 2021-06-11 | 中盈优创资讯科技有限公司 | Load balancing data acquisition method and device |
CN113765966A (en) * | 2020-09-01 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Load balancing method and device |
CN113824795A (en) * | 2021-10-21 | 2021-12-21 | 上海波顿诺华智能科技有限公司 | Communication method, device and system of vehicle end and cloud end |
CN113934512A (en) * | 2021-10-21 | 2022-01-14 | 平安国际智慧城市科技股份有限公司 | Load balancing implementation method, device, equipment and storage medium |
CN114095445A (en) * | 2020-07-29 | 2022-02-25 | 华人运通(上海)自动驾驶科技有限公司 | Data transmission control method and device for vehicle-mounted Ethernet, electronic equipment and storage medium |
CN114157666A (en) * | 2021-10-25 | 2022-03-08 | 北京千方科技股份有限公司 | Load balancing system, method, medium and device based on intelligent cloud platform |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10284487B2 (en) * | 2014-04-25 | 2019-05-07 | Paypal, Inc. | Software load balancer to maximize utilization |
US20200192898A1 (en) * | 2018-12-14 | 2020-06-18 | Amazon Technologies, Inc. | Multi-tenant storage for analytics with push down filtering |
-
2022
- 2022-05-17 CN CN202210535561.6A patent/CN114979157B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110740164A (en) * | 2019-09-04 | 2020-01-31 | 无锡华云数据技术服务有限公司 | Server determination method, regulation and control method, device, equipment and storage medium |
CN112948104A (en) * | 2019-12-11 | 2021-06-11 | 中盈优创资讯科技有限公司 | Load balancing data acquisition method and device |
CN114095445A (en) * | 2020-07-29 | 2022-02-25 | 华人运通(上海)自动驾驶科技有限公司 | Data transmission control method and device for vehicle-mounted Ethernet, electronic equipment and storage medium |
CN113765966A (en) * | 2020-09-01 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Load balancing method and device |
CN113824795A (en) * | 2021-10-21 | 2021-12-21 | 上海波顿诺华智能科技有限公司 | Communication method, device and system of vehicle end and cloud end |
CN113934512A (en) * | 2021-10-21 | 2022-01-14 | 平安国际智慧城市科技股份有限公司 | Load balancing implementation method, device, equipment and storage medium |
CN114157666A (en) * | 2021-10-25 | 2022-03-08 | 北京千方科技股份有限公司 | Load balancing system, method, medium and device based on intelligent cloud platform |
Non-Patent Citations (3)
Title |
---|
一种服务器/均衡器合作式集群体系的结构;吴欢欢, 万晓冬;科技广场(06);全文 * |
基于SOME/IP的整车电气通信网络设计研究;李阳春;;汽车文摘(08);全文 * |
基于服务的车载以太网研究与开发;郭灿;崔根群;唐风敏;;现代电子技术(05);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN114979157A (en) | 2022-08-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020093500A1 (en) | Intelligent scheduling method, terminal device, edge node cluster and intelligent scheduling system | |
CN112055091B (en) | Vehicle-mounted micro-service architecture, and communication method and device of vehicle-mounted module | |
CN112367233B (en) | Vehicle-mounted network ECU communication method and device based on service-oriented architecture | |
CN110557357B (en) | Remote procedure call protocol self-adaption method, related device and server | |
US10681184B2 (en) | Method and device for transmitting a message in a vehicle | |
US20240045657A1 (en) | System architecture for implementing dds communication based on autosar, communication method, and device | |
WO2022061804A1 (en) | Data transmission system, data transmission method, smart vehicle and device | |
CN108632299A (en) | Enhance method, apparatus, electronic equipment and the storage medium of registration center's availability | |
CN113824795B (en) | Communication method, device and system of vehicle end and cloud end | |
CN106790059B (en) | Service calling method and system for cloud system of smart television L aunch | |
CN113434249A (en) | Mirror image synchronization method and device, docker host and storage medium | |
CN114979157B (en) | Load balancing method, system, storage medium and computer based on SOME/IP protocol | |
CN114189525A (en) | Service request method and device and electronic equipment | |
CN113220484A (en) | Micro-service calling method and device, electronic equipment and storage medium | |
CN114363233B (en) | Packet routing method, device, electronic equipment and storage medium | |
Neumann et al. | Approaches for in-vehicle communication–an analysis and outlook | |
CN109271259B (en) | Enterprise service bus system, data processing method, terminal and storage medium | |
CN108111630B (en) | Zookeeper cluster system and connection method and system thereof | |
CN110995829A (en) | Instance calling method and device and computer storage medium | |
CN115562872A (en) | High-concurrency SOME/IP protocol stack server implementation method | |
WO2014031044A1 (en) | Method and node for enabling automatic deployment of resource components | |
CN114374714A (en) | Construction method, topological structure and storage medium of centralized automobile electronic and electrical architecture | |
CN114461424A (en) | Inter-unit service discovery method, device and system under unitized deployment architecture | |
CN112968825A (en) | Message sending method, device, equipment and storage medium | |
CN115913809B (en) | Data distribution communication method, system, computer device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |