Data forwarding method and device, computer equipment, storage medium and program product

By reorganizing and sharding the initial shard message, the problem of failure to send shard message is solved, and the adaptation of the same length of the shard message is achieved.

CN119484548AActive Publication Date: 2025-02-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202411781854.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-02-18
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In network transmission, sharded packets may fail to send shard packets because they use fixed-sized data shards.

Method used

By obtaining the initial shard message and its message information, reorganizing it according to the message identification, obtaining the reorganized message, and sharding it according to the initial length of each initial shard message contained in the reorganized message, obtaining the target Shard message.

Benefits of technology

It avoids the problem of failing to send shard messages, ensure that the length of the sharded packet is the same as the length of the initial shard packet, and is adapted to the transmission link.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484548A_ABST
    Figure CN119484548A_ABST
Patent Text Reader

Abstract

The invention relates to a data forwarding method and device, computer equipment, a storage medium and a program product. The method comprises the following steps: acquiring initial fragmented messages and message information of each initial fragmented message; according to the message identifier corresponding to each initial fragmented message, recombining each initial fragmented message to obtain a recombined message; fragmenting the recombined message according to the initial length of each initial fragmented message contained in the recombined message to obtain each target fragmented message; and sending each target fragmented message to a target receiving end corresponding to the target receiving end identifier. According to the scheme, when the recombined message is fragmented, the recombined message is fragmented according to the initial length of each initial fragmented message contained in the recombined message, so that the length of the fragmented message is the same as the length of the initial fragmented message, the problem that the length of the fragmented message obtained after the recombined message is fragmented is not matched with a transmission link is avoided, and the transmission efficiency of the recombined message is improved. And thus, the problem that the fragmented message fails to be sent is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer information processing technology, and in particular to a data forwarding method, device, computer equipment, storage medium and program product. Background Art

[0002] In network transmission, when the size of the Internet Protocol (IP) datagram between networks exceeds the maximum transmission unit (MTU) of the network, the IP datagram needs to be fragmented for transmission in the network. For example, the IP datagram sent by the client is sent to the load balancing after being fragmented. Since the message header of the non-first fragment message does not contain the IP information of the server, the load balancing needs to reassemble the fragmented message, determine the server of each fragment message based on the reassembled data message, and then fragment the reassembled data message and send it to the server.

[0003] In the related art, the reassembled data message is usually divided into data fragments of fixed size. The data fragments of fixed size may not be compatible with the transmission link, which may cause the failure of sending the fragmented message. Summary of the invention

[0004] Based on this, it is necessary to provide a data forwarding method, device, computer equipment, storage medium and program product to address the above technical problems, which can avoid the problem of failure in sending fragmented messages due to the use of fixed-size data fragments.

[0005] In a first aspect, the present application provides a data forwarding method, the method comprising:

[0006] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message;

[0007] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0008] According to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0009] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0010] In one embodiment, fragmenting the reassembled message according to the initial length of each initial fragment message included in the reassembled message to obtain each target fragment message includes:

[0011] Determine the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message;

[0012] The reassembled message is fragmented according to the maximum length to obtain target fragmented messages; wherein the message length of the last target fragmented message is less than or equal to the maximum length.

[0013] In one embodiment, fragmenting the reassembled message according to the initial length of each initial fragment message included in the reassembled message to obtain each target fragment message includes:

[0014] Using the message length of each initial fragment message contained in the reassembled message as the message length of each target fragment message;

[0015] According to the message length of each target fragment message, the reassembled message is fragmented to obtain each target fragment message.

[0016] In one embodiment, the step of reassembling each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message includes:

[0017] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain the intermediate message;

[0018] The initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

[0019] In one embodiment, fragmenting the reassembled message according to the initial length of each initial fragment message included in the reassembled message to obtain each target fragment message includes:

[0020] Verifying whether the reassembled message is complete;

[0021] When the reassembled message is complete, the reassembled message is fragmented according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0022] In one embodiment, the obtaining of each initial fragment message and message information of each initial fragment message includes:

[0023] Obtain each original fragment message sent by the sender;

[0024] The Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in each original fragment message are removed to obtain each initial fragment message and the message information of each initial fragment message.

