Data transmission method, apparatus and electronic device

By establishing a first sub-stream and session information between the terminal and the target server, using a load balancing algorithm to select the target server, and establishing connection information to associate multiple connection identifiers, the problem of multi-path transmission that cannot be achieved under multi-instance deployment is solved, and the stability of multi-path data transmission and full utilization of network resources are realized.

CN115643646BActive Publication Date: 2026-07-24LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2022-10-17
Publication Date
2026-07-24

Smart Images

  • Figure CN115643646B_ABST
    Figure CN115643646B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a data transmission method, device and electronic equipment. After a first sub-flow between a terminal and a target server is established based on a first path, and first session information corresponding to the first sub-flow is established, first connection information is established based on the first session information. The first connection information contains an identifier of the target server in the first session information. The target server is selected from a plurality of servers according to a load balancing algorithm. Each connection identifier in the first connection information and the first session information is associated. When a second sub-flow creation message sent by the terminal is obtained through a second path, the first connection information can be found according to a target connection identifier in the second sub-flow creation message. Then, the second sub-flow creation message is sent to the target server according to the identifier of the target server in the first connection information to establish the second sub-flow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and more specifically, to a data transmission method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the diversification of network access methods for terminal devices, 4G / 5G, Wi-Fi, and Ethernet have become common network access technologies. Terminals often have the ability to access multiple networks simultaneously, such as Wi-Fi and 4G. However, most terminals cannot support the simultaneous use of multiple access networks, i.e., they cannot support multipath transmission. To improve multipath support, many protocols have begun to be designed or extended based on multipath, enabling multipath transmission in some scenarios. However, multipath transmission is still not possible in some scenarios, such as load balancing service scenarios with multiple instances deployed. Summary of the Invention

[0003] The purpose of this application is to provide a data transmission method, apparatus, and electronic device, including the following technical solutions:

[0004] A data transmission method, the method comprising:

[0005] A first sub-stream is established between the terminal and the target server based on the first path, and first session information corresponding to the first sub-stream is also established; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server and at least one connection identifier negotiated between the terminal and the target server.

[0006] A first connection information is established based on the first session information. The first connection information is associated with each of the at least one connection identifiers. The first connection information includes the identifier of the target server.

[0007] The second sub-stream creation message sent by the terminal is obtained through the second path, and the first connection information is found based on the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of the at least one connection identifier.

[0008] The second sub-stream creation message is forwarded to the target server based on the identifier of the target server in the first connection information to establish the second sub-stream.

[0009] Optionally, the above method further includes: establishing second session information corresponding to the second sub-stream based on the first connection information, wherein the second session information contains the identifier of the target server.

[0010] The above methods may optionally include:

[0011] The target message sent by the terminal is obtained through the second path; the target message belongs to the second sub-stream.

[0012] Find the second session information corresponding to the second sub-stream;

[0013] The target message is forwarded to the target server based on the target server identifier in the second session information.

[0014] Optionally, in the above method, the first session information includes at least a first connection identifier and at least one non-first connection identifier; wherein,

[0015] The first connection identifier is negotiated by the terminal and the target server during the process of negotiating the establishment of the first sub-stream;

[0016] The at least one non-first connection identifier is obtained by the terminal and the target server based on the first sub-stream.

[0017] Optionally, the process of negotiating the at least one non-first connection identifier in the above method includes:

[0018] The connection request message sent by the terminal is obtained through the first path, and the connection request message belongs to the first sub-stream;

[0019] Based on the identifier of the target server in the first session information corresponding to the first sub-stream, the connection request message is forwarded to the target server;

[0020] Obtain the response message sent by the target server in response to the connection request message, wherein the response message carries at least one non-first connection identifier assigned;

[0021] Add the at least one non-first connection identifier to the first session message.

[0022] The above methods may optionally include:

[0023] The at least one non-first connection identifier is associated with the first connection information.

[0024] Optionally, in the above method, the target connection identifier is: the first connection identifier; or, the target connection identifier is: any one of the at least one non-first connection identifiers.

[0025] The above methods may optionally include:

[0026] Obtain a connection deletion message sent by the terminal; the connection deletion message belongs to a target sub-stream, and the target sub-stream is either the first sub-stream or the second sub-stream;

