Data transmission method and device, computer equipment and storage medium
By establishing session information between load balancing nodes and virtual switches, and directly conducting communication between virtual switches, the problem of performance bottlenecks and high capacity expansion costs of load balancing devices under the QUIC protocol in public cloud scenarios is solved, and transmission efficiency and reliability are improved sex.
Patent Information
- Application Number
- CN202411388728.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-10
AI Technical Summary
Existing network load balancing devices that support QUIC protocol have defects in multi-tenant service concurrent support in public cloud scenarios, load balancing node performance bottlenecks and high capacity expansion costs, affecting system stability.
By establishing session information between the load balancing node and the virtual switch, the virtual switch on the client side communicates directly with the back-end virtual switch, avoiding data transmission through the load balancing node, thereby reducing the pressure on the load balancing node and improving transmission efficiency.
It effectively improves the overall transmission efficiency of load balancing traffic, reduces the risks brought by centralized architecture, reduces the pressure on load balancing nodes, and improves the reliability and stability of the system.
Smart Images

Figure CN119109888A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a data transmission method, apparatus, computer equipment and storage medium. Background Art
[0002] QUIC (Quick UDP Internet Connections) is a secure and reliable transmission protocol based on UDP (User Datagram Protocol) encapsulation. As the QUIC protocol matures and becomes more popular, network load balancing products from public cloud vendors begin to support the QUIC protocol.
[0003] A load balancing device is a commonly used network device that can group multiple back-end servers into a server set and, through load sharing technology, distribute the incoming service requests to a certain back-end server according to a certain strategy. The back-end RS (Real Server) that receives the request responds to the service request independently. Network load balancing solves the problem of a large number of concurrent access services by distributing client requests to different back-end RSs.
[0004] The existing network load balancing that supports the QUIC protocol is generally a centralized solution. In public cloud application scenarios, due to the large number of tenant services, there are defects in supporting multi-tenant services concurrently. The performance of load balancing nodes has bottlenecks, the cost of expansion is high, and the impact domain is large in the event of a failure. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides a data transmission method, apparatus, computer equipment and storage medium.
[0006] In a first aspect, the present disclosure provides a data transmission method, applied to a first virtual switch, comprising:
[0007] Obtaining first session information sent by the load balancing node; the first session information includes a target connection identifier of the established session, an address of the load balancing node, and an address of a backend virtual machine;
[0008] Obtaining a first data message sent by a front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0009] When the connection identifier in the first data message is consistent with the target connection identifier, modify the destination address in the first data message to the address of the backend virtual machine, and encapsulate the modified first data message to generate a second data message;
[0010] The second data packet is sent to the second virtual switch corresponding to the backend virtual machine.
[0011] In a second aspect, the present disclosure provides a data transmission method, applied to a second virtual switch, comprising:
[0012] Acquire second session information sent by the load balancing node; the second session information includes a target connection identifier of the established session;
[0013] Obtain a second data message sent by the first virtual switch; wherein the generation process of the second data message includes: the first virtual switch modifies the destination address in the first data message sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data message, and generates the second data message; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0014] Decapsulating the second data message;
[0015] When the connection identifier in the second data message is consistent with the target connection identifier, the data message generated by decapsulation is sent to the backend virtual machine.
[0016] In a third aspect, the present disclosure provides a data transmission device, applied to a first virtual switch, comprising:
[0017] A first information acquisition module, used to acquire first session information sent by the load balancing node; the first session information includes a target connection identifier of the established session, an address of the load balancing node, and an address of a backend virtual machine;
[0018] A first message acquisition module, used to acquire a first data message sent by a front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0019] A first processing module, configured to modify the destination address in the first data message to the address of the backend virtual machine, and encapsulate the modified first data message to generate a second data message when the connection identifier in the first data message is consistent with the target connection identifier;
[0020] The first sending module is used to send the second data message to the second virtual switch corresponding to the backend virtual machine.
[0021] In a fourth aspect, the present disclosure provides a data transmission device, applied to a second virtual switch, comprising:
[0022] A second information acquisition module, used to acquire second session information sent by the load balancing node; the second session information includes a target connection identifier of the established session;
[0023] The second message acquisition module is used to acquire the second data message sent by the first virtual switch; wherein the generation process of the second data message includes: the first virtual switch modifies the destination address in the first data message sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data message, and generates the second data message; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0024] A second processing module, used for decapsulating the second data message;
[0025] The second sending module is used to send the data message generated by decapsulation to the backend virtual machine when the connection identifier in the second data message is consistent with the target connection identifier.
[0026] In a fifth aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the data transmission method of the first aspect, the second aspect or any corresponding embodiment thereof by executing the computer instructions.
[0027] In a sixth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data transmission method of the first aspect, the second aspect or any corresponding embodiment thereof.
[0028] The present invention provides first session information including target CID, backend virtual machine address and other information to the first virtual switch on the client side through a load balancing node. When the first virtual switch receives a data packet sent by the front-end virtual machine, it can determine whether a session has been established for the data packet based on the target CID, and can modify the target address of the data packet based on the back-end virtual machine address, so that the modified and encapsulated data packet is directly sent to the second virtual switch corresponding to the back-end virtual machine, so that the virtual switch on the client side can communicate directly with the virtual switch of the back-end RS without passing through the load balancing node, thereby reducing the pressure on the load balancing node, effectively improving the overall transmission efficiency of the load balancing traffic, improving reliability, and reducing the risks brought by the centralized architecture. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 is a schematic diagram of a load balancing architecture according to an embodiment of the present disclosure;
[0031] Figure 2 is a structural diagram of communication between virtual switches according to an embodiment of the present disclosure;
[0032] Figure 3 is a flow chart of a data transmission method according to an embodiment of the present disclosure;
[0033] Figure 4 It is a schematic diagram of the interaction process of establishing a session by a load balancing node according to an embodiment of the present disclosure;
[0034] Figure 5 is a schematic diagram of an interactive process for data transmission between virtual switches according to an embodiment of the present disclosure;
[0035] Figure 6 is another flowchart of a data transmission method according to an embodiment of the present disclosure;
[0036] Figure 7 is a structural block diagram of a data transmission device according to an embodiment of the present disclosure;
[0037] Figure 8 is another structural block diagram of a data transmission device according to an embodiment of the present disclosure;
[0038] Fig. 9It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0040] Figure 1 Figure 1 shows a schematic diagram of a load balancing architecture. Figure 1 As shown, the physical machine on the client side may be provided with a virtual machine (VM), and the physical machine may also be deployed with a virtual switch, based on which data transmission between each virtual machine and the load balancing node may be realized; Figure 1 As shown, the physical machine on the client side is equipped with a virtual machine that supports multiple IP addresses, two of which are 192.168.1.10 and 192.168.2.20. In addition, the server side is equipped with multiple back-end RSs (back-end servers), each of which is also equipped with a corresponding virtual machine and virtual switch, and each virtual machine is also equipped with a corresponding IP address, such as Figure 1 As shown, the address of the virtual machine in the backend RS1 is 192.168.1.30, and the address of the virtual machine in the backend RS2 is 192.168.1.40.
[0041] The load balancing node provides the client with a VIP (Virtual IP Address), which serves as the target address of the client request. Figure 1 As shown in FIG. 1 , the VIP of the load balancing node is 192.168.1.20. After receiving the request from the client, the load balancing node can select one of the backend RSs to respond, thereby realizing the session connection between the client and the backend RS.
[0042] In the process of processing services, in order to ensure that the same flow is assigned to the same backend RS, the load balancing node needs to save the five-tuple information representing the flow, namely "protocol, source address, source port, destination address, destination port"; when the load balancing node receives a message, it can determine the corresponding backend RS by querying the recorded five-tuple information, and then forward it. For load balancing nodes that support the QUIC protocol, in addition to realizing the above capabilities, support for CID (Connection ID) must also be added, that is, when the five-tuple of the flow changes, the corresponding backend RS can still be found according to the CID of the QUIC message.
[0043] In public cloud application scenarios, this load balancing method will bring greater processing pressure to the load balancing nodes, which may easily cause load balancing node failures. Although expanding the capacity of the load balancing nodes can solve this problem to a certain extent, the cost of expansion is relatively high.
[0044] The present disclosure implements a data transmission method. After the load balancing node establishes a session, the virtual switch in the physical machine processes the message to be transmitted, so that the virtual switch on the client side and the virtual switch on the backend RS can communicate directly without passing through the load balancing node, thereby reducing the pressure on the load balancing node and reducing the risks brought by the centralized architecture.
[0045] According to an embodiment of the present disclosure, an embodiment of a data transmission method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0046] The data transmission method provided in this embodiment can realize direct communication between the virtual switch on the client side and the virtual switch on the backend RS. Figure 2 FIG. 1 shows a schematic diagram of a structure for realizing communication between virtual switches. Figure 2 As shown, the first physical machine 11 on the client side is provided with at least one virtual machine. For the convenience of description, the virtual machine on the client side is referred to as a front-end virtual machine. Figure 2Take the first physical machine 11 including the front-end virtual machine 211 as an example; and a virtual switch on the client side, namely the first virtual switch 210, is also provided; the second physical machine 23 on the back-end RS side is provided with a back-end virtual machine 231 and a second virtual switch 230. The load balancing node 22 can establish a session between the first virtual switch 210 and the second virtual switch 230 through a scheduling algorithm, and then the first virtual switch 210 and the second virtual switch 230 can communicate directly, thereby realizing data transmission between the front-end virtual machine 211 on the client side and the back-end virtual machine 231.
[0047] A data transmission method provided in this embodiment can be applied to the first virtual switch 210, which is a virtual switch on the client side. Figure 3 is a flow chart of a data transmission method according to an embodiment of the present disclosure. Figure 3 As shown, the process includes the following steps.
[0048] Step S301, obtaining first session information sent by a load balancing node; the first session information includes a target connection identifier of an established session, an address of the load balancing node, and an address of a backend virtual machine.
[0049] In this embodiment, the load balancing node 22 can determine the backend virtual machine corresponding to the frontend virtual machine based on the handshake request initiated by the frontend virtual machine on the client side, based on a scheduling algorithm such as a polling algorithm and a minimum connection algorithm, and establish a session connection between the two. After that, the load balancing node 22 can generate corresponding session information and send the session information to the first virtual switch 210. For the convenience of description, the session information is referred to as the first session information.
[0050] Among them, the first session information includes the connection identifier (CID) provided by the front-end virtual machine when initiating a handshake request. The connection identifier is called the target connection identifier, which can also be referred to as the target CID for short; and the first session information also includes the address of the load balancing node, such as the VIP of the load balancing, and the address of the back-end virtual machine, such as the IP address and corresponding port of the back-end virtual machine.
[0051] In some optional implementations, before the above step S301 of "obtaining the first session information sent by the load balancing node", the method further includes a process of establishing a session using the load balancing node 22, and the process specifically includes:
[0052] The first virtual switch 210 obtains the first handshake message sent by the front-end virtual machine; the first handshake message includes a connection identifier, and the source address of the first handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the load balancing node. The first handshake message is encapsulated to generate a second handshake message, and the second handshake message is sent to the load balancing node to instruct the load balancing node to determine the back-end virtual machine corresponding to the front-end virtual machine, establish a session, modify the destination address in the second handshake message to the address of the back-end virtual machine, generate a third handshake message, and send the third handshake message to the second virtual switch corresponding to the back-end virtual machine. Afterwards, a response message sent by the load balancing node is obtained; the source address of the response message is the address of the load balancing node, and the destination address is the handshake address of the front-end virtual machine; the response message is unsealed, and the unsealed response message is sent to the front-end virtual machine.
[0053] Figure 4 A schematic diagram of the interaction process of the load balancing node 22 establishing a session is shown. Figure 4 In the example, the front-end virtual machine 211 initiates a handshake request. Figure 4 As shown, the process includes the following steps S401 to S410.
[0054] Step S401: The front-end virtual machine 211 sends a first handshake message to the first virtual switch 210.
[0055] Among them, the first handshake message includes a connection identifier, and the source address of the first handshake message is the handshake address of the front-end virtual machine 211, which can be the first address mentioned above or the second address described later, and the destination address is the address of the load balancing node 22, which is the virtual IP address of the load balancing node 22, namely VIP.
[0056] For example, the IP address used by the front-end virtual machine 211 for handshake is 192.168.1.10, and the port is 10000; the VIP of the load balancing node 22 is 192.168.1.20, and the port is 443. The CID of the first handshake message is 666, and the first handshake message can be described as: 192.168.1.10:10000→192.168.1.20:443UDP CID:666.
[0057] Step S402 : The first virtual switch 210 encapsulates the first handshake message to generate a second handshake message, and sends the second handshake message to the load balancing node 22 .
[0058] For example, the first virtual switch 210 performs VXLAN encapsulation on the first handshake message to generate a second handshake message. The format of the second handshake message is not described in detail in this embodiment.
[0059] In step S403, the load balancing node 22 determines the backend virtual machine 231 corresponding to the frontend virtual machine 211, establishes a session between the two, and modifies the destination address in the second handshake message to the address of the backend virtual machine 231 to generate a third handshake message.
[0060] Specifically, after the load balancing node 22 recognizes that the second handshake message is a QUIC protocol message, it selects a suitable backend virtual machine 231 according to the scheduling algorithm and records the CID. In addition, the load balancing node 22 modifies the destination address in the second handshake message from the address of the load balancing node 22 to the address of the backend virtual machine 231.
[0061] For example, the IP address of the backend virtual machine 231 is 192.168.1.30, and the port is 1234; the source address of the second handshake message is the same as that of the first handshake message, and the second handshake message can be described as: 192.168.1.10:10000→192.168.1.30:1234UDP CID:666.
[0062] Step S404 : The load balancing node 22 sends the third handshake message to the second virtual switch 230 corresponding to the backend virtual machine 231 .
[0063] Step S405 : The second virtual switch 230 decapsulates the third handshake message, and sends the decapsulated handshake message to the backend virtual machine 231 .
[0064] Step S406 , the backend virtual machine 231 responds to the received handshake message, generates a first response message, and sends the first response message to the second virtual switch 230 .
[0065] The first response message includes a corresponding connection identifier (e.g., CID:666), and the source address of the first response message is the address of the backend virtual machine 231 (e.g., 192.168.1.30:1234), and the destination address is the handshake address of the frontend virtual machine 211 (e.g., 192.168.1.10:10000).
[0066] Step S407 : The second virtual switch 230 encapsulates the first response message to generate a second response message, and sends the second response message to the load balancing node 22 .
[0067] For example, the second virtual switch 230 performs VXLAN encapsulation on the first response message to generate a second response message.
[0068] Step S408: The load balancing node 22 modifies the source address in the second response message to the address of the load balancing node, and generates a third response message.
[0069] Among them, the load balancing node 22 can query the recorded session information. If the second response message is legal, the source address in the second response message can be modified from the address of the backend virtual machine 231 (for example, 192.168.1.30:b1234) to the address of the load balancing node 22 (for example, 192.168.1.20:443), thereby obtaining a third response message.
[0070] Step S409 : The load balancing node 22 sends the third response message to the first virtual switch 210 corresponding to the front-end virtual machine 211 .
[0071] In step S410 , the first virtual switch 210 decapsulates the third response message, and sends the decapsulated response message to the front-end virtual machine 211 .
[0072] At this point, the session connection between the front-end virtual machine 211 and the back-end virtual machine 231 is completed, and then the load balancing node 22 can send the first session information to the first virtual switch 210 to implement the method provided in this embodiment.
[0073] Step S302, obtaining a first data message sent by the front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node.
[0074] In this embodiment, after the front-end virtual machine 211 on the client side determines that a session connection has been established with the back-end RS, for example, it receives the unsealed response message fed back by the first virtual switch 210 in the above step S410. If the front-end virtual machine 211 needs to interact with the back-end RS for business, it can send a corresponding data message, i.e., a first data message, to the first virtual switch 210. Similar to the above-mentioned first handshake message, the first data message also includes a CID, and the connection identifier is the CID of the established session. Under normal circumstances, the CID in the first data message is the same as the target CID sent by the load balancing node 22. In addition, the source address of the first data message is the first address of the front-end virtual machine (for example, 192.168.1.10:10000), and the destination address is the address of the load balancing node (for example, 192.168.1.20:443).
[0075] Step S303, when the connection identifier in the first data message is consistent with the target connection identifier, the destination address in the first data message is modified to the address of the backend virtual machine, and the modified first data message is encapsulated to generate a second data message.
[0076] In this embodiment, after the first virtual switch 210 obtains the first data message, it first searches for the first session information recorded locally, and determines whether the CID in the first data message is consistent with the target CID. If the two are consistent, the first virtual switch 210 modifies the destination address in the first data message from the address of the load balancing node 22 to the address of the backend virtual machine 231 in the first session information. Afterwards, the modified first data message is encapsulated, for example, VXLAN encapsulation is performed, so as to generate a second data message.
[0077] For example, the first virtual switch 210 modifies the destination IP address and destination port in the first data message to the IP address and port of the backend virtual machine 231. For example, the destination address is modified from 192.168.1.20:443 to 192.168.1.30:1234. It can be understood that the second data message has the same source address as the first data message, such as 192.168.1.10:10000, but the destination address of the second data message is the address of the backend virtual machine 231, such as 192.168.1.30:1234. In addition, the second data message also contains the CID in the first data message, that is, the target CID.
[0078] If the CID in the first data message is inconsistent with the target CID, or in other words, the first virtual switch 210 does not record the CID in the first data message, an exception may be fed back to the front-end virtual machine 211 to instruct the front-end virtual machine 211 to re-initiate a handshake request.
[0079] Step S304: Send the second data message to the second virtual switch corresponding to the backend virtual machine.
[0080] In this embodiment, after generating the second data packet, the first virtual switch 210 does not need to pass through the load balancing node 22, but directly sends the second data packet to the second virtual switch 230 corresponding to the backend virtual machine 231, so that the second virtual switch 230 can send the corresponding data packet to the backend virtual machine 231.
[0081] Specifically, the first virtual switch 210 may send the second data message to the physical node where the backend virtual machine 231 is located, that is, the second physical machine 23, so that the second virtual switch 230 in the second physical machine 23 can receive the second data message. For example, the first session information sent by the load balancing node 22 to the first virtual switch 210 also includes the physical address of the second physical machine 23 where the backend virtual machine 231 is located, so that the first virtual switch 210 can send the second data message to the second virtual switch 230.
[0082] The data transmission method provided in this embodiment provides, after the load balancing node establishes a session, first session information including target CID, backend virtual machine address and other information is provided to the first virtual switch on the client side. When the first virtual switch receives a data packet sent by the front-end virtual machine, it can determine whether a session has been established for the data packet based on the target CID, and can modify the target address of the data packet based on the back-end virtual machine address, so that the modified and encapsulated data packet is directly sent to the second virtual switch corresponding to the back-end virtual machine, so that the virtual switch on the client side can communicate directly with the virtual switch of the back-end RS without passing through the load balancing node, thereby reducing the pressure on the load balancing node, effectively improving the overall transmission efficiency of the load balancing traffic, improving reliability, and reducing the risks brought by the centralized architecture.
[0083] In some optional implementations, after the above step S304 "sending the second data packet to the second virtual switch corresponding to the backend virtual machine", the first virtual switch 210 can also obtain a response packet directly sent by the second virtual switch 230. Specifically, the response process specifically includes the following steps a1 to a2.
[0084] Step a1: Obtain a second response message sent by the second virtual switch.
[0085] Among them, the process of generating the second reply message includes: the second virtual switch modifies the source address in the first reply message sent by the back-end virtual machine to the address of the load balancing node, encapsulates the modified first reply message, and generates a second reply message; the first reply message includes a connection identifier, and the source address of the first reply message is the address of the back-end virtual machine, and the destination address is the first address of the front-end virtual machine.
[0086] Step a2, unpacking the second response message, and when the connection identifier in the second response message is consistent with the target connection identifier, sending the unpacked response message to the front-end virtual machine.
[0087] In this embodiment, after the first virtual switch 210 sends the second data message to the second virtual switch 230 corresponding to the backend virtual machine 231, the second virtual switch 230 can decapsulate the second data message, and then send the decapsulated data message to the backend virtual machine 231. After the backend virtual machine 231 obtains the decapsulated data message, it can respond, generate a first response message, and send the first response message to the second virtual switch 230; the second virtual switch 230 modifies the source address in the first response message to the address of the load balancing node, encapsulates the modified first response message, thereby generating a second response message, and sends the second response message to the first virtual switch 210.
[0088] For example, the first response message also includes the CID, and the source address of the first response message is the address of the backend virtual machine 231, and the destination address is the first address (for example, 192.168.1.10:10000) of the frontend virtual machine 211. The second virtual switch 230 modifies the source address in the first response message from the address of the backend virtual machine 231 to the address of the load balancing node, for example, from 192.168.1.30:1234 to 192.168.1.20:443.
[0089] Among them, the second virtual switch 230 will also obtain the session information sent by the load balancing node 22, that is, the second session information, which includes the corresponding target CID and the address of the load balancing node 22, so that the second virtual switch 230 can judge whether the received second data message, first response message, etc. are legal based on the target CID, and modify the source address of the first response message based on the address of the load balancing node 22.
[0090] After receiving the second response message sent by the second virtual switch 230, the first virtual switch 210 can unseal the second response message and extract the CID therein. If the CID in the second response message is consistent with the destination CID recorded locally, it means that the second response message is legal, and then the response message generated after unsealing the second response message can be sent to the corresponding front-end virtual machine 211.
[0091] Optionally, the first virtual switch 210 can configure a lifetime for the target CID and update the lifetime, and whether the target CID is valid can be determined based on the lifetime. Specifically, after the above step S301 "obtaining the first session information sent by the load balancing node", the method further includes: setting the first session lifetime corresponding to the target connection identifier; and updating the first session lifetime when the connection identifier in the received message is consistent with the target connection identifier.
[0092] In this embodiment, after obtaining the first session information sent by the load balancing node 22, the first virtual switch 210 can set a corresponding lifetime for the target CID in the first session information, that is, the first session lifetime. When the CID in the message (e.g., the first data message, the second response message, etc.) received by the first virtual switch 210 is consistent with the target CID, the first session lifetime is updated, for example, the first session lifetime is initialized so that the first session lifetime remains valid, that is, the target CID is valid. When the first virtual switch 210 receives a message, the CID in the message can be compared with the target CID.
[0093] Furthermore, the method further includes: deleting the first session information when the first session lifetime exceeds a first preset threshold.
[0094] In this embodiment, a certain time threshold is preset for the first session lifetime, that is, the first preset threshold, which is, for example, 500s, 800s, etc., and can be determined based on actual needs. If the first session lifetime of the target CID exceeds the first preset threshold, it means that the first virtual switch 210 has not received data from the front-end virtual machine 211 for a long time. At this time, the first virtual switch 210 can destroy the corresponding session, that is, delete the first session information corresponding to the target CID; and the first virtual switch 210 can also notify the load balancing node 22 to destroy the relevant session. When the first virtual switch 210 receives a message sent by the front-end virtual machine later, since the target CID does not exist at this time, the first virtual switch 210 forwards the message to the load balancing node 22, and re-executes the process of creating a session, for example, re-executes the above step S401, etc.
[0095] Figure 5 FIG. 1 shows a schematic diagram of the interactive process of directly transmitting data between virtual switches. Figure 5 As shown, the process includes the following steps S501 to S513.
[0096] Step S501 : The load balancing node 22 sends first session information to the first virtual switch 210 , and sends second session information to the second virtual switch 230 .
[0097] The first session information includes the target CID of the established session, the address of the load balancing node 22, and the address of the backend virtual machine 231; and the first session information may also include the physical address of the physical node where the backend virtual machine 231 is located, that is, the physical address of the second physical machine 23. The second session information includes the target CID of the established session and the address of the load balancing node; and the second session information may also include the physical address of the physical node where the frontend virtual machine is located, that is, the physical address of the first physical machine 21.
[0098] For example, the first address of the front-end virtual machine 211 is 192.168.1.10:10000, the address of the load balancing node 22 is 192.168.1.20:443, and the address of the back-end virtual machine 231 is 192.168.1.30:1234. The target CID is 666.
[0099] Step S502: The first virtual switch 210 sets a first session lifetime corresponding to the target CID.
[0100] Step S503: The second virtual switch 230 sets a second session lifetime corresponding to the target CID.
[0101] Step S504 : The front-end virtual machine 211 sends a first data packet to the first virtual switch 210 .
[0102] For example, the CID in the first data message is 666, and the source address of the first data message is 192.168.1.10:10000 (the first address of the front-end virtual machine), and the destination address is 192.168.1.20:443 (the address of the load balancing node).
[0103] In step S505, the first virtual switch 210 determines whether the CID in the first data message is consistent with the target CID; if the two are consistent, the first session lifetime is updated, and the destination address in the first data message is modified to the address of the backend virtual machine, and the modified first data message is encapsulated to generate a second data message.
[0104] For example, after receiving the first data message, the first virtual switch 210 initializes the first session lifetime, for example, to zero; and the first virtual switch 210 modifies the destination address in the first data message from 192.168.1.20:443 (the address of the load balancing node) to 192.168.1.30:1234 (the address of the backend virtual machine), and then encapsulates it to obtain the second data message.
[0105] It can be understood that the CID of the second data message is 666, and the source address of the second data message is still 192.168.1.10:10000 (the first address of the front-end virtual machine), and the destination address is 192.168.1.30:1234 (the address of the back-end virtual machine).
[0106] Step S506 : The first virtual switch 210 sends the second data packet to the second virtual switch 230 corresponding to the backend virtual machine 231 .
[0107] For example, the first virtual switch 210 sends the second data packet to the second physical machine 23 according to the physical address of the second physical machine 23 in the first session information, thereby sending the second data packet to the second virtual switch 230 in the second physical machine 23 .
[0108] Step S507: After acquiring the second data message, the second virtual switch 230 decapsulates the second data message and determines whether the CID in the second data message is consistent with the target CID. If they are consistent, the second session lifetime is updated.
[0109] Similar to the process of the first virtual switch 210 updating the first session lifetime, the second virtual switch 230 will also update the second session lifetime after acquiring the message with the correct CID.
[0110] The second virtual switch 230 may also record the location information of the physical node where the front-end virtual machine 211 is located in the second data message, such as the physical address of the first physical machine 21, so as to be able to respond to the second data message later.
[0111] Step S508 : The second virtual switch 230 sends the decapsulated data message to the backend virtual machine 231 .
[0112] Step S509 , the backend virtual machine 231 responds to the received data message, generates a first response message, and sends the first response message to the second virtual switch 230 .
[0113] For example, the CID of the first response message is also 666, and the source address of the first response message is 192.168.1.30:1234 (the address of the backend virtual machine), and the destination address is 192.168.1.10:10000 (the first address of the frontend virtual machine).
[0114] Step S510, after receiving the first response message, the second virtual switch 230 determines whether the CID in the first response message is consistent with the target CID. If the two are consistent, the second session lifetime is updated again, the source address in the first response message is modified to the address of the load balancing node, and a second response message is generated.
[0115] Step S511 : The second virtual switch 230 sends the second response message to the first virtual switch 210 corresponding to the front-end virtual machine 211 .
[0116] Step S512: After receiving the second response message, the first virtual switch 210 determines whether the CID in the second response message is consistent with the target CID. If they are consistent, the first session lifetime is updated again.
[0117] Step S513 : The first virtual switch 210 sends the response message generated by decapsulation to the front-end virtual machine 211 .
[0118] In some optional implementations, since the front-end virtual machine on the client side can correspond to multiple addresses, for example, different IP addresses can be set for different services, or the front-end virtual machine supports multiple network cards, and each network card also corresponds to a corresponding IP address. After the load balancing node 22 establishes a session between the client and the back-end RS, the front-end virtual machine 211 can transmit data with the back-end RS based on any IP address and a valid CID. Specifically, after obtaining the first session information sent by the load balancing node 22, the first virtual switch 210 can also perform the following steps b1 to b3.
[0119] Step b1, obtaining a third data message sent by the front-end virtual machine; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node.
[0120] Step b2, when the connection identifier in the third data message is consistent with the target connection identifier, modify the destination address in the third data message to the address of the backend virtual machine, and encapsulate the modified third data message to generate a fourth data message.
[0121] Step b3: Send the fourth data message to the second virtual switch corresponding to the backend virtual machine.
[0122] In this embodiment, for different IP addresses of the same front-end virtual machine, corresponding data packets can be sent based on the CID of the established session. Specifically, similar to the process of the front-end virtual machine 211 sending the first data packet, the front-end virtual machine 211 can also send a corresponding data packet, i.e., a third data packet, to the first virtual switch 210. Moreover, the source address of the third data packet is the second address of the front-end virtual machine 211, which is different from the source address of the first data packet.
[0123] For example, the first IP address of the front-end virtual machine 211 is 192.168.1.10, the port is 10000, and the second IP address of the front-end virtual machine 211 is 192.168.2.20, the port is 20000, then the source address of the third data message may be: 192.168.2.20:20000.
[0124] After the first virtual switch 210 obtains the third data packet, the process is similar to the above process of processing the first data packet. For details, please refer to the relevant descriptions of the above steps S302 to S304, which will not be repeated here.
[0125] Optionally, after step b3 of "sending the fourth data packet to the second virtual switch corresponding to the backend virtual machine", the method further includes steps b4 to b5.
[0126] Step b4: Obtain a fourth response message sent by the second virtual switch.
[0127] Among them, the generation process of the fourth reply message includes: the second virtual switch modifies the source address in the third reply message sent by the back-end virtual machine to the address of the load balancing node, encapsulates the modified third reply message, and generates a fourth reply message; the third reply message includes a connection identifier, and the source address of the third reply message is the address of the back-end virtual machine, and the destination address is the second address of the front-end virtual machine.
[0128] Step b5, unseal the fourth response message, and when the connection identifier in the fourth response message is consistent with the target connection identifier, send the response message generated by unseal to the front-end virtual machine.
[0129] In this embodiment, after the first virtual switch 210 obtains the fourth response message, the processing is similar to the processing of obtaining the second response message. For details, please refer to the relevant descriptions of steps a1 to a2 above, which will not be repeated here.
[0130] It can be understood that the first virtual switch 210 is set with a first session lifetime. When the first virtual switch 210 receives the third data packet or the fourth response packet, if the CID in these packets is correct, the first session lifetime can be updated even if the packet has a different five-tuple from the packet related to the front-end virtual machine 211.
[0131] In the data transmission method provided in this embodiment, after the load balancing node establishes a session, the virtual switch on the client side and the virtual switch on the backend RS can communicate directly without passing through the load balancing node, thereby reducing the pressure on the load balancing node and reducing the risks brought by the centralized architecture. The front-end virtual machine can use different IP addresses or the same CID for data transmission, which can achieve load balancing of the QUIC protocol; the virtual switch can ensure the validity of the target CID by setting the session lifetime and updating the session lifetime when receiving a legitimate message; and the invalid target CID is destroyed in time through the timeout mechanism, which can prevent resource backlogs from causing performance bottlenecks.
[0132] A data transmission method provided in this embodiment can be applied to the second virtual switch 230, which is a virtual switch of the backend RS. Figure 6 is a flow chart of a data transmission method according to an embodiment of the present disclosure. Figure 6 As shown, the process includes the following steps.
[0133] Step S601, obtaining second session information sent by the load balancing node; the second session information includes a target connection identifier of the established session.
[0134] In this embodiment, after the load balancing node 22 establishes a session, it can provide session information, i.e., second session information, to the corresponding second virtual switch 230. Specifically, the second session information includes the target CID of the established session, so that the second virtual switch 230 can determine whether to process the received message based on the target CID.
[0135] Optionally, before the above step S601 "obtaining the second session information sent by the load balancing node", the method also includes a process of establishing a session using the load balancing node 22, which specifically includes: obtaining a handshake message sent by the load balancing node; the source address of the handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the back-end virtual machine. Unseal the handshake message, and send the unsealed handshake message to the back-end virtual machine. Obtain a first response message sent by the back-end virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the back-end virtual machine, and the destination address is the handshake address of the front-end virtual machine. Encapsulate the first response message, generate a second response message, and send the second response message to the load balancing node to instruct the load balancing node to modify the source address in the second response message to the address of the load balancing node, generate a third response message, and send the third response message to the first virtual switch corresponding to the front-end virtual machine.
[0136] The second virtual switch 230 assists the load balancing node 22 in establishing a session. Figure 4 The relevant description of the illustrated embodiment will not be repeated here.
[0137] Step S602: Acquire a second data message sent by the first virtual switch.
[0138] Among them, the generation process of the second data packet includes: the first virtual switch modifies the destination address in the first data packet sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data packet, and generates a second data packet; the first data packet includes a connection identifier, and the source address of the first data packet is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node.
[0139] Step S603: decapsulate the second data message.
[0140] Step S604: When the connection identifier in the second data message is consistent with the target connection identifier, the data message generated by decapsulation is sent to the backend virtual machine.
[0141] The process of the first virtual switch 210 generating the second data message and the second virtual switch 230 sending the decapsulated data message to the backend virtual machine 231 can be specifically referred to in Figure 3 and Figure 5 The embodiments shown will not be described in detail here.
[0142] The data transmission method provided in this embodiment provides that after the load balancing node establishes a session, it provides the second session information including the target CID and other information to the second virtual switch of the backend RS. When the second virtual switch receives the data message sent by the first virtual switch, it can determine whether the data message needs to be processed based on the target CID; if the CID of the data message is consistent with the target CID, the second virtual switch can unblock the data message and then send the unblocked data message to the backend virtual machine. The virtual switch on the client side can communicate directly with the virtual switch of the backend RS without passing through the load balancing node, thereby reducing the pressure on the load balancing node, effectively improving the overall transmission efficiency of the load balancing traffic, and improving reliability, reducing the risks brought by the centralized architecture.
[0143] In some optional implementations, the second session information sent by the load balancing node 22 also includes the address of the load balancing node 22; and the method further includes the following steps c1 to c3.
[0144] Step c1, obtaining a first response message sent by the backend virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the backend virtual machine, and the destination address is the first address of the frontend virtual machine.
[0145] Step c2: when the connection identifier in the first response message is consistent with the target connection identifier, modify the source address in the first response message to the address of the load balancing node, and generate a second response message.
[0146] Step c3: Send the second response message to the first virtual switch corresponding to the front-end virtual machine.
[0147] The process of the second virtual switch 230 generating the second response message based on the first response message can be specifically referred to in Figure 5 The descriptions of steps S509 to S511 of the illustrated embodiment are not repeated here.
[0148] Optionally, after the above step S601 of "obtaining the second session information sent by the load balancing node", the method further includes steps d1 to d3.
[0149] Step d1, obtaining a fourth data message sent by the first virtual switch.
[0150] Among them, the generation process of the fourth data message includes: the first virtual switch modifies the destination address in the third data message sent by the front-end virtual machine to the address of the back-end virtual machine, encapsulates the modified third data message, and generates the fourth data message; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node.
[0151] Step d2, decapsulating the fourth data message.
[0152] Step d3: When the connection identifier in the fourth data message is consistent with the target connection identifier, the data message generated by decapsulation is sent to the backend virtual machine.
[0153] The processing process of the second virtual switch 230 for the fourth data message sent by the first virtual switch 210 is similar to the processing process for the second data message. For details, please refer to the relevant descriptions of the above steps S602 to S604, which will not be repeated here.
[0154] Optionally, the second session information further includes the address of the load balancing node; and after step d3 "sending the decapsulated generated data message to the backend virtual machine", the method further includes the following steps d4 to d6.
[0155] Step d4, obtaining a third response message sent by the backend virtual machine; the third response message includes a connection identifier, and the source address of the third response message is the address of the backend virtual machine, and the destination address is the second address of the frontend virtual machine.
[0156] Step d5: When the connection identifier in the third response message is consistent with the target connection identifier, the source address in the third response message is modified to the address of the load balancing node, and a fourth response message is generated.
[0157] Step d6: Send the fourth response message to the first virtual switch corresponding to the front-end virtual machine.
[0158] The processing process of the second virtual switch 230 for the third response message sent by the backend virtual machine 231 is similar to the processing process for the first response message. For details, please refer to the relevant descriptions of the above steps S602 to S604, which will not be repeated here.
[0159] Optionally, after step S601 "obtaining the second session information sent by the load balancing node", the method further includes: setting the second session lifetime corresponding to the target connection identifier; and updating the second session lifetime when the connection identifier in the received message is consistent with the target connection identifier.
[0160] Further optionally, the method further includes: deleting the second session information when the second session lifetime exceeds a second preset threshold.
[0161] In this embodiment, after the second virtual switch 230 receives a message, for example, after receiving the above-mentioned second data message, fourth data message, first response message, and third response message, if the CID in the message is consistent with the target CID, the set second session lifetime can be updated. This process is similar to the process of the first virtual switch 210 updating the first session lifetime, and will not be repeated here.
[0162] Similarly, if the second session lifetime exceeds a second preset threshold, the second session information corresponding to the target CID may be deleted, wherein the second preset threshold may be the same as the first preset threshold.
[0163] In the data transmission method provided by this embodiment, after the load balancing node establishes a session, the virtual switch on the client side and the virtual switch on the backend RS can communicate directly without passing through the load balancing node, thereby reducing the pressure on the load balancing node and reducing the risks brought by the centralized architecture. The second virtual switch supports front-end virtual machines with different IP addresses to use the same CID for data transmission, which can achieve load balancing of the QUIC protocol; the virtual switch can ensure the validity of the target CID by setting the session lifetime and updating the session lifetime when receiving a legitimate message; and the invalid target CID is destroyed in time through the timeout mechanism, which can prevent resource backlogs from causing performance bottlenecks.
[0164] In this embodiment, a data transmission device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0165] This embodiment provides a data transmission device, which is applied to a first virtual switch, such as Figure 7 As shown, including:
[0166] The first information acquisition module 701 is used to acquire the first session information sent by the load balancing node; the first session information includes the target connection identifier of the established session, the address of the load balancing node and the address of the backend virtual machine;
[0167] The first message acquisition module 702 is used to acquire a first data message sent by the front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0168] The first processing module 703 is used to modify the destination address in the first data message to the address of the backend virtual machine when the connection identifier in the first data message is consistent with the target connection identifier, and encapsulate the modified first data message to generate a second data message;
[0169] The first sending module 704 is configured to send the second data packet to a second virtual switch corresponding to the backend virtual machine.
[0170] In some optional implementations, after the first sending module 704 sends the second data message to the second virtual switch corresponding to the backend virtual machine, the first message acquisition module 702 is further used to obtain a second reply message sent by the second virtual switch; wherein the generation process of the second reply message includes: the second virtual switch modifies the source address in the first reply message sent by the backend virtual machine to the address of the load balancing node, encapsulates the modified first reply message, and generates the second reply message; the first reply message includes a connection identifier, and the source address of the first reply message is the address of the backend virtual machine, and the destination address is the first address of the front-end virtual machine;
[0171] The first processing module 703 is further used to decapsulate the second response message;
[0172] The first sending module 704 is further configured to, when the connection identifier in the second response message is consistent with the target connection identifier, send the response message generated by decapsulation to the front-end virtual machine.
[0173] In some optional implementations, after the first information acquisition module 701 acquires the first session information sent by the load balancing node, the first message acquisition module 702 is further used to acquire a third data message sent by the front-end virtual machine; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0174] The first processing module 703 is further configured to, when the connection identifier in the third data message is consistent with the target connection identifier, modify the destination address in the third data message to the address of the backend virtual machine, and encapsulate the modified third data message to generate a fourth data message;
[0175] The first sending module 704 is further configured to send the fourth data packet to the second virtual switch corresponding to the backend virtual machine.
[0176] In some optional implementations, after the first sending module 704 sends the fourth data message to the second virtual switch corresponding to the backend virtual machine, the first message acquisition module 702 is further used to obtain a fourth reply message sent by the second virtual switch; wherein the generation process of the fourth reply message includes: the second virtual switch modifies the source address in the third reply message sent by the backend virtual machine to the address of the load balancing node, encapsulates the modified third reply message, and generates the fourth reply message; the third reply message includes a connection identifier, and the source address of the third reply message is the address of the backend virtual machine, and the destination address is the second address of the front-end virtual machine;
[0177] The first processing module 703 is further used to decapsulate the fourth response message;
[0178] The first sending module 704 is further configured to send the response message generated by decapsulation to the front-end virtual machine when the connection identifier in the fourth response message is consistent with the target connection identifier.
[0179] In some optional implementations, after the first information acquisition module 701 acquires the first session information sent by the load balancing node, the first processing module 703 is further configured to:
[0180] Setting the first session lifetime corresponding to the target connection identifier;
[0181] When the connection identifier in the received message is consistent with the target connection identifier, the first session lifetime is updated.
[0182] In some optional implementations, the first processing module 703 is further configured to: delete the first session information when the first session lifetime exceeds a first preset threshold.
[0183] In some optional implementations, before the first information acquisition module 701 acquires the first session information sent by the load balancing node, the first message acquisition module 702 is further used to acquire a first handshake message sent by the front-end virtual machine; the first handshake message includes a connection identifier, and the source address of the first handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0184] The first processing module 703 is further used to encapsulate the first handshake message to generate a second handshake message;
[0185] The first sending module 704 is further used to send the second handshake message to the load balancing node to instruct the load balancing node to determine the backend virtual machine corresponding to the frontend virtual machine, establish a session, modify the destination address in the second handshake message to the address of the backend virtual machine, generate a third handshake message, and send the third handshake message to the second virtual switch corresponding to the backend virtual machine;
[0186] The first message acquisition module 702 is also used to acquire a response message sent by the load balancing node; the source address of the response message is the address of the load balancing node, and the destination address is the handshake address of the front-end virtual machine;
[0187] The first processing module 703 is further used to decapsulate the response message;
[0188] The first sending module 704 is further configured to send the unsealed response message to the front-end virtual machine.
[0189] This embodiment provides a data transmission device, which is applied to a second virtual switch. Figure 8 As shown, including:
[0190] The second information acquisition module 801 is used to acquire the second session information sent by the load balancing node; the second session information includes the target connection identifier of the established session;
[0191] The second message acquisition module 802 is used to acquire the second data message sent by the first virtual switch; wherein the generation process of the second data message includes: the first virtual switch modifies the destination address in the first data message sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data message, and generates the second data message; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0192] A second processing module 803, configured to decapsulate the second data message;
[0193] The second sending module 804 is used to send the data message generated by decapsulation to the backend virtual machine when the connection identifier in the second data message is consistent with the target connection identifier.
[0194] In some optional implementations, the second session information further includes an address of the load balancing node;
[0195] The second message acquisition module 802 is further used to acquire a first response message sent by the backend virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the backend virtual machine, and the destination address is the first address of the frontend virtual machine;
[0196] The second processing module 803 is further configured to, when the connection identifier in the first response message is consistent with the target connection identifier, modify the source address in the first response message to the address of the load balancing node to generate a second response message;
[0197] The second sending module 804 is further configured to send the second response message to the first virtual switch corresponding to the front-end virtual machine.
[0198] In some optional implementations, after the second information acquisition module 801 acquires the second session information sent by the load balancing node, the second message acquisition module 802 is further used to acquire a fourth data message sent by the first virtual switch; wherein the generation process of the fourth data message includes: the first virtual switch modifies the destination address in the third data message sent by the front-end virtual machine to the address of the back-end virtual machine, encapsulates the modified third data message, and generates the fourth data message; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node;
[0199] The second processing module 803 is further used to decapsulate the fourth data message;
[0200] The second sending module 804 is further configured to send the decapsulated data message to the backend virtual machine when the connection identifier in the fourth data message is consistent with the target connection identifier.
[0201] In some optional implementations, the second session information further includes an address of the load balancing node;
[0202] The second message acquisition module 802 is further used to acquire a third response message sent by the backend virtual machine; the third response message includes a connection identifier, and the source address of the third response message is the address of the backend virtual machine, and the destination address is the second address of the frontend virtual machine;
[0203] The second processing module 803 is further configured to, when the connection identifier in the third response message is consistent with the target connection identifier, modify the source address in the third response message to the address of the load balancing node, and generate a fourth response message;
[0204] The second sending module 804 is further configured to send the fourth response message to the first virtual switch corresponding to the front-end virtual machine.
[0205] In some optional implementations, after the second information acquisition module 801 acquires the second session information sent by the load balancing node, the second processing module 803 is further configured to:
[0206] Setting the second session lifetime corresponding to the target connection identifier;
[0207] When the connection identifier in the received message is consistent with the target connection identifier, the second session lifetime is updated.
[0208] In some optional implementations, the second processing module 803 is further configured to: delete the second session information when the second session lifetime exceeds a second preset threshold.
[0209] In some optional implementations, before the second information acquisition module 801 acquires the second session information sent by the load balancing node, the second message acquisition module 802 is further used to acquire a handshake message sent by the load balancing node; the source address of the handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the back-end virtual machine;
[0210] The second processing module 803 is further used to decapsulate the handshake message;
[0211] The second sending module 804 is further used to send the unsealed handshake message to the backend virtual machine;
[0212] The second message acquisition module 802 is further used to acquire a first response message sent by the backend virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the backend virtual machine, and the destination address is the handshake address of the frontend virtual machine;
[0213] The second processing module 803 is further used to encapsulate the first response message to generate a second response message;
[0214] The second sending module 804 is also used to send the second response message to the load balancing node to instruct the load balancing node to modify the source address in the second response message to the address of the load balancing node, generate a third response message, and send the third response message to the first virtual switch corresponding to the front-end virtual machine.
[0215] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0216] The data transmission device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, including a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0217] The present disclosure also provides a computer device having the above Figure 7 or Figure 8 The data transmission device shown.
[0218] See also Fig. 9 , Fig. 9 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.
[0219] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0220] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0221] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0222] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0223] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0224] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0225] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0226] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data transmission method, characterized in that: Applied to a first virtual switch, the method comprises: Obtaining first session information sent by the load balancing node; the first session information includes a target connection identifier of the established session, an address of the load balancing node, and an address of a backend virtual machine; Obtaining a first data message sent by a front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node; When the connection identifier in the first data message is consistent with the target connection identifier, modify the destination address in the first data message to the address of the backend virtual machine, and encapsulate the modified first data message to generate a second data message; The second data packet is sent to the second virtual switch corresponding to the backend virtual machine.
2. The method according to claim 1, characterized in that: After sending the second data message to the second virtual switch corresponding to the backend virtual machine, the method further includes: Obtain a second reply message sent by the second virtual switch; wherein the generation process of the second reply message includes: the second virtual switch modifies the source address in the first reply message sent by the backend virtual machine to the address of the load balancing node, encapsulates the modified first reply message, and generates the second reply message; the first reply message includes a connection identifier, and the source address of the first reply message is the address of the backend virtual machine, and the destination address is the first address of the front-end virtual machine; The second response message is unsealed, and when the connection identifier in the second response message is consistent with the target connection identifier, the response message generated by the unsealing is sent to the front-end virtual machine.
3. The method according to claim 1, characterized in that After obtaining the first session information sent by the load balancing node, the method further includes: Obtaining a third data message sent by the front-end virtual machine; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node; When the connection identifier in the third data message is consistent with the target connection identifier, modifying the destination address in the third data message to the address of the backend virtual machine, and encapsulating the modified third data message to generate a fourth data message; The fourth data packet is sent to the second virtual switch corresponding to the backend virtual machine.
4. The method according to claim 3, characterized in that After sending the fourth data message to the second virtual switch corresponding to the backend virtual machine, the method further includes: Obtain a fourth reply message sent by the second virtual switch; wherein the generation process of the fourth reply message includes: the second virtual switch modifies the source address in the third reply message sent by the backend virtual machine to the address of the load balancing node, encapsulates the modified third reply message, and generates the fourth reply message; the third reply message includes a connection identifier, and the source address of the third reply message is the address of the backend virtual machine, and the destination address is the second address of the front-end virtual machine; The fourth response message is unsealed, and when the connection identifier in the fourth response message is consistent with the target connection identifier, the response message generated by the unsealing is sent to the front-end virtual machine.
5. The method according to any one of claims 1 to 4, characterized in that After obtaining the first session information sent by the load balancing node, the method further includes: Setting the first session lifetime corresponding to the target connection identifier; When the connection identifier in the received message is consistent with the target connection identifier, the first session lifetime is updated.
6. The method according to claim 5, characterized in that Also includes: When the first session lifetime exceeds a first preset threshold, the first session information is deleted.
7. The method according to claim 1, characterized in that Before obtaining the first session information sent by the load balancing node, the method further includes: Obtaining a first handshake message sent by the front-end virtual machine; the first handshake message includes a connection identifier, and the source address of the first handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the load balancing node; Encapsulate the first handshake message, generate a second handshake message, and send the second handshake message to the load balancing node to instruct the load balancing node to determine the backend virtual machine corresponding to the front-end virtual machine, establish a session, modify the destination address in the second handshake message to the address of the backend virtual machine, generate a third handshake message, and send the third handshake message to the second virtual switch corresponding to the backend virtual machine; Obtaining a response message sent by the load balancing node; the source address of the response message is the address of the load balancing node, and the destination address is the handshake address of the front-end virtual machine; The response message is unsealed and the unsealed response message is sent to the front-end virtual machine.
8. A data transmission method, characterized in that: Applied to the second virtual switch, the method comprises: Acquire second session information sent by the load balancing node; the second session information includes a target connection identifier of the established session; Obtain a second data message sent by the first virtual switch; wherein the generation process of the second data message includes: the first virtual switch modifies the destination address in the first data message sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data message, and generates the second data message; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node; Decapsulating the second data message; When the connection identifier in the second data message is consistent with the target connection identifier, the data message generated by decapsulation is sent to the backend virtual machine.
9. The method according to claim 8, characterized in that The second session information also includes the address of the load balancing node; The method further comprises: Obtaining a first response message sent by the backend virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the backend virtual machine, and the destination address is the first address of the frontend virtual machine; When the connection identifier in the first response message is consistent with the target connection identifier, modify the source address in the first response message to the address of the load balancing node to generate a second response message; The second response message is sent to the first virtual switch corresponding to the front-end virtual machine.
10. The method according to claim 8, characterized in that After obtaining the second session information sent by the load balancing node, the method further includes: Obtain a fourth data message sent by the first virtual switch; wherein the generation process of the fourth data message includes: the first virtual switch modifies the destination address in the third data message sent by the front-end virtual machine to the address of the back-end virtual machine, encapsulates the modified third data message, and generates the fourth data message; the third data message includes a connection identifier, and the source address of the third data message is the second address of the front-end virtual machine, and the destination address is the address of the load balancing node; Decapsulating the fourth data message; When the connection identifier in the fourth data message is consistent with the target connection identifier, the data message generated by decapsulation is sent to the backend virtual machine.
11. The method according to claim 10, characterized in that The second session information also includes the address of the load balancing node; The method further comprises: Obtaining a third response message sent by the backend virtual machine; the third response message includes a connection identifier, and the source address of the third response message is the address of the backend virtual machine, and the destination address is the second address of the frontend virtual machine; When the connection identifier in the third response message is consistent with the target connection identifier, modify the source address in the third response message to the address of the load balancing node to generate a fourth response message; The fourth response message is sent to the first virtual switch corresponding to the front-end virtual machine.
12. The method according to any one of claims 8 to 11, characterized in that After obtaining the second session information sent by the load balancing node, the method further includes: Setting the second session lifetime corresponding to the target connection identifier; When the connection identifier in the received message is consistent with the target connection identifier, the second session lifetime is updated.
13. The method according to claim 12, characterized in that Also includes: When the second session lifetime exceeds a second preset threshold, the second session information is deleted.
14. The method according to claim 8, characterized in that Before obtaining the second session information sent by the load balancing node, the method further includes: Obtain a handshake message sent by the load balancing node; the source address of the handshake message is the handshake address of the front-end virtual machine, and the destination address is the address of the back-end virtual machine; Decapsulating the handshake message, and sending the decapsulated handshake message to the backend virtual machine; Obtaining a first response message sent by the backend virtual machine; the first response message includes a connection identifier, and the source address of the first response message is the address of the backend virtual machine, and the destination address is the handshake address of the frontend virtual machine; The first response message is encapsulated to generate a second response message, and the second response message is sent to the load balancing node to instruct the load balancing node to modify the source address in the second response message to the address of the load balancing node, generate a third response message, and send the third response message to the first virtual switch corresponding to the front-end virtual machine.
15. A data transmission device, characterized in that: Applied to a first virtual switch, the device comprises: A first information acquisition module, used to acquire first session information sent by the load balancing node; the first session information includes a target connection identifier of the established session, an address of the load balancing node, and an address of a backend virtual machine; A first message acquisition module, used to acquire a first data message sent by a front-end virtual machine on the client side; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node; A first processing module, configured to modify the destination address in the first data message to the address of the backend virtual machine, and encapsulate the modified first data message to generate a second data message when the connection identifier in the first data message is consistent with the target connection identifier; The first sending module is used to send the second data message to the second virtual switch corresponding to the backend virtual machine.
16. A data transmission device, characterized in that: Applied to the second virtual switch, the device comprises: A second information acquisition module, used to acquire second session information sent by the load balancing node; the second session information includes a target connection identifier of the established session; The second message acquisition module is used to acquire the second data message sent by the first virtual switch; wherein the generation process of the second data message includes: the first virtual switch modifies the destination address in the first data message sent by the front-end virtual machine on the client side to the address of the back-end virtual machine, encapsulates the modified first data message, and generates the second data message; the first data message includes a connection identifier, and the source address of the first data message is the first address of the front-end virtual machine, and the destination address is the address of the load balancing node; A second processing module, used for decapsulating the second data message; The second sending module is used to send the data message generated by decapsulation to the backend virtual machine when the connection identifier in the second data message is consistent with the target connection identifier.
17. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data transmission method according to any one of claims 1 to 14 by executing the computer instructions.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data transmission method according to any one of claims 1 to 14.