[0025] In a second aspect, the present application further provides a data forwarding device, the device comprising:

[0026] An acquisition module, used to acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message;

[0027] A reassembly module, used for reassembling each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0028] A fragmentation module, used for fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message;

[0029] The sending module is used to send each target fragment message to the target receiving end corresponding to the target receiving end identifier.

[0030] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:

[0031] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message;

[0032] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0033] According to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0034] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0036] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message;

[0037] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0038] According to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0039] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0040] In a fifth aspect, the present application further provides a computer program product, the computer program product comprising a computer program, which implements the following steps when executed by a processor:

[0041] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message;

[0042] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0043] According to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0044] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0045] The above-mentioned data forwarding method, device, computer equipment, storage medium and program product obtain the initial fragment message and the message information of each initial fragment message; wherein the message information includes the initial length, message identifier and initial receiving end identifier of each initial fragment message; and according to the message identifier corresponding to each initial fragment message, each initial fragment message is reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier; and then according to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message; and each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier. The above scheme, when fragmenting the reassembled message, fragments the reassembled message according to the initial length of each initial fragmented message contained in the reassembled message, so that the length of the message after fragmentation is the same as the length of the initial fragmented message. Compared with reassembling the reassembled message with a fixed fragmentation length, it avoids the problem that the length of the fragmented message obtained after fragmenting the reassembled message is not compatible with the transmission link, thereby avoiding the problem of failure to send the fragmented message. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a flow chart of a data forwarding method in an embodiment;

[0047] Figure 2 A schematic diagram of a process of fragmenting a reassembled message in one embodiment;

[0048] Figure 3 A schematic diagram of message reassembly in an embodiment;

[0049] Figure 4 A schematic diagram of another process of fragmenting a reassembled message in one embodiment;

[0050] Figure 5 A schematic diagram of a process for reassembling each initial fragment message in an embodiment;

[0051] Figure 6 A schematic diagram of another process of fragmenting a reassembled message in an embodiment;

[0052] Figure 7 A schematic diagram of a process for obtaining an initial fragment message and message information in one embodiment;

[0053] Figure 8 A schematic diagram of decapsulating an original fragment message encapsulated by VXLAN in one embodiment;

[0054] Fig. 9 A schematic diagram of another process of data forwarding in one embodiment;

[0055] Fig.10 is a structural block diagram of a data forwarding device in an embodiment;

[0056] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0058] The data forwarding method provided in the embodiment of the present application can be applied to the application scenario where the load balancing receives the fragmented message sent by the client and sends the fragmented message to the server. The method in the embodiment of the present application can be executed by the load balancing, wherein the load balancing can be a proxy server.

[0059] Among them, load balancing can be achieved using an independent server or a server cluster consisting of multiple servers.

[0060] In one embodiment, Figure 1 As shown, a data forwarding method is provided, which is described by taking the method applied to load balancing as an example, and includes the following steps:

[0061] S101, acquiring each initial fragment message and message information of each initial fragment message.

[0062] Exemplarily, the initial fragment message may be sent by the client, and the load balancing receives the initial fragment message sent by the client; and obtains the message information of each initial fragment message from the message header information of the initial fragment message. The message information includes the initial length of the initial fragment message, the message identifier, and the initial receiving end identifier; the message identifier can be used to identify the original data message to which the initial fragment message belongs.

[0063] S102, reassemble the initial fragment messages according to the message identifiers corresponding to the initial fragment messages to obtain a reassembled message.