[0027] The connection identifier indicated by the deleted connection message is deleted from the first session information and the first connection information, and the association between the connection identifier indicated by the deleted connection message and the first connection information is severed.

[0028] A data transmission apparatus, the apparatus comprising:

[0029] The first establishment module is used to establish a first sub-stream between the terminal and the target server based on a first path, and a first session information corresponding to the first sub-stream; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server, and at least one connection identifier negotiated between the terminal and the target server;

[0030] The second establishment module is used to establish first connection information based on the first session information. The first connection information is associated with each of the at least one connection identifiers and includes the identifier of the target server.

[0031] The lookup module is used to obtain the second sub-stream creation message sent by the terminal through the second path, and to look up the first connection information according to the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of the at least one connection identifier.

[0032] The forwarding module is used to forward the second sub-stream creation message to the target server according to the identifier of the target server in the first connection information, so as to establish the second sub-stream.

[0033] An electronic device, comprising:

[0034] Memory, used to store programs;

[0035] A processor for calling and executing the program in the memory, thereby implementing the steps of the data transfer method as described in any of the preceding claims.

[0036] A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data transmission method as described in any of the preceding claims.

[0037] As can be seen from the above scheme, the data transmission method, apparatus, and electronic device provided in this application, after establishing a first sub-stream between the terminal and the target server based on a first path, and the first session information corresponding to the first sub-stream, establishes first connection information based on the first session information. The first connection information contains the identifier of the target server in the first session information. The target server is selected from multiple servers according to a load balancing algorithm. The first connection information is associated with each connection identifier in the first session information. In this way, when a second sub-stream creation message sent by the terminal is obtained through a second path, the first connection information can be found according to the target connection identifier in the second sub-stream creation message. Then, the second sub-stream creation message is sent to the target server according to the identifier of the target server in the first connection information to establish the second sub-stream. This allows the messages of both the second sub-stream and the first sub-stream to reach the same target server, realizing multi-path data transmission in a load balancing service scenario with multiple instance deployments. Attached Figure Description

[0038] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1a An example diagram of multipath transmission provided in an embodiment of this application;

[0040] Figure 1b An example diagram of a single-path transmission access load balancing service provided in an embodiment of this application;

[0041] Figure 1c An example diagram of a multi-path transmission access load balancing service provided in an embodiment of this application;

[0042] Figure 2 A flowchart illustrating an implementation of the data transmission method provided in this application embodiment;

[0043] Figure 3 A flowchart illustrating an implementation of negotiating at least one non-first connection identifier provided in an embodiment of this application;

[0044] Figure 4 An example diagram illustrating the association between session information and connection information provided in an embodiment of this application;

[0045] Figure 5 A schematic diagram of the structure of a data transmission device provided in an embodiment of this application;

[0046] Figure 6This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0047] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar parts and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that illustrated herein. Detailed Implementation

[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0049] Multipath transmission refers to the use of multiple paths for data communication between communicating parties, which can improve network utilization. For example... Figure 1a The above is an example diagram of multipath transmission provided in the embodiments of this application. In this example, the mobile terminal and the server communicate data simultaneously through two paths: WiFi and 4G network.

