Message transmission method, device and system
The proxy server converts the source address of the message, so that the load balancer can perform load shunt based on the source address of the original message, solving the problem of load imbalance in the proxy server and achieving better load balancing and stability.
Patent Information
- Application Number
- CN202510139065.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2045-02-08
AI Technical Summary
In the presence of a proxy server, the load balancer cannot effectively perform load shunting based on the source address of the message, resulting in load imbalance.
The source address of the received message is converted into a new message including the message body, the public source address and the original source address through the proxy server. The load balancer determines the receiving device from multiple receiving devices based on the source address of the original message and sends a new message.
In the case of a proxy server, packet transmission is realized based on a load balancer, avoiding the situation of packet diversion to the same receiving device, and improving the load balance and stability of the receiving device.
Smart Images

Figure CN119603237A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a message transmission method, device and system. Background Art
[0002] As the system business becomes increasingly complex, the business traffic of the system is also increasing exponentially; in order to ensure the load balancing of the back-end servers (i.e., the receiving devices of the messages) of the system, the sending device needs to send the message to the load balancer, and the load balancer will divert the business traffic (or business message) of the system to different back-end servers. However, the way that the sending device sends the message directly to the load balancer will expose the source address of the message (i.e., the intranet address of the message), which poses a security problem; to solve the security problem, a common processing method is to use a proxy server to convert the source addresses of the messages sent by different sending devices into the same public address, and then the proxy server sends the converted message to the load balancer.
[0003] However, since the source addresses of the messages received by the load balancer from the proxy server are all the public addresses, when the load balancer performs load balancing based on the source addresses of the received messages, the load balancer will divert all messages to the same backend server, resulting in a load imbalance problem. Therefore, in the presence of a proxy server, how to perform message transmission based on a load balancer has become a technical problem that needs to be solved urgently in this field. Summary of the invention
[0004] The present application provides a message transmission method, device and system, which can realize message transmission based on a load balancer in the presence of a proxy server.
[0005] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0006] In a first aspect, an embodiment of the present application provides a message transmission method, which is applied to a message transmission system, the system comprising: multiple sending devices, a proxy server, a load balancer and multiple receiving devices; wherein, the multiple sending devices have a communication link with the load balancer through the proxy server, and the load balancer has a communication link with the multiple receiving devices; the method comprises: a first sending device sends a first message to the proxy server; the multiple sending devices comprise: a first sending device, the first message is a message to be sent to the receiving device; the source address of the first message is used to indicate the first sending device; the proxy server receives the first message and converts the first message into a second message; the second message comprises a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; the load balancer receives the second message sent by the proxy server, and determines the first receiving device from the multiple receiving devices based on the source address of the first message included in the second message; and sends the second message to the first receiving device.
[0007] The embodiment of the present application provides a message transmission method, which converts a first message sent by a first sending device received by a proxy server into a second message including a message body of the first message, a source address of the second message and the source address of the first message, so that the load balancer determines the first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and sends the second message to the first receiving device. Although the source address of the second message is used to indicate the public address of the proxy server, the source address of the first message included in the second message is used to point to the first sending device; since the source addresses of the first messages sent by different sending devices are different, the load balancer determines the first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0008] In addition, since the source addresses of the first messages sent by different sending devices are different, the load balancer will not divert the messages sent by different sending devices to the same receiving device when performing load diversion based on the source address of the first message, thereby improving the load balancing of the receiving device.
[0009] In one possible implementation, the source address of the first message is carried in a source address field in the first message, and the first message is converted into a second message, including: the proxy server replaces the source address of the first message in the source address field with a public address, and adds the source address of the first message to the target field in the first message to obtain the second message.
[0010] In a possible implementation manner, the target field is a reserved field or a newly added field in the first message.
[0011] In an embodiment of the present application, a proxy server is used to replace the source address of the first message in the source address field of the first message with a public address, and the source address of the first message is added to the target field in the first message to obtain a second message; since the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0012] In one possible implementation, the source address of the first message is carried in a source address field in the first message. Before the first sending device sends the first message to the proxy server, the method includes: the first sending device adds the source address of the first message in a reserved field or a newly added field in the first message; the above-mentioned conversion of the first message into the second message includes: the proxy server replaces the source address of the first message in the above-mentioned source address field with a public address to obtain a second message.
[0013] In an embodiment of the present application, a first sending device adds the source address of a first message to a reserved field or a newly added field in the first message, and replaces the source address of the first message in the source address field of the first message with a public address based on a proxy server to obtain a second message. Since the source address of the first message exists in the reserved field or the newly added field in the second message, and the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0014] In one possible implementation, the above-mentioned determining the first receiving device from multiple receiving devices based on the source address of the first message included in the second message includes: the load balancer obtains the source address of the first message from the second message; the above-mentioned load balancer determines the first receiving device from multiple receiving devices based on the hash value of the source address of the first message.
[0015] The load balancer in the embodiment of the present application performs a modulo operation based on the hash value of the source address of the first message and the number of multiple receiving devices to obtain a modulo result; and determines the receiving device whose device identifier corresponds to the modulo result among the multiple receiving devices as the first receiving device. Since the hash value of the source address of each sending device is fixed, the modulo result obtained by performing a modulo operation based on the hash value and the number of multiple receiving devices is also fixed; then, each message sent by each sending device is diverted to the same receiving device each time; thereby solving the problem that when the message sent by the same sending device is diverted to different receiving devices, the authentication information of the sending device does not exist in other receiving devices among the multiple receiving devices except the receiving device that processes the authentication message of the sending device, which causes other receiving devices to be unable to process the message sent by the sending device, thereby improving the stability of the message transmission system.
[0016] In one possible implementation, the load balancer determines the first receiving device from multiple receiving devices based on the hash value of the source address of the first message, including: the load balancer performs a modulo operation on the hash value and the number of multiple receiving devices to obtain a modulo result; the load balancer determines the receiving device whose device identifier among the multiple receiving devices corresponds to the modulo result as the first receiving device.
[0017] In one possible implementation, the multiple receiving devices include receiving devices in different receiving groups, each receiving group including at least one receiving device; before determining the first receiving device from the multiple receiving devices based on the hash value of the source address of the first message, the method also includes: the load balancer determines the target receiving group corresponding to the bandwidth level of the second message from the multiple receiving groups; wherein different receiving groups correspond to different bandwidth levels; the determining the first receiving device from the multiple receiving devices based on the hash value of the source address of the first message includes: the load balancer determines the first receiving device from the receiving devices included in the target receiving group based on the hash value of the source address of the first message.
[0018] The embodiment of the present application divides multiple receiving devices into different receiving groups according to the bandwidth size (i.e., bandwidth level) of the messages they process; then, after the load balancer receives the second message, it determines the target receiving group corresponding to the bandwidth level of the second message from the different receiving groups; then, based on the hash value of the source address of the first message, it determines the first receiving device from the target receiving group. This avoids the problem of downtime of the receiving device caused by diverting messages with a higher bandwidth level to a receiving device with fewer resources, thereby improving the stability of the receiving device.
[0019] In addition, since the bandwidth levels corresponding to the multiple receiving groups are different, the target receiving groups determined by the messages of different bandwidth levels (such as the second message) are different. After determining the target receiving group, the load balancer determines the first receiving device from the receiving devices included in the target receiving group based on the source address of the sending device indicating the sending of the message (such as the source address of the first message), and sends the message to the first receiving device; thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0020] In one possible implementation, the above-mentioned second message also includes a bandwidth level of the second message, and the bandwidth level of the second message is used to indicate the bandwidth size of the first message. Before the load balancer determines the target receiving group corresponding to the bandwidth level of the second message from multiple receiving groups, the method also includes: the load balancer obtains the bandwidth level of the second message from the second message.
[0021] In a possible implementation, when the multiple receiving groups include: a first receiving group, a second receiving group, and a third receiving group, the load balancer determines, from the multiple receiving groups, a target receiving group corresponding to the bandwidth level of the second message, including: when the bandwidth level of the second message is lower than a first preset level, the load balancer determines the first receiving group as the target receiving group; when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, the load balancer determines the first receiving group and the second receiving group as the target receiving groups; when the bandwidth level of the second message is higher than the second preset level, the load balancer determines the first receiving group, the second receiving group, and the third receiving group as the target receiving groups.
[0022] In the embodiment of the present application, the above-mentioned multiple receiving groups include the first receiving group to the third receiving group. When the bandwidth level of the second message is lower than the first preset level, the first receiving group is determined as the target receiving group; when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, the first receiving group and the second receiving group are determined as the target receiving groups; when the bandwidth level of the second message is higher than the second preset level, the first receiving group, the second receiving group and the third receiving group are determined as the target receiving groups. It can be seen that the higher the bandwidth level of the second message, the more receiving devices are included in the target receiving group determined by the load balancer; that is, the higher the bandwidth level of the second message, the more options are determined for determining the first receiving device; thereby avoiding the problem that the receiving device processing the high-bandwidth message cannot use other receiving devices to process the high-bandwidth message when the available resources are insufficient, thereby improving the load balancing of the receiving device.
[0023] In a second aspect, an embodiment of the present application provides a message transmission method, which is applied to a first sending device in a message transmission system, and the method includes: adding the source address of the first message in the target field of the first message to be sent; the first message is a message to be sent to a receiving device; sending the first message to a proxy server; the proxy server is used to convert the source address of the first message carried by the source address field in the first message into a public address to obtain a second message; the public address is used to indicate the proxy server.
[0024] In a possible implementation manner, the target field is a reserved field or a newly added field in the first message.
[0025] In an embodiment of the present application, a first sending device adds the source address of a first message to a reserved field or a newly added field in the first message, and replaces the source address of the first message in the source address field of the first message with a public address based on a proxy server to obtain a second message. Since the source address of the first message exists in the reserved field or the newly added field in the second message, and the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0026] In a third aspect, an embodiment of the present application provides a message transmission method, which is applied to a proxy server in a message transmission system, and the method includes: receiving a first message sent by a first sending device among multiple sending devices; the first message is a message to be sent to a receiving device; converting the first message into a second message; the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; sending a second message to a load balancer; the load balancer is used to determine a first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and send the second message to the first receiving device.
[0027] In one possible implementation, the source address of the first message is carried in a source address field in the first message, and the first message is converted into a second message, including: replacing the source address of the first message in the source address field with a public address, and adding the source address of the first message to a reserved field or a newly added field in the first message to obtain a second message.
[0028] In an embodiment of the present application, a proxy server is used to replace the source address of the first message in the source address field of the first message with a public address, and the source address of the first message is added to the target field in the first message to obtain a second message; since the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0029] In a fourth aspect, an embodiment of the present application provides a message transmission method, which is applied to a load balancer in a message transmission system, and the method includes: receiving a second message sent by a proxy server, the second message including a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; determining a target receiving group corresponding to a bandwidth level of the second message from a plurality of receiving groups; wherein different receiving groups correspond to different bandwidth levels, and each of the plurality of receiving groups includes at least one receiving device; based on a hash value of the source address of the first message, determining a first receiving device from the receiving devices included in the target receiving group, and sending the second message to the first receiving device.
[0030] The embodiment of the present application divides multiple receiving devices into different receiving groups according to the bandwidth size (i.e., bandwidth level) of the messages they process; then, after the load balancer receives the second message, it determines the target receiving group corresponding to the bandwidth level of the second message from the different receiving groups; then, based on the hash value of the source address of the first message, it determines the first receiving device from the target receiving group. This avoids the problem of downtime of the receiving device caused by diverting messages with a higher bandwidth level to a receiving device with fewer resources, thereby improving the stability of the receiving device.
[0031] In addition, since the bandwidth levels corresponding to the multiple receiving groups are different, the target receiving groups determined by the messages of different bandwidth levels (such as the second message) are different. After determining the target receiving group, the load balancer determines the first receiving device from the receiving devices included in the target receiving group based on the source address of the sending device indicating the sending of the message (such as the source address of the first message), and sends the message to the first receiving device; thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0032] In one possible implementation, the above-mentioned second message also includes a bandwidth level of the second message, and the bandwidth level of the second message is used to indicate the bandwidth size of the first message. Before determining the target receiving group corresponding to the bandwidth level of the second message from multiple receiving groups, the method also includes: the load balancer obtains the bandwidth level of the second message from the second message.
[0033] In a possible implementation, when the above-mentioned multiple receiving groups include: a first receiving group, a second receiving group and a third receiving group, a target receiving group corresponding to the bandwidth level of the second message is determined from the multiple receiving groups, including: when the bandwidth level of the second message is lower than a first preset level, the first receiving group is determined as the target receiving group; when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, the first receiving group and the second receiving group are determined as the target receiving groups; when the bandwidth level of the second message is higher than the second preset level, the first receiving group, the second receiving group and the third receiving group are determined as the target receiving groups.
[0034] In the embodiment of the present application, the above-mentioned multiple receiving groups include the first receiving group to the third receiving group. When the bandwidth level of the second message is lower than the first preset level, the first receiving group is determined as the target receiving group; when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, the first receiving group and the second receiving group are determined as the target receiving groups; when the bandwidth level of the second message is higher than the second preset level, the first receiving group, the second receiving group and the third receiving group are determined as the target receiving groups. It can be seen that the higher the bandwidth level of the second message, the more receiving devices are included in the target receiving group determined by the load balancer; that is, the higher the bandwidth level of the second message, the more options are determined for determining the first receiving device; thereby avoiding the problem that the receiving device processing the high-bandwidth message cannot use other receiving devices to process the high-bandwidth message when the available resources are insufficient, thereby improving the load balancing of the receiving device.
[0035] In a possible implementation, the above-mentioned hash value based on the source address of the first message determines the first receiving device from the receiving devices included in the target receiving group, including: performing a modulo operation on the hash value and the number of multiple receiving devices included in the target receiving group to obtain a modulo result; and determining the receiving device whose device identifier among the multiple receiving devices corresponds to the modulo result as the first receiving device.
[0036] In the fifth aspect, an embodiment of the present application provides a message transmission device, which is applied to a first sending device in a message transmission system, and the message transmission device includes: a processing module and a transceiver module; the processing module is used to add the source address of the first message in the target field of the first message to be sent; the first message is a message to be sent to a receiving device; the transceiver module is used to send the first message to a proxy server; the proxy server is used to convert the source address of the first message carried by the source address field in the first message into a public address to obtain a second message; the public address is used to indicate the proxy server.
[0037] In the sixth aspect, an embodiment of the present application provides a message transmission device, which is applied to a proxy server in a message transmission system, and the message transmission device includes: a transceiver module and a processing module; the transceiver module is used to receive a first message sent by a first sending device among multiple sending devices; the first message is a message to be sent to a receiving device; the processing module is used to convert the first message into a second message; the second message includes a message body of the first message, a source address of the second message and the source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; the transceiver module is also used to send a second message to a load balancer; the load balancer is used to determine a first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and send the second message to the first receiving device.
[0038] In the seventh aspect, an embodiment of the present application provides a message transmission device, which is applied to a load balancer in a message transmission system, and the message transmission device includes: a transceiver module and a processing module; the transceiver module is used to receive a second message sent by a proxy server, the second message includes a message body of the first message, a source address of the second message and the source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; the processing module is used to determine a target receiving group corresponding to the bandwidth level of the second message from multiple receiving groups; wherein different receiving groups correspond to different bandwidth levels, and each of the multiple receiving groups includes at least one receiving device; the processing module is used to determine a first receiving device from the receiving devices included in the target receiving group based on a hash value of the source address of the first message, and send the second message to the first receiving device.
[0039] In an eighth aspect, an embodiment of the present application provides a message transmission system, which includes: multiple sending devices, a proxy server, a load balancer and multiple receiving devices; wherein, there is a communication link between the multiple sending devices and the load balancer through the proxy server, and there is a communication link between the load balancer and the multiple receiving devices; a first sending device, used to send a first message to the proxy server; the multiple sending devices include: a first sending device, the first message is a message to be sent to the receiving device; the source address of the first message is used to indicate the first sending device; the proxy server, used to receive the first message and convert the first message into a second message; the second message includes the message body of the first message, the source address of the second message and the source address of the first message; the source address of the second message is used to indicate the public address of the proxy server; the load balancer, used to receive the second message sent by the proxy server, and based on the source address of the first message included in the second message, determine the first receiving device from the multiple receiving devices; and send the second message to the first receiving device.
[0040] In a ninth aspect, an embodiment of the present application provides a computing device, comprising a memory and at least one processor connected to the memory, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the computer instructions are executed by at least one processor, the computing device executes the method described in any one of the first to fourth aspects and their possible implementation methods.
[0041] In a tenth aspect, an embodiment of the present application provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on a computer, the method of any one of the first to fourth aspects and their possible implementation methods is executed.
[0042] In the eleventh aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are run on a computer, the method described in any one of the first to fourth aspects and their possible implementation methods is executed.
[0043] It should be understood that the beneficial effects achieved by the technical solutions of the first to fourth aspects of the present application and the corresponding possible implementation methods can be referred to the above-mentioned technical effects of the first to fourth aspects and their corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a message transmission system provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application;
[0046] Figure 3 One of the flow charts of a message transmission method provided in an embodiment of the present application;
[0047] Figure 4 A second flow chart of a message transmission method provided in an embodiment of the present application;
[0048] Figure 5 A third flow chart of a message transmission method provided in an embodiment of the present application;
[0049] Figure 6 A fourth flow chart of a message transmission method provided in an embodiment of the present application;
[0050] Figure 7 A fifth flow chart of a message transmission method provided in an embodiment of the present application;
[0051] Figure 8 A sixth flow chart of a message transmission method provided in an embodiment of the present application;
[0052] Fig. 9 A schematic diagram of the structure of a message transmission device provided in an embodiment of the present application;
[0053] Fig.10 A schematic diagram of the structure of another message transmission device provided in an embodiment of the present application;
[0054] Fig.11 A schematic diagram of the structure of another message transmission device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0056] The terms "first message" and "second message" in the description and claims of the embodiments of the present application are used to distinguish different messages, rather than to describe a specific order of messages. For example, a first receiving device and a second receiving device are used to distinguish different receiving devices, rather than to describe a specific order of receiving devices.
[0057] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0058] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple sending devices refers to two or more sending devices.
[0059] Based on the technical problem of how to perform message transmission based on a load balancer in the presence of a proxy server raised in the background technology, an embodiment of the present application provides a message transmission method, which converts a first message sent by a first sending device received by a proxy server into a second message including a message body of the first message, a source address of the second message and the source address of the first message, so that the load balancer determines the first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and sends the second message to the first receiving device. Although the source address of the second message is used to indicate the public address of the proxy server, the source address of the first message included in the second message is used to point to the first sending device; since the source addresses of the first messages sent by different sending devices are different, the load balancer determines the first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of performing message transmission based on a load balancer in the presence of a proxy server.
[0060] In addition, since the source addresses of the first messages sent by different sending devices are different, the load balancer will not divert the messages sent by different sending devices to the same receiving device when performing load diversion based on the source address of the first message, thereby improving the load balancing of the receiving device.
[0061] A message transmission method provided in an embodiment of the present application is applied to Figure 1 The message transmission system shown in the figure includes: multiple sending devices (such as sending device 1 to sending device X), a proxy server, a load balancer, and multiple receiving devices (such as receiving device 1 to receiving device N). In the present application, multiple sending devices in the message transmission system have communication links with the load balancer through the proxy server, and there are communication links between the load balancer and multiple receiving devices.
[0062] Any sending device among the multiple sending devices (eg, the first sending device) can be used to send a message to the load balancer through the proxy server; wherein the source address of the message is used to indicate the sending device that sends the message.
[0063] The proxy server is used to receive a message (hereinafter referred to as the first message) sent by a sending device, and convert the first message into a second message including: a message body of the first message, a source address of the second message, and the source address of the first message; wherein the source address of the second message is a public address used to indicate the proxy server, and the source address of the first message is used to indicate the sending device that sent the first message. The proxy server is also used to send the second message to the load balancer.
[0064] The load balancer is used to obtain the source address of the first message included in the second message by parsing the second message, and based on the source address of the first message, determine the first receiving device that receives the second message from multiple receiving devices. The load balancer is also used to send the second message to the first receiving device.
[0065] In this application, Figure 1 The multiple sending devices and the proxy server in the message transmission system shown can be integrated in the same computing device, or they can be independent computing devices; accordingly, the proxy server and the load balancer can be integrated in the same computing device, or they can be independent computing devices; similarly, the load balancer and the multiple receiving devices can be integrated in the same computing device, or they can be independent computing devices; the specific embodiments of the present application are not Figure 1 The representation of multiple sending devices, proxy servers, load balancers, and multiple receiving devices is limited.
[0066] For example, Figure 2 Can be Figure 1 The hardware structure diagram of a computing device of any one of the sending device, proxy server, load balancer and receiving device shown in the figure; the computing device may include: a processor 201, a memory 202 and a communication interface 203. The processor 201, the memory 202 and the communication interface 203 may be connected to each other via a bus 204, or in other ways.
[0067] The processor 201 includes one or more CPUs. The CPU may be a single-core CPU (single-CPU) or a multi-core CPU (multi-CPU). Optionally, the processor 201 may also include a graphics processing unit (GPU), a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), etc.
[0068] The memory 202 includes, but is not limited to, random access memory (RAM), read only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, or optical memory, magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions, operating systems or data structures and can be accessed by a computer.
[0069] In a possible implementation, the memory 202 may exist independently of the processor 201. The memory 202 may be connected to the processor 201 via a bus 204 and used to store data, instructions, or program codes. When the processor 201 calls and executes the instructions or program codes stored in the memory 202, the relevant steps in the message transmission method provided in the embodiment of the present application can be implemented.
[0070] In another possible implementation, the memory 202 may also be integrated with the processor 201 .
[0071] The communication interface 203 may be a transceiver module, used to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc. The communication interface 203 may receive instructions, messages or data, etc.
[0072] Optionally, the communication interface 203 may also be a transceiver circuit located in the processor 201, for implementing signal input and signal output of the processor 201. The communication interface 203 may be a wired interface (port), such as a fiber distributed data interface (FDDI) or a gigabit Ethernet (GE) interface, or the communication interface 203 may also be a wireless interface.
[0073] The bus 204 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus may also be divided into a serial bus and a parallel bus. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0074] It should be understood that Figure 2 The computing device in the example is only one example of a computing device, which may have Figure 2 More or fewer components shown in the figure may be combined with two or more components, or may have different component configurations. For example, the computing device may also include a smart network card, such as a data processing unit (DPU).
[0075] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0076] The present invention provides a method for transmitting a message. Figure 1 The message transmission system shown in FIG. Figure 3 As shown, the method includes: S110-S130.
[0077] S110. A first sending device sends a first message to a proxy server.
[0078] In this application, the first sending device is Figure 1 Any sending device among the multiple sending devices in the message transmission system shown.
[0079] In the present application, the first message is a message generated by a first sending device and to be sent to a receiving device.
[0080] Among them, the first message may include a message header and a message body, the message header may include five-tuple information, the five-tuple information may include the protocol version number, source address, destination address, port number of the source address and port number of the destination address; the message body includes the data or information to be sent by the first message.
[0081] The source address of the first message is the source address in the five-tuple information of the first message; wherein the source address of the first message is used to indicate the first sending device that sends the first message.
[0082] Specifically, the source address of the first message can be an Internet Protocol address (IP address) of the first sending device, or it can be a combination of the IP address of the first sending device and the port number of the port in the first sending device that sends the first message. The specific embodiment of the present application does not limit the specific form of the source address of the above-mentioned first message.
[0083] In the present application, the first message can be a notification message that sends a notification to the receiving device, or it can be a request message that triggers the receiving device to perform business processing. In the case where the first message is a notification message, the message body carries a notification message / notification information, and the notification message / notification information can be used to notify the receiving device to perform business processing, but the receiving device does not return the execution result to the sending device. In the case where the first message is a request message, the message body carries a request message / request information, and the request message / request information can be used to request the receiving device to perform business processing; after the receiving device performs the business processing, the execution result needs to be sent to the sending device. The embodiment of the present application does not specifically limit the type of the first message.
[0084] In the present application, the implementation method of S110 includes: the first sending device sends the first message to the proxy server through the communication link between the first sending device and the proxy server.
[0085] S120: The proxy server receives the first message, and converts the first message into a second message.
[0086] In the present application, the format of the second message is the same as that of the first message. The second message may also include a message header, a message body and the source address of the first message. The message header of the second message may include a five-tuple of information. The five-tuple information of the second message includes: the source address of the second message, the destination address, the protocol version number, the port number of the source address of the second message and the port number of the destination address; the message body of the second message includes: the message body of the first message is the same; wherein, the message body of the second message or the message header of the second message also includes the source address of the first message; thus, the second message includes: the message body of the first message, the source address of the second message and the source address of the first message.
[0087] In the present application, the source address of the second message is used to indicate the public address of the proxy server, and the source addresses of the messages sent by different sending devices obtained after conversion by the proxy server are all the public address.
[0088] Specifically, the source address of the second message, i.e., the shared address, can be the IP address of the proxy server, or a combination of the IP address of the proxy server and the port number of the target port in the proxy server. The target port is the port through which the proxy server subsequently sends the second message to the load balancer; the specific embodiment of the present application does not limit the specific form of the above-mentioned public address.
[0089] The source address of the first message in the second message is carried in the target field in the second message, and the target field is a reserved field (such as a "reserve" field) or a newly added field in the second message. The source address of the first message may be added to the second message by the proxy server, or may be the source address of the first message backed up in the first message by the first sending device before sending the first message. Specifically, the embodiment of the present application does not limit the source of the source address of the first message in the second message.
[0090] In the case where the source address of the first message in the second message is added to the second message by the proxy server, the specific implementation of S120 refers to S120A in the following embodiment, which will not be described again here.
[0091] When the source address of the first message in the second message is the source address of the first message that the first sending device backed up in the first message before sending the first message, the specific implementation method of S120 refers to S230 in the following embodiment and is not repeated here.
[0092] S130. The load balancer receives a second message sent by the proxy server, and based on the source address of the first message included in the second message, determines a first receiving device from multiple receiving devices; and sends the second message to the first receiving device.
[0093] In one implementation, S130 is implemented as follows: Figure 4 As shown, including: S130A-S130D.
[0094] S130A: The load balancer receives a second message sent by the proxy server.
[0095] In the present application, the implementation method of S130A includes: the load balancer receives the second message sent by the proxy server through the communication link (referred to as: the first communication link) between the load balancer and the proxy server; accordingly, after the above S120, the proxy server sends the second message to the load balancer through the first communication link.
[0096] S130B. The load balancer obtains the source address of the first message from the second message.
[0097] The implementation method of S130B in the present application includes: the load balancer obtains the source address of the first message from the target field in the second message by parsing the second message.
[0098] S130C: The load balancer determines a first receiving device from multiple receiving devices based on a hash value of the source address of the first message.
[0099] The implementation method of S130C of the present application includes: the load balancer determines the hash value of the source address of the first message; then, based on the hash value and the number of multiple receiving devices, a modulo operation is performed to obtain a modulo result; finally, the receiving device whose device identifier among the multiple receiving devices corresponds to the modulo result is determined as the first receiving device.
[0100] The receiving device whose device identifier corresponds to the modulo result among the multiple receiving devices in the present application can be a receiving device whose device identifier is equal to the modulo result, or it can be the interval where the modulo result to which the device identifier belongs is located. The specific embodiment of the present application does not limit the correspondence between the device identifier and the modulo result.
[0101] For example, assuming that the hash value of the source address of the first message is 610529590177173682324, Figure 1 In the case where the message transmission system shown includes 7 receiving devices, then, based on 610529590177173682324 modulo 7, the modulo result obtained is 2. Then, the load balancer determines the receiving device whose device identifier (or device number) is equal to the modulo result 2 among the 7 receiving devices as the first receiving device.
[0102] Optionally, when the device identifier in the present application is a string or non-data, S130 also includes converting the device identifier into a device number based on a preset algorithm. The preset algorithm can be a remainder algorithm or a modulus algorithm, and the present embodiment does not specifically limit the preset algorithm.
[0103] S130D: The load balancer sends the second message to the first receiving device.
[0104] In the present application, the implementation method of S130D includes: the load balancer sends a second message to the first receiving device based on the communication link between the load balancer and the first receiving device (referred to as: second communication link); accordingly, the first receiving device receives the second message sent by the load balancer through the second communication link.
[0105] The load balancer in the embodiment of the present application performs a modulo operation based on the hash value of the source address of the first message and the number of multiple receiving devices to obtain a modulo result; and determines the receiving device whose device identifier corresponds to the modulo result among the multiple receiving devices as the first receiving device. Since the hash value of the source address of each sending device is fixed, the modulo result obtained by performing a modulo operation based on the hash value and the number of multiple receiving devices is also fixed; then, each message sent by each sending device is diverted to the same receiving device each time; thereby solving the problem that when the message sent by the same sending device is diverted to different receiving devices, the authentication information of the sending device does not exist in other receiving devices among the multiple receiving devices except the receiving device that processes the authentication message of the sending device, which causes other receiving devices to be unable to process the message sent by the sending device, thereby improving the stability of the message transmission system.
[0106] In another implementation, when there are a large number of receiving devices, in order to improve the efficiency of determining the first receiving device, the multiple receiving devices can be divided into different receiving groups, that is, the multiple receiving devices include receiving devices in different receiving groups, and the multiple receiving devices are devices in different receiving groups, and each receiving group includes at least one receiving device. In this scenario, the implementation method of S130 of the present application includes: based on the bandwidth level of the second message, determining the target receiving group corresponding to the bandwidth level of the second message from different receiving groups; then, based on the source address of the first message, determining the first receiving device from the receiving devices included in the target receiving group; for the specific implementation, refer to S310-S360 below, which will not be repeated here.
[0107] The embodiment of the present application provides a message transmission method, which converts a first message sent by a first sending device received by a proxy server into a second message including a message body of the first message, a source address of the second message and the source address of the first message, so that the load balancer determines the first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and sends the second message to the first receiving device. Although the source address of the second message is used to indicate the public address of the proxy server, the source address of the first message included in the second message is used to point to the first sending device; since the source addresses of the first messages sent by different sending devices are different, the load balancer determines the first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0108] In addition, since the source addresses of the first messages sent by different sending devices are different, the load balancer will not divert the messages sent by different sending devices to the same receiving device when performing load diversion based on the source address of the first message, thereby improving the load balancing of the receiving device.
[0109] In the case where the proxy server adds the source address of the first message to the second message, based on Figure 3 or Figure 4 ,like Figure 5 The implementation method of S120 in the present application includes: S120A.
[0110] S120A: The proxy server replaces the source address of the first message in the source address field of the first message with the public address, and adds the source address of the first message to the target field in the first message to obtain a second message.
[0111] In the present application, the source address field of a message is a field used to carry the source address in the five-tuple information of the message; that is, the source address of the first message is carried in the source address field in the first message.
[0112] In the present application, the target field is a reserved field or a newly added field in the first message; wherein, the target field can be located in the message body of the first message or in the message header of the first message; the specific embodiment of the present application does not limit the position of the target field in the first message.
[0113] The second message obtained by S120A has the same format as the first message. The second message may also include a message header, a message body and the source address of the first message. The message header of the second message may include five-tuple information. The five-tuple information of the second message includes: the source address of the second message, the destination address, the protocol version number, the port number of the source address of the second message and the port number of the destination address.
[0114] The message body of the second message includes: the message body of the first message is the same; the source address of the second message is the public address carried in the source address field of the first message; the destination address, protocol version number, port number of the source address of the second message and the port number of the destination address in the five-tuple information of the second message are the same as the destination address, protocol version number, port number of the source address and the port number of the destination address in the five-tuple information of the first message.
[0115] The location of the target field in the second message that carries the source address of the first message may be in the message header of the second message or in the second message body; the specific embodiment of the present application does not limit the location of the target field.
[0116] Exemplarily, assume that the source address field is the "IP" field, and the target field is the "reserve" field; and assume that the source address of the first message is address A; and the public address is address B. Then, the proxy server replaces the field value of the "IP" field in the first message from address A to address B; and sets the field value of the "reserve" field in the first message to address A, thereby obtaining the updated first message, i.e., the second message in the present application.
[0117] In an embodiment of the present application, a proxy server is used to replace the source address of the first message in the source address field of the first message with a public address, and the source address of the first message is added to the target field in the first message to obtain a second message; since the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0118] based on Figure 3 or Figure 4 , the present application embodiment provides a specific implementation method, such as Figure 6 The method shown includes: S210-S260.
[0119] S210. The first sending device adds a source address of the first message in a reserved field or a newly added field in the first message.
[0120] It should be understood that before the first sending device executes S210, the source address field in the first message carries the source address of the first message; so after the first sending device adds the source address of the first message in the reserved field or the newly added field (i.e., the target field) in the first message, the source address field and the target field in the added first message both carry the source address of the first message.
[0121] The target field may be a field in the message body of the first message, or a field in the message header of the first message; specifically, the embodiment of the present application does not limit the position of the target field in the first message.
[0122] The implementation method of the above S210 is similar to the implementation method of adding the source address of the first message to the target field in the first message in S120A. For the specific description of S210, please refer to the above related description of S120A, which will not be repeated here.
[0123] S220. The first sending device sends a first message to the proxy server.
[0124] The implementation method of the above S220 is consistent with the implementation method of S110. For the specific description of S220, please refer to the above related description of S110, which will not be repeated here.
[0125] S230. The proxy server replaces the source address of the first message in the source address field of the first message with the public address to obtain a second message.
[0126] It should be understood that the source address field and the target field in the first message received by the proxy server both carry the source address of the first message; so after the proxy server replaces the source address of the first message in the source address field in the first message with the public address, the target field in the updated first message (i.e., the second message) also carries the source address of the first message; then, the second message includes the source address of the first message.
[0127] The implementation method of the above S230 is consistent with the implementation method in which the proxy server in S120A replaces the source address of the first message in the source address field of the first message with a public address. For the specific description of S230, please refer to the above description of S120A, which will not be repeated here.
[0128] S240: The load balancer receives a second message sent by the proxy server.
[0129] S250. The load balancer determines a first receiving device from a plurality of receiving devices based on the source address of the first message included in the second message.
[0130] S260. The load balancer sends the second message to the first receiving device.
[0131] The implementation method of the above S240 is consistent with the implementation method of S130. For the specific description of S240, please refer to the above related description of S130, which will not be repeated here.
[0132] In an embodiment of the present application, a first sending device adds the source address of a first message to a reserved field or a newly added field in the first message, and replaces the source address of the first message in the source address field of the first message with a public address based on a proxy server to obtain a second message. Since the source address of the first message exists in the reserved field or the newly added field in the second message, and the source addresses of the first messages sent by different sending devices are different, the subsequent load balancer determines the above-mentioned first receiving device based on the source address of the first message, and sends the second message to the first receiving device, thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0133] exist Figure 1The multiple receiving devices in the message transmission system shown are receiving devices in different receiving groups (ie, the multiple receiving devices are receiving devices in different receiving groups), and each receiving group includes at least one receiving device. Figure 3 , Figure 5 to Figure 6 The implementation method of S130 of the present application is as follows Figure 7 As shown, it also includes: S310-S360.
[0134] S310. The load balancer receives a second message sent by the proxy server.
[0135] S320. The load balancer obtains the source address of the first message from the second message.
[0136] The implementation method of the above S310-S320 is consistent with the implementation method of S130A-S130B. For the specific description of S310-S320, please refer to the above related description of S130A-S130B, which will not be repeated here.
[0137] S330: The load balancer obtains the bandwidth level of the second message.
[0138] In the present application, the bandwidth level of a message is used to indicate the bandwidth size of the message. For example, the bandwidth level of a second message is used to indicate the bandwidth size of the second message.
[0139] Specifically, the bandwidth level of the message can be directly the bandwidth size of the message, or it can be a processing result obtained after processing the bandwidth size of the message based on a preset algorithm. The embodiment of the present application does not specifically limit the relationship between the bandwidth level and the bandwidth size.
[0140] It should be understood that in the present application, the second message is obtained by replacing the source address of the first message in the source address field of the first message with a public address (ie, converting), so the bandwidth level of the second message is the same as the bandwidth level of the first message.
[0141] In the present application, the bandwidth level of the message may be preset or determined based on the bandwidth size of the message. The specific embodiment of the present application does not limit the method for determining the bandwidth level of the message.
[0142] In the case where the bandwidth level of the second message is preset, the implementation method of S330 includes: the load balancer obtains the bandwidth level of the second message from the second message; wherein the bandwidth level of the second message may be the preset bandwidth level of the first message added by the first sending device in a designated field (such as the "bw" field) in the first message before the first sending device sends the first message; or may be the preset bandwidth level of the first message added by the proxy server in a designated field in the first message during the execution of S120.
[0143] It should be understood that in the implementation of S330 above, the user needs to pre-configure the bandwidth level for each service message or each message sent by the sending device, so that the sending device or the proxy server adds the pre-configured bandwidth level for the message in the message.
[0144] In the case of determining the bandwidth level of the second message based on the bandwidth size of the second message, the implementation method of S330 includes: the load balancer obtains the bandwidth size of the second message, and determines the bandwidth level corresponding to the bandwidth size of the second message in the correspondence between the bandwidth size and the bandwidth level as the bandwidth level of the second message.
[0145] S340. The load balancer determines a target receiving group corresponding to the bandwidth level of the second message from multiple receiving groups.
[0146] In the present application, different receiving groups correspond to different bandwidth levels; for example, when the above-mentioned multiple receiving groups include: a first receiving group and a second receiving group, the bandwidth level corresponding to the first receiving group is different from the bandwidth level corresponding to the second receiving group.
[0147] In the present application, each of the multiple receiving groups may correspond to a bandwidth level interval including multiple bandwidth levels (i.e., the receiving group corresponds to the bandwidth level interval), or each receiving group may correspond to one bandwidth level (i.e., the receiving group corresponds to the bandwidth level); the specific embodiments of the present application do not limit the correspondence between the receiving group and the bandwidth level.
[0148] When each receiving group corresponds to a bandwidth level interval, the implementation method of S340 includes: determining the receiving group corresponding to the bandwidth level interval to which the bandwidth level of the second message belongs as the target receiving group; the specific implementation method is shown in the following S341-S345 and will not be repeated here.
[0149] In the case that each receiving group corresponds to a bandwidth level, the implementation method of S340 includes: determining a receiving group among the multiple receiving groups whose corresponding bandwidth level is the same as the bandwidth level of the second message as a target receiving group.
[0150] Exemplarily, assume that the multiple receiving groups include: a first receiving group, a second receiving group and a third receiving group, wherein the bandwidth level corresponding to the first receiving group is bandwidth level one, the bandwidth level corresponding to the second receiving group is bandwidth level two, and the bandwidth level corresponding to the third receiving group is bandwidth level three; then, when the bandwidth level of the second message is bandwidth level one, the first receiving group is determined as the target receiving group; when the bandwidth level of the second message is bandwidth level two, the second receiving group is determined as the target receiving group; when the bandwidth level of the second message is bandwidth level three, the third receiving group is determined as the target receiving group.
[0151] The above-mentioned load balancer may execute S320 first and then execute S330-S340; or it may execute S330-S340 first and then execute S320. Specifically, the embodiment of the present application does not limit the execution order of S320 and S330-S340.
[0152] S350. The load balancer determines a first receiving device from receiving devices included in the target receiving group based on a hash value of the source address of the first message.
[0153] The implementation method of the above S350 is similar to the implementation method of S130C. For the specific description of S350, please refer to the above related description of S130C, which will not be repeated here.
[0154] S360. The load balancer sends the second message to the first receiving device.
[0155] The implementation method of the above S360 is consistent with the implementation method of S130D. For the specific description of S360, please refer to the above related description of S130D, which will not be repeated here.
[0156] The embodiment of the present application divides multiple receiving devices into different receiving groups according to the bandwidth size (i.e., bandwidth level) of the messages they process; then, after the load balancer receives the second message, it determines the target receiving group corresponding to the bandwidth level of the second message from the different receiving groups; then, based on the hash value of the source address of the first message, it determines the first receiving device from the target receiving group. This avoids the problem of downtime of the receiving device caused by diverting messages with a higher bandwidth level to a receiving device with fewer resources, thereby improving the stability of the receiving device.
[0157] In addition, since the bandwidth levels corresponding to the multiple receiving groups are different, the target receiving groups determined by the messages of different bandwidth levels (such as the second message) are different. After determining the target receiving group, the load balancer determines the first receiving device from the receiving devices included in the target receiving group based on the source address of the sending device indicating the sending of the message (such as the source address of the first message), and sends the message to the first receiving device; thereby realizing the function of message transmission based on the load balancer in the presence of a proxy server.
[0158] For ease of description, the embodiment of the present application is described by taking a case where multiple receiving groups include: a first receiving group, a second receiving group, and a third receiving group as an example, and no further details will be given later.
[0159] In the case where each receiving group corresponds to a bandwidth level interval, combined with Figure 7 , the implementation of S340 is as follows Figure 8 Shown include: S341-S345.
[0160] S341. The load balancer determines whether the bandwidth level of the second message is lower than the first preset level.
[0161] Exemplarily, assuming that the first preset level is bandwidth level three; then, when the bandwidth level of the second message is bandwidth level two or bandwidth level one, the bandwidth level of the second message is lower than the first preset level; when the bandwidth level of the second message is bandwidth level four, the bandwidth level of the second message is higher than the first preset level.
[0162] When the bandwidth level of the second message is lower than the first preset level, the load balancer executes the following S342.
[0163] When the bandwidth level of the second message is higher than the first preset level, the load balancer executes the following S343.
[0164] When the bandwidth level of the second message is equal to the first preset level, the load balancer can execute the following S342 or the following S343. Specifically, the embodiment of the present application does not limit the action performed by the load balancer when the bandwidth level of the second message is equal to the first preset level.
[0165] S342. The load balancer determines the first receiving group as the target receiving group.
[0166] Exemplarily, based on the example in S341, assume that the first receiving group includes: receiving device 1, receiving device 2, and receiving device 3; then, when the bandwidth level of the second message is bandwidth level 2 or bandwidth level 1, the load balancer determines the first receiving group as the target receiving group, which includes: receiving device 1, receiving device 2, and receiving device 3.
[0167] S343: The load balancer determines whether the bandwidth level of the second message is lower than a second preset level.
[0168] Exemplarily, assume that the second preset level is bandwidth level six; then, when the bandwidth level of the second message is bandwidth level five, the bandwidth level of the second message is lower than the second preset level; when the bandwidth level of the second message is bandwidth level eight, the bandwidth level of the second message is higher than the second preset level.
[0169] When the bandwidth level of the second message is lower than the second preset level, the load balancer executes the following S344.
[0170] When the bandwidth level of the second message is higher than the second preset level, the load balancer executes the following S345.
[0171] When the bandwidth level of the second message is equal to the second preset level, the load balancer can execute the following S344 or the following S345. Specifically, the embodiment of the present application does not limit the action performed by the load balancer when the bandwidth level of the second message is equal to the second preset level.
[0172] S344. The load balancer determines the first receiving group and the second receiving group as target receiving groups.
[0173] Exemplarily, based on the example in S343, assume that the first receiving group includes: receiving device 1, receiving device 2 and receiving device 3; the second receiving group includes: receiving device 4, receiving device 5 and receiving device 6; then, when the bandwidth level of the second message is bandwidth level five, the load balancer determines the first receiving group and the second receiving group as target receiving groups; wherein, the target receiving group includes: receiving device 1 to receiving device 6.
[0174] S345. The load balancer determines the first receiving group, the second receiving group, and the third receiving group as target receiving groups.
[0175] Exemplarily, based on the example in S343, assume that the first receiving group includes: receiving device 1 to receiving device 3, the second receiving group includes: receiving device 4 to receiving device 6, and the third receiving group includes: receiving device 7 to receiving device 9; then, when the bandwidth level of the second message is bandwidth level eight, the load balancer determines the first receiving group, the second receiving group and the third receiving group as target receiving groups; wherein, the target receiving group includes: receiving device 1 to receiving device 9.
[0176] In the embodiment of the present application, the above-mentioned multiple receiving groups include the first receiving group to the third receiving group. When the bandwidth level of the second message is lower than the first preset level, the first receiving group is determined as the target receiving group; when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, the first receiving group and the second receiving group are determined as the target receiving groups; when the bandwidth level of the second message is higher than the second preset level, the first receiving group, the second receiving group and the third receiving group are determined as the target receiving groups. It can be seen that the higher the bandwidth level of the second message, the more receiving devices are included in the target receiving group determined by the load balancer; that is, the higher the bandwidth level of the second message, the more options are determined for determining the first receiving device; thereby avoiding the problem that the receiving device processing the high-bandwidth message cannot use other receiving devices to process the high-bandwidth message when the available resources are insufficient, thereby improving the load balancing of the receiving device.
[0177] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the message transmission device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0178] The embodiment of the present application can divide the functional modules of the message transmission device according to the above method. For example, the message transmission device can include various functional modules corresponding to the various functional divisions, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0179] In the case of dividing each functional module into corresponding functional modules, Fig. 9 A possible structural diagram of the message transmission apparatus 100 involved in the above embodiment is shown. The message transmission apparatus 100 is deployed in a first sending device, and the message transmission apparatus 100 includes: a processing module 910 and a transceiver module 920 .
[0180] The processing module 910 is used to add the source address of the first message to the target field of the first message to be sent; for example, executing step S210 in the above method embodiment.
[0181] The transceiver module 920 is used to send the first message to the proxy server; for example, execute step S220 in the above method embodiment.
[0182] Optionally, the target field is a reserved field or a newly added field in the first message.
[0183] In the case of dividing each functional module into corresponding functional modules, Fig.10 A possible structural diagram of the message transmission device 200 involved in the above embodiment is shown. The message transmission device 200 is deployed in a proxy server, and the message transmission device 200 includes: a transceiver module 1010 and a processing module 1020 .
[0184] The transceiver module 1010 is used to receive a first message sent by a first sending device among multiple sending devices; for example, execute step S110 in the above method embodiment.
[0185] The processing module 1020 is used to convert the first message into the second message; for example, execute step S120 in the above method embodiment.
[0186] The transceiver module 1010 is used to send a second message to the load balancer; for example, execute step S130A in the above method embodiment.
[0187] Optionally, processing module 1020 is used to replace the source address of the first message in the source address field with a public address, and add the source address of the first message to a reserved field or a newly added field in the first message to obtain a second message; for example, executing step S120A in the above method embodiment.
[0188] In the case of dividing each functional module into corresponding functional modules, Fig.11 A possible structural diagram of the message transmission device 300 involved in the above embodiment is shown. The message transmission device 300 is deployed in a load balancer, and includes: a transceiver module 1110 and a processing module 1120 .
[0189] The transceiver module 1110 is used to receive the second message sent by the proxy server; for example, execute step S310 in the above method embodiment.
[0190] The processing module 1120 is used to determine, from multiple receiving groups, a target receiving group corresponding to the bandwidth level of the second message; for example, executing step S340 in the above method embodiment.
[0191] The processing module 1120 is used to determine the first receiving device from the receiving devices included in the target receiving group based on the hash value of the source address of the first message; for example, execute step S350 in the above method embodiment.
[0192] The transceiver module 1110 is used to send the second message to the first receiving device; for example, execute step S360 in the above method embodiment.
[0193] Optionally, the transceiver module 1110 is configured to obtain a bandwidth level of the second message from the second message; for example, executing step S330 in the above method embodiment.
[0194] Optionally, the processing module 1120 is used to determine the first receiving group as the target receiving group when the bandwidth level of the second message is lower than the first preset level; wherein the above-mentioned multiple receiving groups include: a first receiving group, a second receiving group and a third receiving group; for example, executing steps S341-S342 in the above-mentioned method embodiment.
[0195] The processing module 1120 is used to determine the first receiving group and the second receiving group as target receiving groups when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level; for example, execute steps S343-S344 in the above method embodiment.
[0196] The processing module 1120 is used to determine the first receiving group, the second receiving group and the third receiving group as target receiving groups when the bandwidth level of the second message is higher than the second preset level; for example, execute steps S343 and S345 in the above method embodiment.
[0197] Optionally, the processing module 1120 is used to perform a modulo operation on the hash value and the number of multiple receiving devices included in the target receiving group to obtain a modulo result;
[0198] The processing module 1120 is used to determine a receiving device whose device identifier corresponds to the modulo result among the multiple receiving devices as the first receiving device.
[0199] An embodiment of the present application provides a message transmission system, the message transmission system, the system includes: multiple sending devices, a proxy server, a load balancer and multiple receiving devices; wherein, there is a communication link between the multiple sending devices and the load balancer through the proxy server, and there is a communication link between the load balancer and the multiple receiving devices; a first sending device, used to send a first message to the proxy server; the multiple sending devices include: a first sending device, the first message is a message to be sent to the receiving device; the source address of the first message is used to indicate the first sending device; the proxy server, used to receive the first message and convert the first message into a second message; the second message includes the message body of the first message, the source address of the second message and the source address of the first message; the source address of the second message is used to indicate the public address of the proxy server; the load balancer, used to receive the second message sent by the proxy server, and based on the source address of the first message included in the second message, determine the first receiving device from the multiple receiving devices; and send the second message to the first receiving device.
[0200] An embodiment of the present application provides a computing device, including a memory and at least one processor connected to the memory, the memory being used to store computer program code, the computer program code including computer instructions, and when the computer instructions are executed by at least one processor, the computing device executes the method described in the first sending device, the proxy server, or the load balancer.
[0201] An embodiment of the present application provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on a computer, the method described in the first sending device, the proxy server or the load balancer is executed.
[0202] An embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed on a computer, the method described in the first sending device, the proxy server or the load balancer is executed.
[0203] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)), etc.
[0204] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0205] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0206] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0207] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0208] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program codes.
[0209] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A message transmission method, characterized in that: The method is applied to a message transmission system, the system comprising: a plurality of sending devices, a proxy server, a load balancer and a plurality of receiving devices; wherein the plurality of sending devices have a communication link with the load balancer through the proxy server, and the load balancer has a communication link with the plurality of receiving devices; the method comprises: A first sending device sends a first message to the proxy server; the multiple sending devices include: the first sending device, the first message is a message to be sent to a receiving device; the source address of the first message is used to indicate the first sending device; The proxy server receives the first message and converts the first message into a second message; the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; The load balancer receives the second message sent by the proxy server, and based on the source address of the first message included in the second message, determines a first receiving device from the multiple receiving devices; and sends the second message to the first receiving device.
2. The method according to claim 1, characterized in that The source address of the first message is carried in a source address field in the first message, and the converting the first message into a second message includes: The proxy server replaces the source address of the first message in the source address field with the public address, and adds the source address of the first message in the target field in the first message to obtain the second message.
3. The method according to claim 2, characterized in that The target field is a reserved field or a newly added field in the first message.
4. The method according to claim 1, characterized in that: The source address of the first message is carried in a source address field in the first message. Before the first sending device sends the first message to the proxy server, the method includes: The first sending device adds the source address of the first message in a reserved field or a newly added field in the first message; The converting the first message into a second message includes: The proxy server replaces the source address of the first message in the source address field with the public address to obtain the second message.
5. The method according to any one of claims 1 to 4, characterized in that: The determining the first receiving device from the multiple receiving devices based on the source address of the first message included in the second message includes: The load balancer obtains the source address of the first message from the second message; The load balancer determines the first receiving device from the multiple receiving devices based on a hash value of the source address of the first message.
6. The method according to claim 5, characterized in that The load balancer determines the first receiving device from the multiple receiving devices based on the hash value of the source address of the first message, including: The load balancer performs a modulo operation on the hash value and the number of the plurality of receiving devices to obtain a modulo result; The load balancer determines a receiving device among the multiple receiving devices whose device identifier corresponds to the modulo result as the first receiving device.
7. The method according to claim 5, characterized in that The multiple receiving devices include receiving devices in different receiving groups, each receiving group includes at least one receiving device; before determining the first receiving device from the multiple receiving devices based on the hash value of the source address of the first message, the method further includes: The load balancer determines, from a plurality of receiving groups, a target receiving group corresponding to the bandwidth level of the second message; wherein different receiving groups correspond to different bandwidth levels; The determining the first receiving device from the multiple receiving devices based on the hash value of the source address of the first message includes: The load balancer determines the first receiving device from the receiving devices included in the target receiving group based on the hash value of the source address of the first message.
8. The method according to claim 7, characterized in that The second message also includes a bandwidth level of the second message, where the bandwidth level of the second message is used to indicate a bandwidth size of the first message. Before the load balancer determines a target receiving group corresponding to the bandwidth level of the second message from a plurality of receiving groups, the method further includes: The load balancer obtains the bandwidth level of the second message from the second message.
9. The method according to claim 7 or 8, characterized in that: In a case where the multiple receiving groups include: a first receiving group, a second receiving group, and a third receiving group, the load balancer determines, from the multiple receiving groups, a target receiving group corresponding to the bandwidth level of the second message, including: The load balancer determines the first receiving group as the target receiving group when the bandwidth level of the second message is lower than a first preset level; The load balancer determines the first receiving group and the second receiving group as the target receiving group when the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level; The load balancer determines the first receiving group, the second receiving group, and the third receiving group as the target receiving groups when the bandwidth level of the second message is higher than the second preset level.
10. A message transmission method, characterized in that: The method is applied to a first sending device in a message transmission system, and the method includes: In a target field of a first message to be sent, adding a source address of the first message; the first message is a message to be sent to a receiving device; The first message is sent to a proxy server; the proxy server is used to convert the source address of the first message carried by the source address field in the first message into a public address to obtain a second message; the public address is used to indicate the proxy server.
11. The method according to claim 10, characterized in that The target field is a reserved field or a newly added field in the first message.
12. A message transmission method, characterized in that: The method is applied to a proxy server in a message transmission system, and the method comprises: Receiving a first message sent by a first sending device among multiple sending devices; the first message is a message to be sent to a receiving device; Converting the first message into a second message; the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; The second message is sent to a load balancer; the load balancer is used to determine a first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and send the second message to the first receiving device.
13. The method according to claim 12, characterized in that The source address of the first message is carried in a source address field in the first message, and the converting the first message into a second message includes: The source address of the first message in the source address field is replaced with the public address, and the source address of the first message is added to a reserved field or a newly added field in the first message to obtain the second message.
14. A message transmission method, characterized in that: The method is applied to a load balancer in a message transmission system, and the method comprises: receiving a second message sent by the proxy server, wherein the second message includes a message body of the first message, a source address of the second message, and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; Determine, from a plurality of receiving groups, a target receiving group corresponding to the bandwidth level of the second message; wherein different receiving groups correspond to different bandwidth levels, and each of the plurality of receiving groups includes at least one receiving device; Based on the hash value of the source address of the first message, a first receiving device is determined from the receiving devices included in the target receiving group, and the second message is sent to the first receiving device.
15. The method according to claim 14, characterized in that The second message also includes a bandwidth level of the second message, and the bandwidth level of the second message is used to indicate the bandwidth size of the first message. Before determining the target receiving group corresponding to the bandwidth level of the second message from the multiple receiving groups, the method also includes: The load balancer obtains the bandwidth level of the second message from the second message.
16. The method according to claim 14 or 15, characterized in that In a case where the multiple receiving groups include: a first receiving group, a second receiving group, and a third receiving group, determining, from the multiple receiving groups, a target receiving group corresponding to the bandwidth level of the second message includes: When the bandwidth level of the second message is lower than a first preset level, determining the first receiving group as the target receiving group; When the bandwidth level of the second message is higher than the first preset level and the bandwidth level of the second message is lower than the second preset level, determining the first receiving group and the second receiving group as the target receiving groups; When the bandwidth level of the second message is higher than the second preset level, the first receiving group, the second receiving group and the third receiving group are determined as the target receiving groups.
17. The method according to claim 14 or 15, characterized in that The determining, based on the hash value of the source address of the first message, the first receiving device from the receiving devices included in the target receiving group includes: Performing a modulo operation on the hash value and the number of multiple receiving devices included in the target receiving group to obtain a modulo result; A receiving device among the multiple receiving devices whose device identifier corresponds to the modulo result is determined as the first receiving device.
18. A message transmission device, characterized in that: The message transmission device is applied to a first sending device in a message transmission system, and the message transmission device comprises: a processing module and a transceiver module; The processing module is used to add the source address of the first message to the target field of the first message to be sent; the first message is a message to be sent to a receiving device; The transceiver module is used to send the first message to the proxy server; the proxy server is used to convert the source address of the first message carried by the source address field in the first message into a public address to obtain a second message; the public address is used to indicate the proxy server.
19. A message transmission device, characterized in that: The message transmission device is applied to a proxy server in a message transmission system, and the message transmission device comprises: a transceiver module and a processing module; The transceiver module is used to receive a first message sent by a first sending device among multiple sending devices; the first message is a message to be sent to a receiving device; The processing module is used to convert the first message into a second message; the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; The transceiver module is also used to send the second message to the load balancer; the load balancer is used to determine a first receiving device from multiple receiving devices based on the source address of the first message included in the second message, and send the second message to the first receiving device.
20. A message transmission device, characterized in that: The message transmission device is applied to a load balancer in a message transmission system, and the message transmission device comprises: a transceiver module and a processing module; The transceiver module is used to receive a second message sent by the proxy server, wherein the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; The processing module is used to determine a target receiving group corresponding to the bandwidth level of the second message from a plurality of receiving groups; wherein different receiving groups correspond to different bandwidth levels, and each of the plurality of receiving groups includes at least one receiving device; The processing module is used to determine a first receiving device from the receiving devices included in the target receiving group based on the hash value of the source address of the first message, and send the second message to the first receiving device.
21. A message transmission system, characterized in that: The message transmission system comprises: a plurality of sending devices, a proxy server, a load balancer and a plurality of receiving devices; wherein the plurality of sending devices have a communication link with the load balancer through the proxy server, and the load balancer has a communication link with the plurality of receiving devices; a first sending device, configured to send a first message to the proxy server; the plurality of sending devices include: the first sending device, the first message is a message to be sent to a receiving device; a source address of the first message is used to indicate the first sending device; The proxy server is used to receive the first message and convert the first message into a second message; the second message includes a message body of the first message, a source address of the second message and a source address of the first message; the source address of the second message is used to indicate a public address of the proxy server; The load balancer is used to receive the second message sent by the proxy server, and based on the source address of the first message included in the second message, determine a first receiving device from the multiple receiving devices; and send the second message to the first receiving device.
Citation Information
Patent Citations
Load balance dispatching method, device and system
CN102158512A
Load balancing treatment method, server, device and storage medium
CN107786669A
Server load balancing method and device
CN108111595A
Load balancing method, device and system for global access scheduling
CN111614742A
Communication method and device based on load balancing and computer program product
CN119011593A