[0064] Exemplarily, it can be determined whether the initial fragment message is a fragment first. For example, the "DF" (Don't Fragment) and "MF" (More Fragments) bits in the "Flags" field of the IP header in the initial fragment message are used to identify whether it is a fragment message. If the "DF" bit is 0 and the "MF" bit is 1, it means that the message is a fragment message.

[0065] Furthermore, the IP fragment reassembly library of the Data Plane Development Kit (DPDK) can be used to reassemble the message. For example, the initial fragment messages belonging to the same original data message can be determined based on the message identifier corresponding to each initial fragment message, and the reassembly order of each initial fragment message can be determined based on the "fragment offset" field in the message header of each initial fragment message, and then the initial fragment messages can be reassembled to obtain a reassembled message.

[0066] Furthermore, the length of each initial fragment message may be stored. For example, a field MBUF_FIELD_FRAG may be pre-registered in a dynamic domain reserved by a memory buffer (mbuf) to store the initial length of each initial fragment message.

[0067] The IP header data of the reassembled message adopts the IP header data of the first initial fragment message, wherein the IP header data includes the IP identifier of the load balancing. Then, the IP header data of the reassembled message is replaced with the target receiving end identifier, wherein the target receiving end identifier can be the IP identifier of the server.

[0068] Optionally, a scheduling algorithm may be used to select an available backend server as a target receiving end, wherein the scheduling algorithm may be set according to actual needs, for example, may be set to a round-robin scheduling algorithm, and the specific scheduling algorithm is not limited here.

[0069] After determining the target receiving end, you can use the fullnat mode to convert the source IP and source port in the third and fourth layer header data of the reassembled message into the local IP and local port respectively, and convert the destination IP and destination port into the target receiving end IP and target receiving end port.

[0070] S103, fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain target fragment messages.

[0071] Exemplarily, it may be determined first whether it is a reassembled message, for example, it may be determined whether MBUF_FIELD_FRAG of the mbuf header has a value. If so, it is a reassembled message and needs to be sent in fragments.

[0072] Then, the initial length of each initial fragment message contained in the reassembled message can be obtained in the field MBUF_FIELD_FRAG, and the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message. Among them, the three-layer data of each target fragment message has been converted, and the first target fragment message contains the converted four-layer data, and the length of each target fragment message is consistent with the length when the fragment is received.

[0073] S104, sending each target fragment message to the target receiving end corresponding to the target receiving end identifier.

[0074] Then, each target fragment message can be sent to the target receiving end corresponding to the target receiving end identifier. The target receiving end can be a server. In this way, the initial fragment message is forwarded in a load-balanced manner without the client and the server being aware of it, thereby avoiding the problem of inconsistency between the message length of the forwarded target fragment message and the message length of the initial fragment message.

[0075] The above data forwarding method obtains the initial fragment message and the message information of each initial fragment message; wherein the message information includes the initial length, message identifier and initial receiving end identifier of each initial fragment message; and according to the message identifier corresponding to each initial fragment message, each initial fragment message is reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier; and then according to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message; and each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier. In the above scheme, when fragmenting the reassembled message, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message, so that the message length after fragmentation is the same as the initial fragment message length. Compared with reassembling the reassembled message with a fixed fragment length, the problem of the incompatibility between the fragment message length obtained after fragmenting the reassembled message and the transmission link is avoided, thereby avoiding the problem of failure to send the fragment message.

[0076] In some of these embodiments, see Figure 2 , Figure 2 A schematic diagram of a process for fragmenting a reassembled message is provided, which specifically includes the following steps:

[0077] S201, determining the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message.

[0078] See also Figure 3 , Figure 3 A schematic diagram of message reassembly is provided. Before fragmented message reassembly, each fragment exists in a separate mbuf (possibly an mbuf chain), and the initial length of the current fragment is saved in the MBUF_FIELD_FRAG of each mbuf header. After reassembly, the reassembled message is an mbuf chain, and the initial length of the first fragment is saved in the MBUF_FIELD_FRAG of the mbuf header of the reassembled message.

[0079] For example, in order to ensure the correctness and efficiency of data transmission over the network, the IP protocol stipulates that the fragment offset field in the IP datagram must be in units of 8 bytes, that is, the length of each fragment message (except the last fragment) must be a multiple of 8. For example, when the MTU is 1700 (not a multiple of 8), the length of the first fragment is 1696 (less than the MTU), and the length of the last fragment may be less than 1696 or may be 1697-1700; if the length of the first fragment, i.e. 1696, is saved, the last fragment (1697-1700) will be divided into two fragments of length 1696 and 1-4 and sent out during subsequent fragmentation.

[0080] Therefore, each field MBUF_FIELD_FRAG in the mbuf chain, that is, the initial length of each fragment, can be compared, and the largest initial length is selected and saved in the MBUF_FIELD_FRAG of the mbuf header of the reassembled message, and the largest initial length is regarded as the MTU of the subsequent fragments.

[0081] S202, fragment the reassembled message according to the maximum length to obtain target fragmented messages.

[0082] Further, the reassembled message can be fragmented according to the maximum length to obtain each target fragment message. Wherein, the message length of the non-last target fragment message is equal to the maximum length, and the message length of the last target fragment message is less than or equal to the maximum length. In this way, the length of each target fragment message after fragmentation can be the same as that of each initial fragment message. In addition, each target fragment message contains the three-layer header information of the reassembled message, such as the IP identification of the server.

[0083] In an embodiment of the present application, the reassembled message is fragmented according to the maximum length of the initial lengths of each initial fragment message contained in the reassembled message, so that the length of each target fragment message after fragmentation is the same as that of each initial fragment message, thereby achieving load balancing forwarding of the initial fragment message without the client and the server being aware of it, avoiding the problem of inconsistency between the message length of the forwarded target fragment message and the message length of the initial fragment message.

[0084] In some optional implementations, see Figure 4 , Figure 4 Another flow chart of fragmenting a reassembled message is provided, which specifically includes the following steps:

[0085] S401: Use the message length of each initial fragment message included in the reassembled message as the message length of each target fragment message.

[0086] Exemplarily, the message length of each initial fragment message contained in the reassembled message can be pre-stored in the MBUF_FIELD_FRAG field of each mbuf header, and the message length of each initial fragment message can be obtained in the MBUF_FIELD_FRAG field of the mbuf header storing each initial fragment message, and the message length of each initial fragment message contained in the reassembled message is used as the message length of each target fragment message.

[0087] S402, fragmenting the reassembled message according to the message length of each target fragment message to obtain each target fragment message.

[0088] Furthermore, the reassembled message can be fragmented according to the message length of each target fragment message to obtain each target fragment message, so that each target fragment message after fragmentation has the same length as each initial fragment message, and each target fragment message includes the three-layer header information of the reassembled message, such as the IP identifier of the server.

[0089] In an embodiment of the present application, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message, so that the length of each target fragment message after fragmentation is the same as that of each initial fragment message, thereby achieving load balancing forwarding of the initial fragment message without the client and the server being aware of it, avoiding the problem of inconsistency between the message length of the forwarded target fragment message and the message length of the initial fragment message.

[0090] In some optional implementations, see Figure 5 , Figure 5 A schematic diagram of a process for reassembling each initial fragment message is provided, which specifically includes the following steps:

[0091] S501, reassemble the initial fragment messages according to the message identifiers corresponding to the initial fragment messages to obtain an intermediate message.

[0092] Exemplarily, the original data message to which each initial fragment message belongs can be determined first according to the message identifier corresponding to each initial fragment message, and then each initial fragment message is reassembled to obtain an intermediate message. Wherein, the three-layer header information of the intermediate message is the three-layer header information of the first initial fragment message in the intermediate message, for example, the three-layer header information of the first initial fragment message is the IP identifier of the load balancing.

[0093] S502: Replace the initial receiving end identifier corresponding to the intermediate message with the target receiving end identifier to obtain a reassembled message.

[0094] Furthermore, the initial receiving end identifier corresponding to each intermediate message is the layer 3 header information of the first initial fragment message in each intermediate message; the target receiving end identifier is the IP identifier of the server. Then, the initial receiving end identifier corresponding to each intermediate message can be replaced with the target receiving end identifier, that is, the layer 3 header information of the initial fragment message corresponding to each intermediate message is replaced with the IP identifier of the server to obtain a reassembled message.

[0095] In an embodiment of the present application, by reassembling each initial fragment message to obtain the third-layer header information of the intermediate message and replacing it with the identifier of the target receiving end, the receiving end of the reassembled message can be clearly identified, thereby facilitating forwarding the reassembled message to the target end.

[0096] In some optional implementations, in order to avoid forwarding an incomplete data message to a target end, the integrity of the data message may be verified.

[0097] Based on this, see Figure 6 , Figure 6 A further flow chart of fragmenting a reassembled message is provided, which specifically includes the following steps:

[0098] S601, verify whether the reassembled message is complete.

[0099] Exemplarily, it can be determined whether there are any initial fragment messages that have not been received. If the initial fragment message is not received within a preset time period, the received initial fragment message is reassembled to obtain a reassembled message. Then, it can be verified whether the reassembled message is complete. For example, the length of the original data message is compared with the length of the reassembled message to determine whether the reassembled message is complete. If the reassembled message is complete, the length of the original data message is equal to the length of the reassembled message, otherwise, it is considered that the reassembled message is incomplete.

[0100] S602: When the reassembled message is complete, fragment the reassembled message according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0101] Furthermore, when it is determined that the reassembled message is complete, the operation of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message is continued, so that incomplete data messages can be avoided from being sent to the target end, and unnecessary transmission resources and data processing resources can be avoided from being wasted.