[0050] Multi-instance load balancing refers to a service where business services are no longer provided by a single server, but rather by multiple servers that back each other up and have independent business service capabilities. In other words, different servers have the same business service capabilities, but each server provides the service independently. In practical applications, multiple deployed servers provide the actual business services to the terminal side, and the specific server selected to provide the service is determined by the load balancer based on a pre-configured load balancing algorithm. Figure 1b The diagram illustrates an example of a single-path transmission access load balancing service provided in this application. In this example, the mobile terminal communicates with the load balancer via a 4G network path. When the mobile terminal needs to invoke a service, it sends an initialization handshake message to the load balancer via the 4G network. The load balancer creates new session information (denoted as the first session information) in its session table and associates the five-tuple of the initialization handshake message (i.e., source IP address, source port number, protocol number, destination IP address, and destination port number) with the first session information. Based on the load balancing algorithm, it selects one server from multiple servers (denoted as the target server). Figure 1bIn the example shown, the load balancer selects server 1 as the target server based on the load balancing algorithm, forwards the initial handshake message to the target server, and adds the target server's identifier to the first session information. Upon receiving the initial handshake message, the target server creates a new connection identifier (denoted as the first connection identifier) ​​and other relevant parameters, and replies with a message containing the first connection identifier and other relevant parameters. After receiving the target server's reply, the load balancer forwards the reply to the mobile terminal. Upon receiving the target server's reply, the mobile terminal sends a completion handshake message to the load balancer, which carries the first connection identifier. The load balancer uses the 5-tuple carried in the completion handshake message to locate the first session information, and forwards the completion handshake message to the target server based on the target server's identifier in the first session information. The load balancer also adds the first connection identifier to the first session information. After that, the mobile terminal and the target server can interact with each other. Specifically, the mobile terminal can send data packets to the load balancer. The load balancer finds the first session information based on the five-tuple in the data packet, and forwards the data packet to the target server based on the identifier of the target server in the first session information, thus realizing the data transmission between the mobile terminal and the target server.

[0051] Figure 1b In the example shown, the connection between the mobile terminal and the load balancer is a single path. If multi-path transmission were used between the mobile terminal and the load balancer, load balancing services could not be achieved based on current data transmission methods. Figure 1c The diagram illustrates an example of a multi-path transmission access load balancing service provided in this application. In this example, the mobile terminal and the load balancer are connected simultaneously via both WiFi and 4G networks, while the load balancer transmits data to each server via the same path. Assume the mobile terminal first establishes a connection and a first sub-stream with the target server (server 1) via the 4G network. Subsequently, the mobile terminal sends a second sub-stream creation message to the load balancer via the WiFi network. Upon receiving the second sub-stream creation message, the load balancer searches for a session message based on the five-tuple carried in the message. Since the second sub-stream creation message is the first packet of the second sub-stream, the session message cannot be found. At this point, the load balancer re-selects a server from among multiple servers according to the load balancing algorithm and forwards the second sub-stream creation message to the selected server. However, the server selected based on the load balancing strategy is not necessarily server 1 (it could be server 2 or server 3), resulting in the failure to successfully establish the second sub-stream between the mobile terminal and server 1. Consequently, multi-path transmission cannot be achieved, and network resources cannot be fully utilized.

[0052] This application is proposed to achieve multi-path data transmission in load balancing service scenarios with multiple instance deployments. The data transmission method and apparatus provided in the embodiments of this application can be used in a load balancer. The load balancer can be implemented by a single server, a server cluster, or a cloud server.

[0053] like Figure 2 The diagram shown is a flowchart of one implementation of the data transmission method provided in this application, which may include:

[0054] Step S201: Establish a first sub-stream between the terminal and the target server based on the first path, and establish first session information corresponding to the first sub-stream; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server and at least one connection identifier negotiated by the terminal and the target server.

[0055] The terminal can be a mobile terminal, such as a mobile phone, laptop, or tablet, or a desktop device, such as a traditional computer (a computer with a server and monitor that are independent of each other), an all-in-one computer, or other forms of terminal equipment.

[0056] In this application, the terminal and the target server may negotiate only one connection identifier or multiple connection identifiers. The process of negotiating one connection identifier can refer to the aforementioned process of negotiating the first connection identifier, and the process of negotiating multiple connection identifiers can refer to the following embodiments.

[0057] Step S202: Establish first connection information based on the first session information. The first connection information is associated with each of at least one connection identifier. The first connection information contains the identifier of the target server.

[0058] A connection record (denoted as the first connection record) can be created in the connection table based on the first session information. In other words, all connection records are stored in the table (denoted as the connection table). Each of the at least one connection identifier mentioned above is associated with the first connection record, so that the first connection record can be found based on each of the at least one connection identifier mentioned above.

[0059] Step S203: Obtain the second sub-stream creation message sent by the terminal through the second path, and search for the first connection information according to the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of at least one connection identifier.

[0060] Each subflow can be represented by the 5-tuple of the packets in the subflow, that is, the 5-tuples of the packets in the same subflow are the same.

[0061] The target connection identifier can be the first connection identifier, or any non-first connection identifier among the above-mentioned connection identifiers.

[0062] In this application, although the second substream creation message is the first message of the second substream and the corresponding session information cannot be found, the second substream creation message carries a target connection identifier, and the target connection identifier is associated with the first connection information. Therefore, the first connection information can be found, and thus the identifier of the target server can be obtained.

[0063] Step S204: Forward the second sub-stream creation message to the target server according to the identifier of the target server in the first connection information to establish the second sub-stream.

[0064] Because the second substream creation message was forwarded to the target server, the second substream between the terminal and the target server can be successfully established.

[0065] The data transmission method provided in this application establishes a first sub-stream between the terminal and the target server based on a first path, and establishes first session information corresponding to the first sub-stream. Then, it establishes first connection information based on the first session information. The first connection information contains the identifier of the target server in the first session information. The target server is selected from multiple servers according to a load balancing algorithm. The first connection information is associated with each connection identifier in the first session information. In this way, when a second sub-stream creation message sent by the terminal is obtained through a second path, the first connection information can be found according to the target connection identifier in the second sub-stream creation message. Then, the second sub-stream creation message is sent to the target server according to the identifier of the target server in the first connection information to establish the second sub-stream. This ensures that the messages of the second sub-stream and the first sub-stream can reach the same target server, realizing multi-path data transmission in a load balancing service scenario with multiple instance deployments.

[0066] In an optional embodiment, the data transmission method provided in this application may further include:

[0067] After forwarding the second substream creation message to the target server, the second session information corresponding to the second substream is established based on the first connection information. The second session information contains the identifier of the target server.

[0068] After creating the second session information, the second session information can be associated with the second substream. Specifically, the second session information can be associated with the 5-tuple of the second substream creation message.

[0069] Optionally, in addition to the identifier of the target server, the first connection information may also include at least one of the aforementioned connection identifiers, as well as identifiers for each target session; wherein, the target session information is session information that has the same connection identifier as the first connection information. Of course, both the target session information and the first connection information contain the identifier of the target server.

[0070] Furthermore, the data transmission method provided in this application may also include:

[0071] The target message sent by the terminal is obtained through the second path; the target message belongs to the second sub-flow, that is, the five-tuple of the target message represents the second sub-flow. The target message can be a data message, a negotiation message, or other types of messages. The target message is not the first message in the second sub-flow.

[0072] Locate the second session information corresponding to the second substream. The second session information can be found based on the five-tuple of the target message.

[0073] The target message is forwarded to the target server based on the target server identifier carried in the second session information.

[0074] In other words, in this application, session information is a fast lookup table, which is suitable for fast traffic forwarding, while connection information is a general lookup table, which is suitable for sub-stream creation in load balancing service scenarios.

[0075] In an optional embodiment, the first session information includes at least two connection identifiers, specifically including: a first connection identifier and at least one non-first connection identifier; wherein,

[0076] The first connection identifier is negotiated between the terminal and the target server during the negotiation process of establishing the first sub-stream. The specific negotiation process is described in the aforementioned embodiments and will not be repeated here.

[0077] The aforementioned non-first connection identifier is obtained by the terminal and the target server based on the first sub-stream.

[0078] Optionally, an implementation flowchart of negotiating at least one non-first connection identifier provided in this application embodiment is as follows: Figure 3 As shown, it may include:

[0079] Step S301: Obtain the connection request message sent by the terminal through the first path. The connection request message belongs to the first sub-stream.

[0080] A connection request message is used to request a new connection identifier. The terminal can request a new connection identifier immediately after the first sub-stream is created, or it can request one some time after the first sub-stream is created (i.e., after transmitting data with the target server for a period of time through the first sub-stream). The terminal can send a connection request message when it detects the existence of a second path. The terminal may detect the existence of the second path before establishing the first sub-stream, or it may detect it some time after the first sub-stream is established. If the second path is detected before establishing the first sub-stream, the terminal can request a new connection identifier immediately after the first sub-stream is created, or it can request one some time after transmitting data with the target server through the first sub-stream. If the second path is detected some time after the first sub-stream is established, the terminal can only send the connection request message some time after the first sub-stream is established. Of course, the terminal can also send a connection request message to request a new connection identifier even if the second path is not detected. In this case, when the second path is detected, it is not necessary to request a new connection identifier; the already requested connection identifier can be used directly, thereby improving data transmission efficiency.