[0102] In the embodiment of the present application, by judging whether the reassembled message is complete and discarding the reassembled message if the reassembled message is incomplete, it is avoided that the incomplete data message is sent to the target end, and unnecessary transmission resources and data processing resources are avoided.

[0103] In some optional implementations, when the original fragmented message sent by the sender to the load balancing is a message encapsulated by a virtual eXtensible Local Area Network (VXLAN), an embodiment of the present application provides an implementable method for obtaining the initial fragmented message and the message information of each initial fragmented message.

[0104] For example, see Figure 7 , Figure 7 A schematic diagram of a process for obtaining an initial fragment message and message information of each initial fragment message is provided, which specifically includes the following steps:

[0105] S701, obtaining each original fragment message sent by the sending end.

[0106] Exemplarily, the sender may be a client, and the original fragmented message sent by the sender is obtained, wherein the original fragmented message is a message for VXLAN encapsulation. The message for VXLAN encapsulation is added with a VXLAN header, an external IP header, and a User Datagram Protocol (UDP) header; for example, the message for VXLAN encapsulation may add a VXLAN header before the original IP message, and the header includes information such as a VXLAN network identifier (VNI), a source MAC address, and a destination MAC address. Then, an external IP header and a UDP header are added before the VXLAN header to transmit the encapsulated message on the physical network. The external IP header includes the source IP address and the destination IP address, and the UDP header includes the source port number and the destination port number (usually the standard port 4789 of VXLAN).