[0081] Step S302: Based on the identifier of the target server in the first session information corresponding to the first sub-stream, forward the connection request message to the target server.

[0082] The session information corresponding to the five-tuple carried in the connection request message can be found. Since the connection request message belongs to the first sub-stream, the session information found is the first session information.

[0083] Step S303: Obtain the response message sent by the target server in response to the connection request message. The response message carries at least one non-first connection identifier.

[0084] The connection request message can carry the number of connections to be requested, assuming it is M. Then the target server will create M non-first connection identifiers, that is, create M connections between the terminal and the target server. The identifiers of these M connections are the M non-first connection identifiers.

[0085] Step S304: Add at least one non-first connection identifier to the first session message.

[0086] This application also adds at least one non-first connection identifier negotiated based on the first sub-stream to the first session message corresponding to the first sub-stream, so that the first session message has multiple connection identifiers.

[0087] Optionally, the target connection identifier carried in the second sub-stream creation message can be the first connection identifier, or any one of the above-mentioned non-first connection identifiers.

[0088] In summary, this application establishes a session information for each sub-stream, with different sub-streams corresponding to different session information. The session information for different sub-streams contains the same server identifier and connection identifier. Each connection identifier in the corresponding session message for different sub-streams is associated with the same connection information. This connection information contains the server identifier from the session message, and may further include the connection identifier from the session message, and may also include the identifiers of each session information.

[0089] like Figure 4 The diagram shown illustrates an example of the association between session information and connection information provided in this application embodiment. This example uses two sub-streams and two connection identifiers for illustration. Each row in the session table represents a session information entry. The session identifier `session_idk` uniquely identifies the k-th (k = 1, 2, 3, ..., n) session information entry. The source information `original_infok` represents the source information of the k-th sub-stream, `target_infok` represents the destination information of the k-th sub-stream, `server_idk` is the identifier of the server to which the k-th sub-stream flows, and `connection_id_veck` represents a set of session identifiers negotiated based on the k-th sub-stream. Each row in the connection table represents a connection information entry, and `cidj` uniquely identifies the j-th (j = 1, 2, 3, ..., m) connection information entry.