[0107] Then, the sender sends each original fragment to the load balancer according to the external IP header and the external UDP header, and the load balancer decapsulates the original fragment message. In this way, the fragment message reassembly can be performed on the same load balancer using the IP fragment reassembly library of DPDK.

[0108] S702, remove the Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in each original fragment message to obtain each initial fragment message and the message information of each initial fragment message.

[0109] Exemplary, participating Figure 8 , Figure 8A schematic diagram of decapsulating an original fragment message encapsulated by VXLAN is provided. The original fragment message encapsulated by VXLAN can be decapsulated, for example, Internet Protocol header information (external IP header), User Datagram Protocol header information (external UDP header) and Virtual Extended Local Area Network header information (VXLAN header) in the original fragment message can be removed to obtain the initial fragment message and the message information of each initial fragment message.

[0110] Exemplarily, the original fragmented message includes an external IP header and an external UDP header, i.e., an outer IP port, and a VXLAN header; the external IP header, the external UDP header, and the VXLAN header are removed to obtain the data part and the innerIP, i.e., the initial fragmented message and the message information of each initial fragmented message.

[0111] Then, the fragmented data can be reassembled to obtain an intermediate message, wherein the header information of the intermediate message is the message information inner IP of the first initial fragment message; then, the header information of the intermediate message can be replaced with the target receiving end identifier, which is Figure 7 The inner IP after conversion is obtained to obtain the reassembled message.

[0112] When the reassembled message is fragmented, the header information of each fragment includes the target receiving end identifier, that is, the converted inner IP.

[0113] In an embodiment of the present application, by performing VXLAN encapsulation on the original fragmented messages, the original fragmented messages belonging to the same original data message can be sent to the same load balancing, thereby facilitating the use of the IP fragment reassembly library of DPDK to reassemble the fragments in the same load balancing.