[0090] Figure 4 In the example shown, a first sub-stream is established between the terminal and the target server based on the first path, along with the first session information corresponding to the first sub-stream. Figure 4 The middle part contains session information identified by session_id2, and a set of connection identifiers in the first session information ( Figure 4 The connection information (represented by connection_id_vec2) includes at least a first connection identifier and a second connection identifier. The first connection identifier is negotiated and determined during the negotiation of the first sub-stream between the terminal and the target server, while the second connection identifier is obtained through negotiation between the terminal and the target server based on the first sub-stream. After establishing the first session information, the first connection information is established in the connection table. Figure 4The first connection information is identified by the connection identifier cid2, and this first connection information is associated with each connection identifier connection_id in connection_id_vec2 (specifically, connection identifier cid2 can be associated with each connection identifier connection_id in connection_id_vec2, using connection identifier cid2 as an index of the first connection information, so that after finding connection identifier cid2, connection information identified by cid2 can be found). Thus, connection information identified by cid2 can be found based on each connection_id in connection_id_vec2. Later, when obtaining the second sub-stream creation message through the second path, the second sub-stream creation message carries the second connection identifier. Since the session table cannot be found, the first connection information can be found through the second connection identifier, and then through the server identifier in the first connection information (…). Figure 4 If the first connection information is used (e.g., server_id2), the second substream creation message is forwarded to the target server identified by server_id2 to establish the second substream. Afterwards, a second session message corresponding to the second substream can be established based on the first connection information. Figure 4 The first session information (session_id3) identifies the session information. The server_id2 and connection_id_vec2 in the second session information are determined based on the first connection information. The source information (original_info3) and destination information (target_info3) can be determined based on the packet creation in the second sub-stream. When a packet belonging to the second sub-stream is received, the second session information can be directly retrieved, and then the packet can be forwarded to the target server based on the server_id2 in the second session information.

[0091] Similarly, if a third sub-stream creation message is obtained through a third path, the processing flow for the second sub-stream creation message can be referenced to process the third sub-stream creation message. Then, based on the first connection information, the third sub-stream creation message can be forwarded to the target server. Furthermore, third session information corresponding to the third sub-stream can be created based on the first connection information. The server_id2 and connection_id_vec2 in the third session information are determined based on the first connection information, while the source information original_info4 and destination information target_info4 can be determined based on the third sub-stream creation message. When a message belonging to the third sub-stream is received again, the third session information can be directly retrieved, and then the message can be forwarded to the target server based on the server_id2 in the third session information.

[0092] Furthermore, after establishing a second or third sub-stream, a new connection can be applied for through the second or third sub-stream. The specific application process can be referred to the aforementioned process of applying for a new connection based on the first sub-stream, which will not be detailed here.

[0093] In practical applications, connection updates may occur. Therefore, in an optional embodiment, the data transmission method provided in this application may further include:

[0094] A connection update message sent by the terminal is received. This connection update message belongs to a target sub-stream, which can be either a first sub-stream or a second sub-stream. The connection update message indicates that a third connection identifier is used for data transmission. The third connection identifier is an unused connection identifier from at least one connection identifier contained in the first session information.

[0095] Since the third connection identifier is already recorded in the first connection information and the first connection information, the load balancer can directly forward the connection update message to the target server.

[0096] Furthermore, the load balancer can also obtain connection deletion messages sent by the terminal, which belong to the target sub-flow. The target sub-flow can be either the first sub-flow or the second sub-flow.

[0097] The load balancer removes the connection identifier indicated by the delete connection message from the first session information and the first connection information, and decouples the connection identifier indicated by the delete connection message from the first connection information. If a second session is established, the connection identifier indicated by the delete connection message is also removed from the second session information.

[0098] Based on this application, the establishment, updating, and deletion of multiple connections can be realized, ensuring the stability of multi-path data transmission.

[0099] Corresponding to the method embodiments, this application also provides a data transmission device. A schematic diagram of a data transmission device provided in this application is shown below. Figure 5 As shown, it may include:

[0100] The system comprises a first creation module 501, a second creation module 502, a lookup module 503, and a forwarding module 504; wherein...

[0101] The first establishment module 501 is used to establish a first sub-stream between the terminal and the target server based on a first path, and first session information corresponding to the first sub-stream; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server, and at least one connection identifier negotiated between the terminal and the target server.

[0102] The second establishment module 502 is used to establish first connection information based on the first session information. The first connection information is associated with each of the at least one connection identifiers. The first connection information includes the identifier of the target server.

[0103] The lookup module 503 is used to obtain the second sub-stream creation message sent by the terminal through the second path, and to look up the first connection information according to the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of the at least one connection identifier;

[0104] The forwarding module 504 is used to forward the second sub-stream creation message to the target server according to the identifier of the target server in the first connection information, so as to establish the second sub-stream.

[0105] The data transmission apparatus provided in this application establishes a first sub-stream between a terminal and a target server based on a first path, and establishes first session information corresponding to the first sub-stream. Then, it establishes first connection information based on the first session information. The first connection information includes the identifier of the target server in the first session information. The target server is selected from multiple servers based on a load balancing algorithm. The first connection information is associated with each connection identifier in the first session information. Thus, when a second sub-stream creation message sent by the terminal is obtained through a second path, the first connection information can be found based on the target connection identifier in the second sub-stream creation message. Then, the second sub-stream creation message is sent to the target server based on the identifier of the target server in the first connection information to establish the second sub-stream. This ensures that messages from both the second and first sub-streams can reach the same target server, realizing multi-path data transmission in a load-balanced service scenario with multiple instance deployments.

[0106] In an optional embodiment, the data transmission device may further include a third establishment module, configured to: establish second session information corresponding to the second sub-stream based on the first connection information, wherein the second session information includes the identifier of the target server.

[0107] In an optional embodiment, the lookup module 503 may also be used for:

[0108] The target message sent by the terminal is obtained through the second path; the target message belongs to the second sub-stream.

[0109] Find the second session information corresponding to the second sub-stream;

[0110] The forwarding module 504 can also be used to: forward the target message to the target server according to the target server identifier in the second session information.

[0111] In an optional embodiment, the first session information includes at least a first connection identifier and at least one non-first connection identifier; wherein,

[0112] The first connection identifier is negotiated by the terminal and the target server during the process of negotiating the establishment of the first sub-stream;

[0113] The at least one non-first connection identifier is obtained by the terminal and the target server based on the first sub-stream.

[0114] In an optional embodiment, the forwarding module 504 is further configured to: obtain a connection request message sent by the terminal through the first path, wherein the connection request message belongs to the first sub-stream; and forward the connection request message to the target server according to the identifier of the target server in the first session information corresponding to the first sub-stream;

[0115] The data transmission device further includes an adding module, configured to obtain a response message sent by the target server in response to the connection request message, wherein the response message carries at least one allocated non-first connection identifier; and add the at least one non-first connection identifier to the first session message.

[0116] In an optional embodiment, the data transmission device further includes an association module for associating the at least one non-first connection identifier with the first connection information.

[0117] In an optional embodiment, the target connection identifier is: the first connection identifier; or, the target connection identifier is: any one of the at least one non-first connection identifiers.

[0118] In an optional embodiment, the data transmission device further includes an association module for:

[0119] Obtain a connection update message sent by the terminal; the connection update message belongs to a target sub-flow, the target sub-flow being either the first sub-flow or the second sub-flow; the connection update message indicates that the third connection identifier should be updated to a fourth connection identifier; associate the fourth connection identifier with the first connection information.

[0120] Corresponding to the method embodiments, this application also provides an electronic device, a schematic diagram of which is shown below. Figure 6 As shown, it may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4.

[0121] In this embodiment, the number of processor 1, communication interface 2, memory 3, and communication bus 4 is at least one, and processor 1, communication interface 2, and memory 3 communicate with each other through communication bus 4.

[0122] Processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0123] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device.

[0124] The memory 3 stores a program, and the processor 1 can call the program stored in the memory 3. The program is used for:

[0125] A first sub-stream is established between the terminal and the target server based on the first path, and first session information corresponding to the first sub-stream is also established; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server and at least one connection identifier negotiated between the terminal and the target server.

[0126] A first connection information is established based on the first session information. The first connection information is associated with each of the at least one connection identifiers. The first connection information includes the identifier of the target server.

[0127] The second sub-stream creation message sent by the terminal is obtained through the second path, and the first connection information is found based on the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of the at least one connection identifier.

[0128] The second sub-stream creation message is forwarded to the target server based on the identifier of the target server in the first connection information to establish the second sub-stream.

[0129] Optionally, the refined and extended functions of the program can be found in the description above.

[0130] This application embodiment also provides a storage medium that can store a program suitable for execution by a processor, the program being used for:

[0131] A first sub-stream is established between the terminal and the target server based on the first path, and first session information corresponding to the first sub-stream is also established; the target server is selected from multiple servers according to a load balancing algorithm; the first session information includes the identifier of the target server and at least one connection identifier negotiated between the terminal and the target server.

[0132] A first connection information is established based on the first session information. The first connection information is associated with each of the at least one connection identifiers. The first connection information includes the identifier of the target server.

[0133] The second sub-stream creation message sent by the terminal is obtained through the second path, and the first connection information is found based on the target connection identifier carried in the second sub-stream creation message; the target connection identifier is any one of the at least one connection identifier.

[0134] The second sub-stream creation message is forwarded to the target server based on the identifier of the target server in the first connection information to establish the second sub-stream.

[0135] Optionally, the refined and extended functions of the program can be found in the description above.

[0136] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0137] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0138] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0139] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0140] It should be understood that in the embodiments of this application, the claims, various embodiments, and features can be combined with each other to solve the aforementioned technical problems.