[0114] In some optional implementations, see Fig. 9 , Fig. 9 Another data forwarding process diagram is provided, which is illustrated by taking the original fragmented message sent by the sender as a VXLAN encapsulated message as an example.

[0115] Step 1: Receive each original fragment message, and decapsulate each original fragment message to obtain each initial fragment message and message information of each initial fragment message.

[0116] Step 2: Determine whether each initial fragment message is a fragment message; if so, execute step 3; if not, execute step 5.

[0117] Step 3: Save the initial length of each initial fragment message, and reassemble each initial fragment message to obtain a reassembled message.

[0118] Step 4: Determine whether the reassembled message is completed. If so, execute step 5; if not, execute step 1.

[0119] Step 5: Select the target receiving end and modify the IP header information of the reassembled message to the IP identifier of the target receiving end.

[0120] Step 6: Determine whether it is a reassembled message. If so, execute step 7; if not, execute step 8.

[0121] Step 7: fragment the reassembled message according to the maximum initial length to obtain target fragmented messages.

[0122] Step 8: Send each target fragment message to the target receiving end.

[0123] In an embodiment of the present application, the IP fragment reassembly library of DPDK is used to reassemble fragmented messages, and the fragmented messages can be processed in the same load balancing. Incomplete reassembled messages will be discarded after expiration, ensuring the correctness of forwarding fragmented messages.

[0124] In addition, the length information of the fragmented message is stored before the message is reassembled to prevent the loss of the fragment length information after reassembly. The reassembled message can be fragmented into the initial length, and the fragmented message can be load balanced and forwarded without the client and server being aware of it, avoiding the problem of inconsistent fragment message length after forwarding.

[0125] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiment of the present application also provides a data forwarding device for implementing the data forwarding method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data forwarding device embodiments provided below can refer to the limitations on the data forwarding method above, and will not be repeated here.

[0127] In one embodiment, Fig.10As shown, a data forwarding device is provided, comprising:

[0128] The acquisition module 10 is used to acquire each initial fragment message and the message information of each initial fragment message; wherein the message information includes the initial length of the initial fragment message, the message identifier and the initial receiving end identifier;

[0129] The reassembly module 20 is used to reassemble each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0130] The fragmentation module 30 is used to fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message;

[0131] The sending module 40 is used to send each target fragment message to the target receiving end corresponding to the target receiving end identifier.

[0132] The above-mentioned data forwarding device obtains the initial fragment message and the message information of each initial fragment message; wherein the message information includes the initial length, message identifier and initial receiving end identifier of each initial fragment message; and according to the message identifier corresponding to each initial fragment message, each initial fragment message is reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier; and then according to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message; and each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier. In the above-mentioned scheme, when fragmenting the reassembled message, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message, so that the message length after fragmentation is the same as the initial fragment message length. Compared with reassembling the reassembled message with a fixed fragment length, the problem of the incompatibility between the fragment message length obtained after fragmenting the reassembled message and the transmission link is avoided, thereby avoiding the problem of failure to send the fragment message.

[0133] In one embodiment, the slicing module 30 is specifically used for:

[0134] Determine the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0135] In one embodiment, the slicing module 30 is specifically used for:

[0136] The message length of each initial fragment message included in the reassembled message is used as the message length of each target fragment message; the reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

[0137] In one embodiment, the recombination module 20 is specifically used for:

[0138] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain an intermediate message; the initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

[0139] In one embodiment, the slicing module 30 is specifically used for:

[0140] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0141] In one embodiment, the acquisition module 10 is specifically used for:

[0142] Obtain each original fragment message sent by the sender; remove the Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in each original fragment message to obtain each initial fragment message and the message information of each initial fragment message.

[0143] Each module in the above data forwarding device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0144] In one embodiment, a computer device is provided, which may be a proxy server, i.e., a load balancing device; its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store message data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data forwarding method is implemented.

[0145] Those skilled in the art will understand that Fig.11The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0146] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0147] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length of the initial fragment message, a message identifier and an initial receiving end identifier;