[0141] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0142] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data transmission method, the method comprising: A first sub-stream is established between the terminal and the target server based on the first path, along with first session information corresponding to the first sub-stream; The target server is selected from multiple servers based on a load balancing algorithm; the first session information includes the identifier of the target server, as well as a first connection identifier negotiated between the terminal and the target server and at least one non-first connection identifier; the first connection identifier is negotiated by the terminal and the target server during the process of negotiating the establishment of the first sub-stream; The at least one non-first connection identifier is obtained by the terminal and the target server based on the first sub-stream; A first connection information is established based on the first session information. The first connection information is associated with each of the first connection identifier and at least one non-first connection identifier. The first connection information includes the identifier of the target server. The second sub-stream creation message sent by the terminal is obtained through the second path, and the first connection information is found based on the target connection identifier carried in the second sub-stream creation message. The target connection identifier is any one of the first connection identifier and at least one non-first connection identifier; The second sub-flow creation message is forwarded to the target server according to the identifier of the target server in the first connection information, so as to establish the second sub-flow; The process of negotiating the at least one non-first connection identifier includes: The connection request message sent by the terminal is obtained through the first path, and the connection request message belongs to the first sub-stream; wherein, the terminal sends the connection request message immediately after the first sub-stream is created, or the terminal sends the connection request message without detecting the second path; Based on the identifier of the target server in the first session information corresponding to the first sub-stream, the connection request message is forwarded to the target server; Obtain the response message sent by the target server in response to the connection request message, wherein the response message carries at least one non-first connection identifier assigned; Add the at least one non-first connection identifier to the first session information.

2. The method according to claim 1, further comprising: Based on the first connection information, a second session information corresponding to the second sub-stream is established, and the second session information contains the identifier of the target server.

3. The method according to claim 2, further comprising: The target message sent by the terminal is obtained through the second path; The target message belongs to the second sub-stream; Find the second session information corresponding to the second sub-stream; The target message is forwarded to the target server based on the target server identifier in the second session information.

4. The method according to claim 1, further comprising: The at least one non-first connection identifier is associated with the first connection information.

5. The method according to claim 1, wherein the target connection identifier is: the first connection identifier; or, the target connection identifier is: any one of the at least one non-first connection identifier.

6. The method according to any one of claims 1-5, further comprising: Obtain the connection deletion message sent by the terminal; The connection deletion message belongs to the target sub-flow, and the target sub-flow is either the first sub-flow or the second sub-flow; The connection identifier indicated by the deleted connection message is deleted from the first session information and the first connection information, and the association between the connection identifier indicated by the deleted connection message and the first connection information is severed.

7. A data transmission apparatus, the apparatus comprising: The first establishment module is used to establish a first sub-stream between the terminal and the target server based on the first path, and the first session information corresponding to the first sub-stream; The target server is selected from multiple servers based on a load balancing algorithm; the first session information includes the identifier of the target server, as well as a first connection identifier negotiated between the terminal and the target server and at least one non-first connection identifier; the first connection identifier is negotiated by the terminal and the target server during the process of negotiating the establishment of the first sub-stream; The at least one non-first connection identifier is obtained by the terminal and the target server based on the first sub-stream; The second establishment module is used to establish first connection information based on the first session information. The first connection information is associated with each of the first connection identifier and at least one non-first connection identifier. The first connection information includes the identifier of the target server. The lookup module is used to obtain the second sub-stream creation message sent by the terminal through the second path, and to look up the first connection information according to the target connection identifier carried in the second sub-stream creation message; The target connection identifier is any one of a first connection identifier and at least one non-first connection identifier; The forwarding module is used to forward the second sub-flow creation message to the target server according to the identifier of the target server in the first connection information, so as to establish the second sub-flow; Substreams use connection identifiers for data transmission; The process of negotiating the at least one non-first connection identifier includes: The connection request message sent by the terminal is obtained through the first path, and the connection request message belongs to the first sub-stream; wherein, the terminal sends the connection request message immediately after the first sub-stream is created, or the terminal sends the connection request message without detecting the second path; Based on the identifier of the target server in the first session information corresponding to the first sub-stream, the connection request message is forwarded to the target server; Obtain the response message sent by the target server in response to the connection request message, wherein the response message carries at least one non-first connection identifier assigned; Add the at least one non-first connection identifier to the first session information.

8. An electronic device, comprising: Memory, used to store programs; A processor is configured to invoke and execute the program in the memory, thereby implementing the various steps of the data transmission method as described in any one of claims 1-6.