[0148] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0149] According to the initial lengths of the initial fragment messages contained in the reassembled message, the reassembled message is fragmented to obtain target fragment messages;

[0150] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0151] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0152] Determine the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0153] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0154] The message length of each initial fragment message included in the reassembled message is used as the message length of each target fragment message; the reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

[0155] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0156] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain an intermediate message; the initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0158] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0160] The original fragment message sent by the sender is obtained; the Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in the original fragment message are removed to obtain the initial fragment message and the message information of each initial fragment message.

[0161] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0162] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length of the initial fragment message, a message identifier and an initial receiving end identifier;

[0163] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0164] According to the initial lengths of the initial fragment messages contained in the reassembled message, the reassembled message is fragmented to obtain target fragment messages;

[0165] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0166] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0167] Determine the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0168] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0169] The message length of each initial fragment message included in the reassembled message is used as the message length of each target fragment message; the reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

[0170] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0171] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain an intermediate message; the initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0173] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0174] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0175] The original fragment message sent by the sender is obtained; the Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in the original fragment message are removed to obtain the initial fragment message and the message information of each initial fragment message.

[0176] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0177] Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length of the initial fragment message, a message identifier and an initial receiving end identifier;

[0178] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier;

[0179] According to the initial lengths of the initial fragment messages contained in the reassembled message, the reassembled message is fragmented to obtain target fragment messages;

[0180] Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

[0181] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0182] Determine the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0184] The message length of each initial fragment message included in the reassembled message is used as the message length of each target fragment message; the reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0186] According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain an intermediate message; the initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0188] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial lengths of the initial fragmented messages contained in the reassembled message.

[0189] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0190] The original fragment message sent by the sender is obtained; the Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in the original fragment message are removed to obtain the initial fragment message and the message information of each initial fragment message.

[0191] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0192] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0193] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0194] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data forwarding method, characterized in that: The method comprises: Acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message; According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier; According to the initial length of each initial fragment message contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message; Each target fragment message is sent to the target receiving end corresponding to the target receiving end identifier.

2. The method according to claim 1, characterized in that The fragmenting of the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: Determining the maximum length of the initial lengths of the initial fragment messages contained in the reassembled message; The reassembled message is fragmented according to the maximum length to obtain target fragmented messages; wherein the message length of the last target fragmented message is less than or equal to the maximum length.

3. The method according to claim 1, characterized in that The fragmenting of the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: Using the message length of each initial fragment message contained in the reassembled message as the message length of each target fragment message; According to the message length of each target fragment message, the reassembled message is fragmented to obtain each target fragment message.

4. The method according to claim 1, characterized in that The step of reassembling each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message includes: According to the message identifiers corresponding to the initial fragment messages, the initial fragment messages are reassembled to obtain the intermediate message; The initial receiving end identifier corresponding to the intermediate message is replaced with the target receiving end identifier to obtain a reassembled message.

5. The method according to claim 1, characterized in that The fragmenting of the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: Verifying whether the reassembled message is complete; When the reassembled message is complete, the reassembled message is fragmented according to the initial lengths of the initial fragmented messages contained in the reassembled message.

6. The method according to claim 1, characterized in that The obtaining of each initial fragment message and message information of each initial fragment message includes: Obtain each original fragment message sent by the sender; The Internet Protocol header information, the User Datagram Protocol header information and the Virtual Extended Local Area Network header information in each original fragment message are removed to obtain each initial fragment message and the message information of each initial fragment message.

7. A data forwarding device, characterized in that: The device comprises: An acquisition module, used to acquire each initial fragment message and message information of each initial fragment message; wherein the message information includes an initial length, a message identifier and an initial receiving end identifier of the initial fragment message; A reassembly module, used for reassembling each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message; wherein the reassembled message includes a target receiving end identifier; A fragmentation module, used for fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message; The sending module is used to send each target fragment message to the target receiving end corresponding to the target receiving end identifier.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method and apparatus for IP fragmentation

    CN101488912A

  • Message slicing method and device

    CN102957590A

  • Message fragmentation restructuring method and device

    CN103595661A

  • Data message processing method and device

    CN110581812A

  • Fragmented message recombination method and device

    CN111953620A