Message sending and receiving method, related device and medium
By dividing messages into sub-messages in a shared connection and using token buckets to control the sending order, the head-resistance problem is solved, and the fairness and efficiency of data transmission are achieved.
Patent Information
- Application Number
- CN202410613298.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-05-17
AI Technical Summary
In the shared connection mode, larger messages will lead to the inability to ensure the transmission timeliness of small messages, resulting in head-to-blocking problems, affecting the fairness of data transmission.
Divide the messages in the message queue into sub-messages, and set a token bucket for each sub-message queue. The token bucket controls the sending order of messages to ensure that small messages can be sent first.
It reduces the head-resistance problem, improves the fairness of data transmission of shared connections, enables small messages to be sent before large messages, and ensures the fairness and efficiency of data transmission.
Smart Images

Figure CN118869610B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data communications, and in particular to a message sending and receiving method, related devices, and media. Background Art
[0002] In a data center network, connections between server nodes can be categorized as exclusive or shared. Each server node hosts multiple applications. In the exclusive connection mode, a single connection is created for the same application on both the source and destination server nodes, transferring data only for that application. In the shared connection mode, all applications on both the source and destination server nodes share a single connection, transferring data between the various applications on the source and destination server nodes.
[0003] In a shared connection mode, a large header blocking problem often occurs. For example, assuming that the total bandwidth between the source server node and the destination server node is 10GB, application 1 on the source server node and the destination server node has a 1GB message to transmit, and application 2 has a 1MB message to transmit. Normally, if a 1MB message is sent first and then a 1GB message is sent, it only takes 0.8ms to send the 1MB message, and 800.8ms to send the 1GB message. This ensures the timeliness of the small message without slowing down the transmission process of the large message too much, because the transmission process of the large message is already very time-consuming and is not sensitive to a slight increase in time consumption. However, if the 1GB message is placed in front of the 1MB message, it will take 800.8ms for the 1MB message to be sent, and the transmission timeliness of the small message is almost not guaranteed, which results in a header blocking problem. Summary of the Invention
[0004] The embodiments of the present disclosure provide a message sending and receiving method, related devices, and media, which can reduce header blocking problems and improve the fairness of shared connection data transmission.
[0005] According to one aspect of the present disclosure, a message sending method is provided for a source node, wherein the source node has multiple applications, each of the applications corresponds to a message queue and a sub-message queue, and the message sending method includes:
[0006] Based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application is divided into sub-messages, and the sub-messages are placed in the sub-message queue corresponding to the application;
[0007] Setting a token bucket for each of the sub-message queues, wherein the token bucket is filled with tokens at a first token placement rate until the token bucket is full;
[0008] Poll the sub-message queues corresponding to each of the applications. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, take out the head sub-message and send it, and take out tokens of the number of byte lengths from the token bucket corresponding to the sub-message queue, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0009] According to one aspect of the present disclosure, a message receiving method is provided for a destination node, where the destination node has multiple applications. The message receiving method includes:
[0010] Receive a message from the source node, the message having a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of the message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs, wherein the sub-message is separated from the message in the source node based on a maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application, a token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled, and if the byte length of the head sub-message in the sub-message queue is not greater than a first token number, the head sub-message is taken out and sent, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue;
[0011] Based on the message identifier and the sub-message identifier, restoring the message to the sub-message corresponding to the sub-message identifier;
[0012] Based on the sub-message identifier, the message identifier, and the offset, the sub-message is restored to the message corresponding to the message identifier.
[0013] According to one aspect of the present disclosure, a message sending device is provided for a source node, wherein the source node has multiple applications, each application corresponds to a message queue and a sub-message queue, and the message sending device includes:
[0014] a message dividing unit, configured to divide the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and put the sub-messages into the sub-message queue corresponding to the application;
[0015] A first setting unit is configured to set a token bucket for each of the sub-message queues, wherein the token bucket is configured to place tokens at a first token placement rate until the token bucket is full;
[0016] A polling unit is used to poll the sub-message queues corresponding to each of the applications. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, and tokens of the number of byte lengths are taken out from the token bucket corresponding to the sub-message queue, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0017] Optionally, the maximum sub-message size corresponding to different applications is different;
[0018] The message is divided into units specifically for:
[0019] Obtaining the maximum sub-message size corresponding to the application;
[0020] If the message in the message queue corresponding to the application is not larger than the maximum sub-message size, treating the message as a sub-message and putting it into the sub-message queue corresponding to the application;
[0021] If the message in the message queue corresponding to the application is larger than the maximum sub-message size, the sub-messages are separated from the message according to the maximum sub-message size and placed in the sub-message queue corresponding to the application.
[0022] Optionally, the sub-message queue includes a plurality of sub-message sub-queues, each of the sub-message sub-queues has a different maximum sub-message size, and each of the sub-message sub-queues shares the token bucket corresponding to the sub-message queue;
[0023] The polling unit is specifically configured to:
[0024] Setting a sub-queue sequence number for each of the sub-message sub-queues;
[0025] When polling one of the sub-message queues, specifying a sub-queue sequence number through a sub-queue sequence number designator, wherein the probability ratio of the sub-queue sequence numbers of the sub-message sub-queues specified by the sub-queue sequence number designator is equal to the ratio of the maximum sub-message sizes of the sub-message sub-queues;
[0026] If the byte length of the head sub-message in the sub-message sub-queue corresponding to the sub-queue sequence number specified by the sub-queue sequence number designator is not greater than the first token number, the head sub-message is taken out and sent.
[0027] Optionally, the message sending device further includes:
[0028] A first acquiring unit, configured to acquire the priority of the application corresponding to the sub-message queue;
[0029] A first determining unit, configured to determine a remaining capacity in the token bucket corresponding to the sub-message queue;
[0030] The second determining unit is configured to determine the first token placement rate based on the priority and the remaining capacity.
[0031] Optionally, the message is divided into units and is further used for:
[0032] Dividing the messages in the message queue corresponding to the application into message basic units;
[0033] Inspecting the message basic units one by one in order from front to back, inputting the message basic unit to be examined and the previous message basic unit into a connection smoothness evaluation model to obtain a connection smoothness score, using each message basic unit before the message basic unit to be examined as an anchor sequence, and a connection sequence of each previous message basic unit and the message basic unit to be examined as a sequence to be examined, and inputting the anchor sequence and the sequence to be examined into a similarity evaluation model to obtain a similarity score;
[0034] Based on the connection smoothness score, the similarity score, and the maximum sub-message size, the message in the message queue corresponding to the application is divided into sub-messages, and placed into the sub-message queue corresponding to the application.
[0035] Optionally, the message is divided into units and is further used for:
[0036] If the connection smoothness score is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, then continue to examine the next message basic unit of the message basic unit to be examined until the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, and treat the sequence to be examined as the sub-message and put it into the sub-message queue corresponding to the application.
[0037] Optionally, the polling unit is specifically configured to:
[0038] Taking out the head sub-message of the queue and placing it into a sending queue shared by multiple sub-message queues;
[0039] Taking out the sub-message from the sending queue and splitting it into messages;
[0040] Allocating one of a plurality of candidate paths to the separated message;
[0041] The message is sent to the destination node through the assigned candidate path.
[0042] Optionally, the polling unit is further configured to:
[0043] Assigning a message sending sequence number to each of the sent messages through the assigned candidate path;
[0044] Creating a first message bitmap, the first message bitmap comprising bits corresponding to the sequence numbers of the messages sent, wherein the bits corresponding to the sequence numbers of the messages sent are initialized to a first value;
[0045] Recording the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs in a first mapping table;
[0046] The message sending sequence number, the message identifier, the sub-message identifier, the message identifier, the offset, the application identifier and the allocated candidate path identifier are added to the message, and sent to the destination node through the allocated candidate path.
[0047] Optionally, the message sending device further includes:
[0048] a second receiving unit, configured to receive a confirmation response from the destination node, wherein the confirmation response includes the message sending sequence number and the candidate path identifier;
[0049] a first forwarding unit, configured to forward the confirmation response to the candidate path corresponding to the candidate path identifier, so that the candidate path sets the bit corresponding to the message sending sequence number in the first message bitmap to a second value;
[0050] The first search unit is configured to search the first mapping table for the message identifier, the sub-message identifier, the message identifier, the offset, and the application identifier corresponding to the message sending sequence number through the candidate path.
[0051] Optionally, the message sending device further includes:
[0052] a first creating unit, configured to assign the message identifier to the split message, and create a first sub-message bitmap corresponding to the sub-message identifier, wherein the first sub-message bitmap includes a bit corresponding to each message identifier, wherein the bit corresponding to each message identifier is initialized to the first value;
[0053] The first setting unit is configured to set the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier to the second value.
[0054] Optionally, the message sending device further includes:
[0055] a second creating unit, configured to assign the sub-message identifier to the separated sub-message, and create a first message bitmap corresponding to the message identifier, wherein the first message bitmap includes a bit corresponding to each sub-message identifier, wherein the bit corresponding to each sub-message identifier is initialized to the first value;
[0056] a second setting unit, configured to search, according to the offset, for a bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier if the bits corresponding to each of the message identifiers in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value;
[0057] a third setting unit, configured to set the bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier to the second value;
[0058] The first notification unit is configured to notify the application corresponding to the application identifier if the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value.
[0059] According to one aspect of the present disclosure, a message receiving apparatus is provided for a destination node, where the destination node has multiple applications. The message receiving apparatus includes:
[0060] A first receiving unit is configured to receive a message from the source node, wherein the message has a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of the message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs, wherein the sub-message is separated from the message in the source node based on a maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application, a token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled, and if the byte length of the head sub-message in the sub-message queue is not greater than a first token number, the head sub-message is taken out and sent, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue;
[0061] a first restoring unit, configured to restore the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier;
[0062] The second restoring unit is configured to restore the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset.
[0063] Optionally, the first reduction unit is specifically configured to:
[0064] If the second sub-message bitmap corresponding to the sub-message identifier does not exist at the destination node, create the second sub-message bitmap;
[0065] If the bit corresponding to the message identifier does not exist in the second sub-message bitmap, creating a bit corresponding to the message identifier in the second sub-message bitmap, and initializing the bit corresponding to the message identifier to a first value;
[0066] The bit corresponding to the message identifier in the second sub-message bitmap is set to a second value, and the message is restored to the sub-message corresponding to the sub-message identifier according to the message identifier.
[0067] Optionally, the second reduction unit is specifically configured to:
[0068] If the bits corresponding to the respective message identifiers in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, and the destination node does not exist in the second message bitmap corresponding to the message identifier, then creating the second message bitmap;
[0069] If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, creating a bit corresponding to the sub-message identifier in the second message bitmap according to the offset, and initializing the bit corresponding to the sub-message identifier to a first value;
[0070] The bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier is set to the second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset.
[0071] Optionally, the message receiving device further includes:
[0072] A second notification unit is configured to notify the application corresponding to the application identifier if the bits corresponding to the sub-message identifiers in the second message bitmap corresponding to the message identifier are all set to the second value.
[0073] Optionally, the message further includes a message sending sequence number and a candidate path identifier of a candidate path for transmitting the message;
[0074] The message receiving device further includes:
[0075] Forwarding the message to the candidate path corresponding to the candidate path identifier;
[0076] a third creating unit, configured to create the second message bitmap through the candidate path if the second message bitmap corresponding to the candidate path identifier does not exist;
[0077] a fourth creating unit, configured to create a bit corresponding to the message identifier in the second message bitmap if the bit corresponding to the message identifier does not exist in the second message bitmap, and initialize the bit corresponding to the message identifier to a first value;
[0078] a third setting unit, configured to set the bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier to the second value;
[0079] Among them, the step of restoring the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier is performed under the premise that the bits corresponding to each message identifier in the second message bitmap corresponding to the candidate path identifier are set to the second value.
[0080] Optionally, the message receiving device further includes:
[0081] A first generating unit is configured to generate a confirmation response, wherein the confirmation response includes the message sending sequence number and the candidate path identifier;
[0082] The first sending unit is configured to send the confirmation response to the source node.
[0083] According to one aspect of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the method described above when executing the computer program.
[0084] According to one aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0085] According to one aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. The computer program is read and executed by a processor of a computer device, so that the computer device performs the method described above.
[0086] In an embodiment of the present disclosure, based on the maximum sub-message size corresponding to an application, messages in a message queue corresponding to an application are divided into sub-messages and placed into the corresponding sub-message queue. Since messages are divided into smaller sub-messages, even if sub-messages differ in size and a larger sub-message creates a header block for a smaller sub-message, the larger sub-message is much smaller than the entire message. Therefore, even if a header block occurs, the effect is not significant. Each application may correspond to a different maximum sub-message size. Dividing sub-messages based on the maximum sub-message size corresponding to an application allows applications that frequently generate large messages to be assigned an appropriate maximum sub-message size based on their nature, further mitigating the header block effect. A token bucket is provided for each sub-message queue. Tokens are added to the token bucket at a first token rate. When polling a sub-message queue, if the byte length of the head sub-message in that sub-message queue is found to be no greater than the number of tokens in the token bucket, the head sub-message is removed and sent, and the corresponding token is deducted from the token bucket. If the byte length is greater than the number of tokens in the token bucket, the head sub-message is not removed and sent. This way, if a large message is divided into sub-messages that are still large, the tokens accumulated in the token bucket during polling may not be enough to send the sub-message, and polling will continue to poll the sub-message queues of other applications. If there are smaller sub-messages in the sub-message queues of other applications, the tokens accumulated in the corresponding token buckets are sufficient to send the sub-messages, and they may be sent before the larger sub-messages, avoiding header blocking. This method reduces the occurrence of header blocking and improves the fairness of data transmission on shared connections.
[0087] Other features and advantages of the present disclosure will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present disclosure. The purposes and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] The accompanying drawings are used to provide a further understanding of the technical solution of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the technical solution of the present disclosure and do not constitute a limitation to the technical solution of the present disclosure.
[0089] Figure 1A and Figure 1B is an architecture diagram of a system to which the message sending and receiving method provided in accordance with an embodiment of the present disclosure is applied;
[0090] Figure 2A 1 is a schematic diagram of the software form of a server applied by the message sending and receiving method according to an embodiment of the present disclosure;
[0091] Figure 2BSchematic diagram of the hardware form of a server used in the message sending and receiving method according to an embodiment of the present disclosure;
[0092] Figure 3A and Figure 3B It is a schematic diagram of the message sending and receiving method and related technologies provided by the embodiments of the present disclosure for simultaneously transmitting messages of various sizes in a shared connection scenario;
[0093] Figure 4 This is an overall flow chart of the message sending method provided by the embodiment of the present disclosure;
[0094] Figure 5A and Figure 5B It is a transmission diagram of a message sending method in the related art;
[0095] Figures 6A to 6C This is a transmission diagram of the message sending method provided by an embodiment of the present disclosure;
[0096] Figure 7 This is a schematic diagram of the overall flow of the message sending and receiving method provided by the embodiment of the present disclosure;
[0097] Figure 8 yes Figure 4 A flow chart of placing a sub-message into a sub-message queue in step 410;
[0098] Figure 9 yes Figure 8 A schematic diagram of putting a sub-message into the sub-message queue;
[0099] Figure 10 yes Figure 4 Another flow chart of placing the sub-message into the sub-message queue in step 410;
[0100] Figure 11 yes Figure 10 A schematic diagram of putting a sub-message into the sub-message queue;
[0101] Figure 12 yes Figure 10 A flowchart of dividing the message in the message queue into sub-messages in step 1030;
[0102] Figure 13 yes Figure 4 A flowchart of polling the sub-message queues corresponding to each application in step 430;
[0103] Figure 14 yes Figure 13 A schematic diagram of polling the sub-message queues corresponding to each application;
[0104] Figure 15 yes Figure 4A flow chart of taking out and sending the head sub-message in step 430;
[0105] Figure 16 This is a flow chart of creating a first message bitmap and a first mapping table provided by an embodiment of the present disclosure;
[0106] Figure 17A This is a schematic diagram of splitting a message into packets and allocating them to candidate paths provided by an embodiment of the present disclosure;
[0107] Figure 17B is a schematic diagram of a first mapping table provided in an embodiment of the present disclosure;
[0108] Figure 18A This is a schematic diagram of the message format of a message sent by a source node provided by an embodiment of the present disclosure;
[0109] Figure 18B This is a schematic diagram of the message format of the confirmation response provided by the embodiment of the present disclosure;
[0110] Figure 19 is a schematic diagram of the processing of each bitmap at a source node provided by an embodiment of the present disclosure;
[0111] Figure 20 This is a flow chart of processing a first message bitmap and a first mapping table based on a confirmation response provided by an embodiment of the present disclosure;
[0112] Figure 21 is a flow chart of first sub-message bitmap processing provided by an embodiment of the present disclosure;
[0113] Figure 22 is a flow chart of first message bitmap processing provided by an embodiment of the present disclosure;
[0114] Figure 23 is a flow chart of determining a first token placement rate provided by an embodiment of the present disclosure;
[0115] Figure 24 This is an overall flow chart of the message receiving method provided by the embodiment of the present disclosure;
[0116] Figure 25 It is a transmission diagram of the message receiving method provided by an embodiment of the present disclosure;
[0117] Figure 26 is a schematic diagram of the processing of each bitmap at a destination node provided by an embodiment of the present disclosure;
[0118] Figure 27 yes Figure 24 A flowchart of restoring the message to the sub-message corresponding to the sub-message identifier in step 2420;
[0119] Figure 28 yes Figure 24 In step 2430, a flow chart is shown in which the sub-message is restored to the message corresponding to the message identifier;
[0120] Figure 29 This is a flow chart of a destination node notifying an application corresponding to an application identifier provided by an embodiment of the present disclosure;
[0121] Figure 30 is a flowchart of processing a second message bitmap in a candidate path provided by an embodiment of the present disclosure;
[0122] Figure 31 This is a flow chart of generating and sending a confirmation response provided by an embodiment of the present disclosure;
[0123] Figure 32A and Figure 32B This is a performance comparison diagram of the message sending and receiving method and related methods provided by the embodiments of the present disclosure;
[0124] Figure 33A and Figure 33B is another performance comparison diagram of the message sending and receiving method and related methods provided by the embodiments of the present disclosure;
[0125] Figure 34 is an implementation detail diagram of a message sending and receiving method according to an embodiment of the present disclosure;
[0126] Figure 35 is a module diagram of a message sending device according to an embodiment of the present disclosure;
[0127] Figure 36 is a module diagram of a message receiving device according to an embodiment of the present disclosure;
[0128] Figure 37 is a structural diagram of a terminal for executing a message sending and receiving method according to an embodiment of the present disclosure;
[0129] Figure 38 1 is a diagram of a server structure for executing a message sending and receiving method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0130] In order to make the purpose, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not intended to limit the present disclosure.
[0131] Before further explaining the embodiments of the present disclosure in detail, the nouns and terms involved in the embodiments of the present disclosure are explained. The nouns and terms involved in the embodiments of the present disclosure are subject to the following interpretations:
[0132] A message is the unit of data exchanged and transmitted within a network, a block of data that a node sends at once. Messages are also the unit of network transmission. During transmission, they are continuously encapsulated into packets, packets, and frames. Encapsulation involves adding information segments, which are the data organized in a certain format by the message header. Messages contain the complete data to be transmitted and are of varying length, with no limit and variable length.
[0133] Multipath transmission refers to a technology that uses multiple paths simultaneously for data transmission within a network. Traditional network transmission methods use only a single path to transmit data. If this path fails or becomes congested, data transmission fails or delays increase. Multipath transmission technology, on the other hand, can utilize multiple paths simultaneously for data transmission, improving network bandwidth utilization, data transmission reliability, and reducing transmission delays.
[0134] Shared connections: A method of communication between servers. In a shared connection, application communications between a pair of servers are conducted over a single shared connection, with different messages sent serially within the connection. Shared connections can significantly reduce the number of connections, thereby alleviating network card scalability issues caused by a large number of connections.
[0135] Data center network: It is a complex arrangement of network devices such as routers, switches, and interfaces that work together to provide faster and more reliable network services.
[0136] In a data center network, connections between server nodes can be categorized as exclusive or shared. Each server node hosts multiple applications. In the exclusive connection mode, a single connection is created for the same application on both the source and destination server nodes, transferring data only for that application. In the shared connection mode, all applications on both the source and destination server nodes share a single connection, transferring data between the various applications on the source and destination server nodes.
[0137] In a shared connection mode, a large header blocking problem often occurs. For example, assuming that the total bandwidth between the source server node and the destination server node is 10GB, application 1 on the source server node and the destination server node has a 1GB message to transmit, and application 2 has a 1MB message to transmit. Normally, if a 1MB message is sent first and then a 1GB message is sent, it only takes 0.8ms to send the 1MB message, and 800.8ms to send the 1GB message. This ensures the timeliness of the small message without slowing down the transmission process of the large message too much, because the transmission process of the large message is already very time-consuming and is not sensitive to a slight increase in time consumption. However, if the 1GB message is placed in front of the 1MB message, it will take 800.8ms for the 1MB message to be sent, and the transmission timeliness of the small message is almost not guaranteed, which results in a header blocking problem.
[0138] Based on this, the embodiments of the present disclosure provide a message sending and receiving method, related devices and media, which can reduce the header blocking problem and improve the fairness of shared connection data transmission.
[0139] System architecture and scenario description of the application of the embodiments of the present disclosure
[0140] Figure 1A and Figure 1B 1 is a system architecture diagram of a method for sending and receiving messages according to an embodiment of the present disclosure, comprising: a target terminal 110, the Internet 120, a gateway 130, and a server 140.
[0141] The target terminal 110 is a device used by the target to send or receive messages corresponding to the target message. It can include various forms, such as desktop computers, laptops, PDAs (personal digital assistants), mobile phones, in-vehicle terminals, home theater terminals, and dedicated terminals. Furthermore, it can be a single device or a collection of multiple devices. For example, multiple devices connected via a local area network and sharing a common display device can collectively constitute a terminal. The target terminal 110 can also communicate with the Internet 120 via wired or wireless means to exchange data.
[0142] The gateway 130, also known as a gateway or protocol converter, implements network interconnection at the transport layer and is a computer system or device that performs a conversion function. It acts as a translator between two systems using different communication protocols, data formats, or languages, or even completely different architectures. The gateway 130 also provides filtering and security functions. Messages sent by the target terminal 110 to the message sending processor 140 are sent to the corresponding message sending processor 140 via the gateway 130. Messages sent by the message sending processor 140 to the target terminal 110 are also sent to the corresponding target terminal 110 via the gateway 130.
[0143] The server 140 refers to a computer system that can provide message sending or receiving services. Compared to the target terminal 110, the message sending processor 140 has higher requirements in terms of stability, security, and performance. The message sending processor 140 can be a high-performance computer in the network platform, a cluster of multiple high-performance computers, a portion of a high-performance computer (such as a virtual machine), a combination of portions of multiple high-performance computers (such as virtual machines), etc. In addition, the server 140 includes a message sending server and a message receiving server. The message sending server and the message receiving server can communicate with the Internet of Things 120 via wired or wireless means to exchange data, thereby realizing communication between the message sending server and the message receiving server.
[0144] Figure 2A It is a schematic diagram of the software form of the server applied by the message sending and receiving method according to the embodiment of the present disclosure. Figure 2B It is a schematic diagram of the hardware form of the server applied by the message sending and receiving method according to the embodiment of the present disclosure. The message sending and receiving method provided by the embodiment of the present disclosure is mainly used in the transport layer. As the underlying transmission technology, the embodiment of the present disclosure can provide data transmission services for upper-layer applications through a unified transmission interface. For example, through the traditional socket interface, it provides applications with a transmission similar to the Transmission Control Protocol (TCP), and can also provide high-performance remote direct data access (RDMA) through the IB Verbs interface. Provide high-throughput and low-latency network transmission. Figure 2A As shown, the embodiment of the present disclosure can be implemented as a software process of the server 120, using a standard network card to send and receive data packets. Figure 2B As shown, the embodiment of the present disclosure can be implemented as a hardware process of the server 120, namely the transmission core of the smart network card, to improve throughput and latency performance.
[0145] In addition, refer to Figure 2A and Figure 2B The message sending and receiving method provided in the embodiments of the present disclosure can provide data transmission services for artificial intelligence (AI) training, cloud storage, virtual cloud network (VPC), remote dictionary service (Redis) database, etc.
[0146] The embodiments of the present disclosure can be applied in various scenarios, such as Figure 3A and Figure 3B The scenario shown is where multiple application messages of different sizes are sent through a shared connection.
[0147] Figure 3A This is a schematic diagram of the related art in which multiple application messages of different sizes are sent through a shared connection. Message 1 is a message from application 1, message 2 is a message from application 2, and message 3 is a message from application 3. At the source node, the order in which the messages come from the applications is message 1, message 2, and message 3. In addition, the length of message 1 is 6, the length of message 2 is 1, and the length of message 3 is 4. The order in which the destination node receives messages from the source node is message 1, message 2, and message 3. It can be seen that each message is sent according to its generation time in the application, and the transmission failure of messages with smaller lengths, namely message 2 and message 3, cannot be guaranteed, and there is a header blocking problem.
[0148] Figure 3B It is a schematic diagram of the sending of application messages of various sizes through a shared connection in an embodiment of the present disclosure. The length of message 1 is 6, the length of message 2 is 1, and the length of message 3 is 4, and the order in which the messages come from the application at the source node is message 1, message 2, and message 3. Message 1, message 2, and message 3 are processed based on the message sending and receiving method provided in the embodiment of the present disclosure to send them to the destination node. For each message, the order in which the destination node receives it is message 2, message 3, and message 1. It can be seen that even if a relatively small message is received at the source node, it can be sent before a message with a larger length, reducing the header blocking problem.
[0149] In addition, the message sending and receiving method of the embodiment of the present disclosure can enable applications to obtain the bandwidth or transmission rate they deserve more accurately. For example, assuming that the total bandwidth between the source server node and the destination server node is 10GB, the source server node and the destination server node are equipped with a total of 10 applications, each application needs to occupy 1GB of bandwidth, wherein application 1 has a 1GB message to be transmitted, and application 2 has a 1MB message to be transmitted. In the related art, if the 1GB message is placed in front of the 1MB message, it takes 800ms to send the 1GB message, and it takes 800.8ms to send the 1MB message. Among them, the sending speed of the 1MB message is too slow, and the sending of the 1GB message occupies 10GB of bandwidth. The embodiment of the present disclosure can enable both application 1 and application 2 to accurately enjoy the service of 1GB bandwidth. Even if the 1GB message is generated faster than the 1MB message, the 1MB message can be sent first. Specifically, the 1GB message takes 8s to send, while the 1MB message only takes 8ms to send.
[0150] It should be understood that the above content only illustrates some application scenarios of the present disclosure. The business scenarios to which the present disclosure can be applied may include but are not limited to the specific embodiments listed above.
[0151] General description of the embodiments of the present disclosure
[0152] It should be emphasized that the embodiments of the present disclosure are applicable to a variety of application scenarios, such as scenarios where multiple application messages of different sizes are sent through a shared connection. Related technologies: When a large message (such as a 1GB message) is placed before a small message (such as a 1MB message), the transmission timeliness of the small message is almost not guaranteed, resulting in a header blocking problem. Some embodiments of the present disclosure provide a message sending and receiving method, related devices, and media, which can reduce the header blocking problem and improve the fairness of shared connection data transmission.
[0153] The message sending and receiving method is the process of transmitting messages between the source node and the destination node. The message sending method is the process of processing the message at the source node and sending the message to the destination node, and the message receiving method is the process of receiving the message from the source node at the destination node. This message sending and receiving method can reduce the header blocking problem and improve the fairness of shared connection data transmission.
[0154] The message sending and receiving method of the embodiment of the present disclosure is executed on the server 140 of the source node and the destination node. The server 140 of the source node processes the message from the object terminal 110 and transmits it to the server 140 of the destination node. After the transmission is completed, the destination node transmits the received message to the object terminal 110 through the gateway 130 and the Internet 120, and the object terminal 110 displays it to the target object.
[0155] like Figure 4 As shown, according to one embodiment of the present disclosure, a message sending method is used for a source node, the source node has multiple applications, each application corresponds to a message queue and a sub-message queue, and the message sending method includes:
[0156] Step 410: Based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application is divided into sub-messages and placed into the sub-message queue corresponding to the application;
[0157] Step 420: Set a token bucket for each sub-message queue, and add tokens to the token bucket at a first token placement rate until the token bucket is full.
[0158] Step 430: poll the sub-message queues corresponding to each application. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, take out the head sub-message and send it, and take out tokens of the byte length number from the token bucket corresponding to the sub-message queue, where the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0159] It should be noted that applications can generate messages, and these messages are specifically generated based on the operations or set instructions of the object on the terminal. Message queues and sub-message queues correspond to applications. A message queue is a queue that stores messages from the corresponding message queue. In addition, messages can be split into sub-messages, and sub-message queues are queues used to store sub-messages. Multiple sub-messages in a sub-message queue belong to messages from the same application.
[0160] Steps 410 to 430 are described in detail below.
[0161] In step 410, based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application is divided into sub-messages and placed into the sub-message queue corresponding to the application.
[0162] The maximum sub-message size corresponds to each application. The maximum sub-message size refers to the maximum size of a sub-message transmitted between a source node and a destination node. Different applications correspond to different maximum sub-message sizes, and the maximum sub-message size can be allocated and set based on the nature of the application. Specifically, the maximum sub-message size is allocated based on the size of the messages generated by the corresponding application. The larger the messages generated by the application, and the more frequently the application generates large messages, the larger the maximum sub-message size corresponding to the application. For example, the source node is configured with conversation-type applications and news push-type applications. The maximum sub-messages corresponding to conversation-type applications and news push-type applications are different. In conversation-type applications, the messages sent between the two parties in a conversation are usually only a few words, while the news messages that need to be pushed by news push-type applications are usually over 100 words. Therefore, the maximum sub-message size of conversation-type applications is smaller than that of news push-type applications. The maximum sub-message allocated for conversation-type applications is 30 sub-messages, while the maximum sub-message allocated for news push-type applications is 200 sub-messages.
[0163] like Figure 6A As shown, each application corresponds to a message queue, and the message queue stores messages generated by the application corresponding to the message queue. Based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application can be split to obtain multiple sub-messages, and the sub-messages are placed in the sub-message queue corresponding to the application. Since the message has been split into smaller sub-messages, and the size of the large sub-message is much smaller than the size of the entire message, even if the sub-messages still have differences in size and cause header blocking problems, the header blocking effect is not obvious.
[0164] Assume that message A is 1MB in size and message B is 1GB in size, and the maximum sub-message size corresponding to message A is 1KB, while the maximum sub-message size corresponding to message B is 1MB. Message A takes 0.8ms to send, and message B takes 800ms to send. Therefore, the maximum sub-message corresponding to message A takes 0.78125 microseconds to send, and the maximum sub-message corresponding to message B takes 781.25 microseconds to send. The maximum sub-message corresponding to message B is unlikely to cause a header block on the maximum sub-message corresponding to message A, and even if a header block is formed, the header block is not noticeable.
[0165] It should be noted that there are various methods for splitting a message into sub-messages. If the message size is larger than the maximum sub-message size, the message can be split into multiple sub-messages of equal size, with the size of each sub-message smaller than the maximum sub-message size. Alternatively, the message can be split into multiple sub-messages of the same size, or the message can be randomly split into multiple sub-messages, as long as the sub-message size is smaller than the maximum sub-message size.
[0166] In step 420, a token bucket is set for each sub-message queue, and tokens are placed into the token bucket at a first token placement rate until the token bucket is full.
[0167] The token bucket corresponds to the sub-message queue. The token bucket is an algorithm tool used to control the removal of sub-messages from the sub-message queue. The token bucket is an algorithm for flow control and rate limiting. Flow control refers to the control of the flow of sub-messages sent, and rate limiting refers to the control of the sub-message sending rate. Figure 6B Token buckets are set up one-to-one with sub-message queues. The token bucket can be used to control the sending rate of sub-messages in the sub-message queue. The setting of token buckets can effectively control the sending rate of sub-messages, reducing overcrowding and security risks.
[0168] The tokens in the token bucket represent the sending rights of the sub-messages in the sub-message queue. The number of tokens in the token bucket determines whether the sub-messages in the sub-message queue can be sent.
[0169] The first token placement rate refers to the rate at which tokens are placed into a token bucket. The first token placement rate can be set as needed. Multiple token buckets can correspond to the same first token placement rate, or each token bucket can be assigned a specific first token placement rate. The first token placement rate can remain fixed during message transmission and reception, or it can be adjusted as needed to adjust the rate at which sub-messages are removed from the sub-message queue.
[0170] It should be noted that the token bucket capacity can be set as needed, as long as the token bucket capacity, i.e., the maximum number of tokens it can hold, is greater than or equal to the maximum number of bytes of sub-messages in its corresponding sub-message queue. Alternatively, the token bucket capacity can be considered to be greater than or equal to the maximum sub-message size of its corresponding sub-message queue.
[0171] It should be noted that the number of tokens added to the token bucket within the time period X is the product of the first token placement rate and the application limit bandwidth of the source node corresponding to the token bucket.
[0172] In step 430, the sub-message queues corresponding to each application are polled. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, and tokens of the byte length number are taken out from the token bucket corresponding to the sub-message queue, where the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0173] The first token number refers to the number of tokens in the token bucket corresponding to the sub-message queue, and the token bucket puts tokens at a first token placement rate, so the first token number changes in real time.
[0174] The head sub-message refers to the first sub-message at the head of a sub-message queue. Sub-message queues follow the first-in, first-out principle. Therefore, when polling a sub-message queue, it is necessary to determine whether to send the head sub-message in that sub-message queue. Specifically, if the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is removed and sent, and tokens corresponding to the byte length are removed from the sub-message queue. However, if the byte length of the head sub-message in the sub-message queue is greater than the first token number, the number of tokens accumulated in the token bucket is insufficient to send the message. In this case, the sub-message queues of other applications will be polled. If there are smaller sub-messages in the sub-message queues of other applications, the number of tokens accumulated in the corresponding token bucket is sufficient for sending the sub-message, and the sub-message may be sent before the larger sub-message, avoiding header blocking.
[0175] Assume that the byte length of the head sub-message in sub-message queue A is 20 bytes. When polling sub-message queue A, if the first token in the token bucket corresponding to sub-message queue A is 30, then the head sub-message in sub-message queue A is removed and sent. When polling sub-message queue A, if the first token in the token bucket corresponding to sub-message queue A is 15, then the sub-message queues of other applications are polled.
[0176] Figure 5A and Figure 5BThis is a schematic diagram of a message sending and receiving method in related art. Applications 1, 2, and 3 generate messages in sequence. The source node places multiple messages into the send queue based on the order in which they are generated. Since the send queue follows the first-in, first-out principle, the order in which the source node sends the multiple messages is the same as the order in which they are generated: message 1, message 2, and message 3. However, the sizes of messages 2 and 3 are much smaller than message 1. Message 1 creates a header block for messages 2 and 3, affecting the transmission timeliness of messages 2 and 3.
[0177] Figures 6A to 6C This is a schematic diagram of a message sending and receiving method in an embodiment of the present disclosure. The embodiment of the present application divides a large message into multiple smaller sub-messages based on the maximum sub-message size corresponding to the application, then polls the sub-message queues of each application, and controls the sending of sub-messages based on the first token number corresponding to the sub-message queue. Figure 6C , the order in which the source node sends multiple messages is message 2, message 3, and message 1. It can be clearly seen that in the embodiment of the present disclosure, small messages can be sent first before large messages, which reduces the occurrence of header blocking problems and improves the fairness of shared connection data transmission.
[0178] Reference Figure 7 , the source node divides the messages in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and places the sub-messages into the sub-message queue corresponding to the application. Afterwards, a token bucket is set for each sub-message queue, and tokens are placed into the token bucket according to the first token placement rate. The sub-message queues corresponding to each application are polled. When a sub-message queue is polled, if the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent to the destination node, and tokens of the byte length number are taken out from the token bucket corresponding to the sub-message queue to control the sending of the next sub-message in the sub-message queue. If the byte length of the head sub-message in the sub-message queue is greater than the first token number, the sub-message queues of other applications are polled.
[0179] In the embodiment of steps 410 to 430 described above, based on the maximum sub-message size corresponding to the application, messages in the message queue corresponding to the application are divided into sub-messages and placed into the corresponding sub-message queue. Since the message has been divided into smaller sub-messages, even if there are differences in size between the sub-messages and a larger sub-message creates a header block for the smaller sub-messages, the larger sub-message is much smaller than the entire message. Therefore, even if a header block occurs, the effect is not significant. Each application may have a different maximum sub-message size. Dividing sub-messages based on the maximum sub-message size corresponding to the application allows applications that frequently generate large messages to be assigned an appropriate maximum sub-message size based on their characteristics, further mitigating the header block effect. A token bucket is provided for each sub-message queue. Tokens are added to the token bucket at a first token rate. When polling a sub-message queue, if the byte length of the head sub-message in that sub-message queue is found to be less than the number of tokens in the token bucket, the head sub-message is removed and sent, and the corresponding token is deducted from the token bucket. If the byte length is greater than the number of tokens in the token bucket, the head sub-message is not removed and sent. This way, if a large message is divided into sub-messages that are still large, the tokens accumulated in the token bucket during polling may not be enough to send the sub-message, and polling will continue to poll the sub-message queues of other applications. If there are smaller sub-messages in the sub-message queues of other applications, the tokens accumulated in the corresponding token buckets are sufficient to send the sub-messages, and they may be sent before the larger sub-messages, avoiding header blocking. This method reduces the occurrence of header blocking and improves the fairness of data transmission on shared connections.
[0180] The above is a general description of steps 410 to 430. Since step 420 has been described in sufficient detail above, only the specific implementation process of steps 410 and 420 will be described in detail below.
[0181] Detailed description of step 410
[0182] In step 410, based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application is divided into sub-messages and placed into the sub-message queue corresponding to the application.
[0183] In one embodiment, different applications have different maximum sub-message sizes. Figure 8 , step 410 includes:
[0184] Step 810: Obtain the maximum sub-message size corresponding to the application;
[0185] Step 820: If the message in the message queue corresponding to the application is not larger than the maximum sub-message size, the message is placed as a sub-message in the sub-message queue corresponding to the application;
[0186] Step 830: If the message in the message queue corresponding to the application is larger than the maximum sub-message size, separate sub-messages from the message according to the maximum sub-message size and put them into the sub-message queue corresponding to the application.
[0187] Steps 810 to 830 are described in detail below.
[0188] In step 810, the maximum sub-message size corresponding to the application is obtained.
[0189] The maximum sub-message size is application-specific and refers to the maximum size of a sub-message transmitted between a source node and a destination node. Different applications have different maximum sub-message sizes, and the maximum sub-message size is assigned based on the size of the messages generated by the application.
[0190] The maximum sub-message size can be determined based on the average or clipped average of the sizes of multiple historical messages generated by the application. In addition, the maximum sub-message size also needs to be determined based on the message sizes generated by other applications at the source node to reduce the differences between sub-messages corresponding to multiple applications.
[0191] In step 820, if the message in the message queue corresponding to the application is not larger than the maximum sub-message size, the message is treated as a sub-message and placed in the sub-message queue corresponding to the application.
[0192] If a message in an application's message queue is no larger than the maximum sub-message size, the message does not need to be split and can be placed as a sub-message in the application's sub-message queue. For example, if Message A in Application A's message queue is 20 bytes long and the maximum sub-message size is 30 bytes, Message A can be placed directly as a sub-message in the sub-message queue.
[0193] In step 830, if the message in the message queue corresponding to the application is larger than the maximum sub-message size, sub-messages are separated from the message according to the maximum sub-message size and placed in the sub-message queue corresponding to the application.
[0194] If the message in the message queue corresponding to the application is larger than the maximum sub-message size, then the message needs to be split into multiple sub-messages to reduce the header blocking effect. Specifically, the embodiment of the present disclosure separates sub-messages from the message according to multiple maximum sub-message sizes and puts them into the sub-message queue corresponding to the application. The size of the multiple sub-messages obtained by splitting is the maximum sub-message size. Assuming that the size of message B in the message queue corresponding to application B is 100 bytes, and the maximum sub-message size corresponding to application B is 30 bytes, then message B can be split into three sub-messages of 30 bytes and one sub-message of 10 bytes.
[0195] The sub-messages are separated from the message according to the maximum sub-message size. This method of splitting the message minimizes the number of sub-messages obtained, thereby increasing the rate of splitting at the source node and thus improving the efficiency of message sending.
[0196] Additionally, when a message in an application's message queue is larger than the maximum sub-message size, other methods exist for splitting the message. Specifically, a message can be split into multiple sub-messages of equal size, with the resulting sub-messages being smaller than the maximum sub-message size. For example, if Message B in Application B's message queue is 100 bytes long, and the maximum sub-message size for Application B is 30 bytes, Message B can be split into four 25-byte sub-messages. Alternatively, a message can be randomly split into multiple sub-messages, as long as the sub-message size is smaller than the maximum sub-message size.
[0197] Figure 9 Figure 2 shows how messages in the message queue corresponding to application A are split. Message 1 is smaller than the maximum sub-message size corresponding to application A, so message 1 is placed directly into the sub-message queue as a sub-message. Message 2 is larger than the maximum sub-message size corresponding to application A, so sub-messages are split from message 2 based on the maximum sub-message size. Specifically, message 2 is split into two sub-messages, one of which is the maximum sub-message size, and the other is smaller than the maximum sub-message size.
[0198] The embodiment of steps 810 to 830 above splits the messages in the message queue based on the maximum sub-message size corresponding to the application. Specifically, when the message is not larger than the maximum sub-message size, the message is treated as a sub-message. When the message is larger than the maximum sub-message size, the message is split into multiple sub-messages according to the maximum sub-message size. The embodiment of the present disclosure splits a large message into multiple smaller sub-messages by the maximum sub-message size, thereby reducing the header blocking problem. In addition, the method of splitting messages minimizes the number of sub-messages obtained, improves the rate of splitting by the source node, and improves the efficiency of message sending.
[0199] In another embodiment, referring to Figure 10 , step 410 includes:
[0200] Step 1010: Divide the messages in the message queue corresponding to the application into basic message units;
[0201] Step 1020: Examine the message basic units one by one in order from front to back, input the message basic unit to be examined and the previous message basic unit into the connection smoothness evaluation model to obtain a connection smoothness score, use each message basic unit before the message basic unit to be examined as an anchor sequence, and the connection sequence of each message basic unit before and the message basic unit to be examined as the sequence to be examined, and input the anchor sequence and the sequence to be examined into the similarity evaluation model to obtain a similarity score;
[0202] Step 1030: Based on the connection smoothness score, the similarity score, and the maximum sub-message size, the message in the message queue corresponding to the application is divided into sub-messages, and placed into the sub-message queue corresponding to the application.
[0203] Steps 1010 to 1030 are described in detail below.
[0204] In step 1010, the messages in the message queue corresponding to the application are divided into basic message units.
[0205] The basic unit of a message is the most fundamental component of a message. This unit can be a character, word, sentence, or paragraph. The specific nature of the application determines the basic unit. For example, conversational applications typically generate messages consisting of a few characters. To improve message segmentation accuracy, the basic unit is a single character. Meanwhile, news feed applications typically transmit news of several hundred or even several thousand characters. In this case, to improve message segmentation efficiency, the basic unit of a news feed application can be a character, sentence, or paragraph.
[0206] Assuming that the message in the message queue is "Happy Birthday to you", then the message basic unit corresponding to the message can be "wish", "you", "birthday", "day", "happy", "happy", or "wish", "you", "birthday", "happy".
[0207] In step 1020, the message basic units are examined one by one in order from front to back, and the message basic unit to be examined and the previous message basic unit are input into the connection smoothness evaluation model to obtain a connection smoothness score. The message basic units before the message basic unit to be examined are used as anchor sequences, and the connection sequence of the previous message basic units and the message basic unit to be examined is used as the sequence to be examined, and the anchor sequence and the sequence to be examined are input into the similarity evaluation model to obtain a similarity score.
[0208] The connection smoothness assessment model is used to evaluate the connection smoothness between two message units. The output of the connection smoothness assessment model is a connection smoothness score, which indicates the connection smoothness between the current message unit and the previous message unit. A higher connection smoothness score indicates a smoother connection between the current message unit and the previous message unit.
[0209] Suppose the message in the message queue is "Happy Birthday to You." Message units are divided by characters. For the message unit under consideration, "birth," the inputs of the message units "birth" and "you" are fed into the connection smoothness evaluation model, and the output is a connection smoothness score for "birth," which is 50 points. If the message unit under consideration is "day," the inputs of the connection smoothness evaluation model are "day" and "birth," and the output is a connection smoothness score of 80 points. This shows that compared to "birth," "day" has a smoother connection with the previous message unit.
[0210] Anchor sequences refer to the multiple message basic units between the current message basic unit to be examined. For example, if the message in the message queue is "Happy Birthday to You", the corresponding anchor sequence for the message basic unit "birth" to be examined is "Wish You".
[0211] The sequence to be examined is the sequence of messages between the basic unit to be examined and the multiple basic units between them. It can also be considered the sequence of messages between the basic unit to be examined and the anchor sequence. For example, if the message in the message queue is "Happy Birthday to You", the corresponding sequence to be examined for the basic unit "birth" is "Happy Birthday to You".
[0212] A similarity assessment model is a model used to assess the similarity between two sequences. In the disclosed embodiment, the inputs to the similarity assessment model are an anchor sequence and a sequence to be examined, and the output of the similarity assessment model is a similarity score. The similarity score indicates the similarity between the sequence to be examined and the anchor sequence. The higher the similarity score, the higher the similarity between the sequence to be examined and the anchor sequence. For example, if the message in the message queue is "Happy Birthday to You," for the basic unit of the message to be examined, "birth," the anchor sequence "Wishing You" and the sequence to be examined "Wishing You Birth" are input into the similarity assessment model to obtain a similarity score between the anchor sequence and the sequence to be examined.
[0213] It should be noted that the similarity assessment model can evaluate the similarity between the anchor sequence and the sequence under investigation from multiple perspectives, such as textual similarity and semantic similarity. Accordingly, the similarity score output by the similarity assessment model is a weighted sum of multiple scores, such as the textual similarity score and the semantic similarity score, making the resulting similarity score more accurate.
[0214] In step 1030 , based on the connection smoothness score, the similarity score, and the maximum sub-message size, the message in the message queue corresponding to the application is divided into sub-messages and placed into the sub-message queue corresponding to the application.
[0215] After determining the connection smoothness score and similarity score corresponding to the basic unit of the message to be examined, the message is split according to the connection smoothness score, similarity score and maximum sub-message size to obtain sub-messages, and the sub-messages are placed in the sub-message queue corresponding to the application.
[0216] Reference Figure 11 , the embodiment of the present disclosure first divides the messages in the message queue into multiple message basic units, so as to examine the multiple message basic units one by one. Assuming that the current message basic unit to be examined is message basic unit N, then the message basic unit N and the message basic unit N-1 are input into the connection smoothness evaluation model to obtain the connection smoothness score corresponding to the message basic unit N. Afterwards, the connection sequence from message basic unit 1 to message basic unit N-1 is used as the anchor sequence, and the connection sequence from message basic unit 1 to message basic unit N is used as the sequence to be examined, and the anchor sequence and the sequence to be examined are input into the similarity evaluation model to obtain the similarity score corresponding to the message basic unit N. Based on the connection smoothness score and similarity score of each message basic unit, as well as the maximum sub-message size, the messages in the message queue corresponding to the application are divided to obtain multiple sub-messages, and the sub-messages are placed in the sub-message queue corresponding to the application.
[0217] The embodiment of steps 1010 to 1030 above divides the message into multiple message basic units, and determines the connection smoothness score of each message basic unit through a connection smoothness evaluation model, and determines the similarity score of each message basic unit through a similarity model, so as to divide the message in the message queue corresponding to the application into sub-messages based on the connection smoothness score, similarity score, and maximum sub-message size, so that the message basic units corresponding to the obtained sub-messages have high connection smoothness and similarity. In this case, even if one or more sub-messages corresponding to the message are missed, or the sub-messages in the message restored by the destination node are in the wrong order, the high connection smoothness and similarity between the message basic units corresponding to the sub-messages can reduce the negative impact on readability caused by them, thereby improving the accuracy of message transmission. In addition, the connection smoothness score and similarity score can further reduce the size of the sub-messages and reduce the size difference between the sub-messages, thereby reducing the header resistance problem.
[0218] The above is a general description of steps 1010 to 1030. Since steps 1010 and 1020 have been described in sufficient detail above, only the specific implementation process of step 1030 will be described in detail below.
[0219] In step 1030 , based on the connection smoothness score, the similarity score, and the maximum sub-message size, the message in the message queue corresponding to the application is divided into sub-messages and placed into the sub-message queue corresponding to the application.
[0220] In one embodiment, referring to Figure 12 , step 1030 includes:
[0221] Step 1210: If the connection smoothness score is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, then continue to examine the next message basic unit of the message basic unit to be examined until the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, and treat the anchor sequence as a sub-message and put it into the sub-message queue corresponding to the application.
[0222] Step 1210 is described in detail below.
[0223] In step 1210, if the connection smoothness score is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, then continue to examine the next message basic unit of the message basic unit to be examined until the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, and treat the anchor sequence as a sub-message and put it into the sub-message queue corresponding to the application.
[0224] The first threshold is set corresponding to the connection smoothness score, and the second threshold is set corresponding to the similarity score. Only when the connection smoothness score corresponding to the current message basic unit to be examined is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, will the next message basic unit of the message basic unit to be examined be examined. If the message basic unit to be examined does not meet any of the above conditions, that is, the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, then the anchor sequence corresponding to the message basic unit to be examined is treated as a sub-message and placed in the sub-message queue corresponding to the application. In addition, the first threshold and the second threshold can be set according to actual needs.
[0225] Assuming that the first threshold is set to 70, the second threshold is set to 70, and the maximum sub-message size is 50 bytes, then if the connection smoothness score corresponding to the message basic unit to be examined is greater than 70, the similarity score is greater than 70, and the size of the sequence to be examined is not greater than 50 bytes, then the next message basic unit of the message basic unit to be examined will be examined. For example, if the connection smoothness score corresponding to message basic unit A is 75, the similarity score is 82, and the size of the sequence to be examined is 34 bytes, then the next message basic unit of message basic unit A can be examined. If the connection smoothness score corresponding to the message basic unit to be examined is greater than 70, or the similarity score is less than 70, or the size of the sequence to be examined is greater than 50 bytes, the anchor sequence will be used as a sub-message. For example, if the connection smoothness score corresponding to message basic unit B is 77, the similarity score is 64, and the size of the sequence to be examined is 42 bytes, then the anchor sequence corresponding to message basic unit B can be used as a sub-message.
[0226] Referring to step 11, after determining the connection smoothness score and similarity score corresponding to the message basic unit to be examined, first determine whether the connection smoothness score is greater than a first threshold. If the connection smoothness score is greater than the first threshold, determine whether the similarity score is greater than a second threshold. If the similarity score is greater than the second threshold, determine whether the size of the sequence to be examined is not greater than the maximum sub-message size. If the size of the sequence to be examined is not greater than the maximum sub-message size, then continue to examine the next message basic unit of the message basic unit to be examined. If any of these judgments are negative, then the anchor sequence corresponding to the message basic unit to be examined is placed as a sub-message in the sub-message queue corresponding to the application.
[0227] The embodiment of the above-mentioned step 1210 is provided with a first threshold and a second threshold. Only when the connection smoothness score is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, will the next message basic unit of the message basic unit to be examined be examined. Otherwise, the anchor sequence corresponding to the message basic unit to be examined is taken as a sub-message and placed in the sub-message queue corresponding to the application. The embodiment of the present disclosure processes the message basic unit to be examined by using the first threshold and the second threshold, thereby accurately splitting the message based on the connection smoothness score and the similarity score to obtain sub-messages, thereby improving the accuracy of message splitting, and can further reduce the size difference between each sub-message, reducing the occurrence of header blocking problems.
[0228] In another embodiment, the disclosed embodiment provides a first weight corresponding to the coherence score and a second weight corresponding to the similarity score. The coherence score and the similarity score are weighted and calculated based on the first and second weights to obtain an overall score for the message basic unit under investigation. If the overall score is greater than a third threshold and the size of the sequence under investigation is not greater than the maximum sub-message size, the next message basic unit after the message basic unit under investigation is continuously investigated until the overall score is not greater than the third threshold or the size of the sequence under investigation is greater than the maximum sub-message size. The anchor sequence is then treated as a sub-message and placed in the sub-message queue corresponding to the application.
[0229] It should be noted that the first and second weights can be set based on the importance of the smooth connection score and the similarity score, and the sum of the first and second weights is 1. For example, if the first weight is set to 0.6 and the second weight is set to 0.4, if the smooth connection score is 80 and the similarity score is 75, then the overall score is 78. Furthermore, the third threshold can be set according to actual needs.
[0230] Detailed description of step 430
[0231] In step 430, the sub-message queues corresponding to each application are polled. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, and tokens of the byte length number are taken out from the token bucket corresponding to the sub-message queue, where the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0232] In one embodiment, the sub-message queue includes multiple sub-message sub-queues, each sub-message sub-queue has a different maximum sub-message size, and each sub-message sub-queue shares the token bucket corresponding to the sub-message queue. Figure 13 , step 430 includes:
[0233] Step 1310: Set a sub-queue sequence number for each sub-message sub-queue;
[0234] Step 1320: When a sub-message queue is polled, a sub-queue sequence number is assigned using a sub-queue sequence number assignor, wherein the probability ratio of the sub-queue sequence numbers assigned by the sub-queue sequence number assignor to each sub-message sub-queue is equal to the ratio of the maximum sub-message sizes of each sub-message sub-queue;
[0235] Step 1330: If the byte length of the head sub-message in the sub-message sub-queue corresponding to the sub-queue number specified by the sub-queue number designator is not greater than the first token number, the head sub-message is taken out and sent.
[0236] It's important to note that the sub-message queue corresponding to an application includes multiple sub-message sub-queues. A sub-message sub-queue is a queue used to store sub-messages. Therefore, an application has multiple sub-message sub-queues for storing sub-messages. Different sub-message sub-queues have different maximum sub-message sizes. Multiple sub-message sub-queues share the sub-message queue's token bucket, meaning that sub-messages in multiple sub-message queues are sent using the same token bucket.
[0237] In addition, the application sets multiple maximum sub-message sizes. When splitting messages in the message queue, the message queue can be divided into multiple sub-messages based on the connection smoothness score and similarity score. The difference between each maximum sub-message size and the sub-message size is determined, and the sub-message is placed in the sub-message queue with the smallest difference and a positive difference. If multiple differences are negative, the sub-message can be further split based on one of the maximum sub-message sizes.
[0238] Steps 1310 to 1330 are described in detail below.
[0239] In step 1310, a sub-queue sequence number is set for each sub-message sub-queue.
[0240] The sub-queue sequence number refers to the sequence number of the sub-message sub-queue, and different sub-message sub-queues are set with different sub-queue sequence numbers. Figure 14 The three sub-message queues shown are provided with corresponding sub-queue sequence numbers, namely 1, 2 and 3.
[0241] In step 1320, when a sub-message queue is polled, a sub-queue number is specified through the sub-queue number designator, wherein the probability ratio of the sub-queue numbers of each sub-message sub-queue specified by the sub-queue number designator is equal to the ratio of the maximum sub-message sizes of each sub-message sub-queue.
[0242] The subqueue sequence number designator specifies multiple sub-message subqueues under a sub-message queue by specifying a subqueue sequence number. Because a sub-message queue includes multiple sub-message subqueues, to ensure orderly retrieval of sub-messages from the sub-message queues, the disclosed embodiment provides a subqueue sequence number designator. This designator specifies a subqueue sequence number, thereby determining the specific sub-message subqueue to be polled.
[0243] The probability of the subqueue sequence number designator designating the subqueue sequence number of each sub-message subqueue is determined based on the maximum sub-message size of each sub-message subqueue. Specifically, the probability ratio of the subqueue sequence number designator designating the subqueue sequence number of each sub-message subqueue is equal to the ratio of the maximum sub-message size of each sub-message subqueue. For example, Figure 14 In the example, the maximum sub-message size corresponding to the sub-message sub-queue of sub-queue sequence number 1 is 5, the maximum sub-message size corresponding to the sub-message sub-queue of sub-queue sequence number 2 is 2, and the maximum sub-message size corresponding to the sub-message sub-queue of sub-queue sequence number 3 is 3. Then the sub-queue sequence number designator specifies the probability ratio of the sub-queue sequence numbers of these three sub-message sub-queues as 5:2:3, thereby determining that the probability of specifying sub-queue sequence number 1 is 1 / 2, the probability of specifying sub-queue sequence number 2 is 1 / 5, and the probability of specifying sub-queue sequence number 3 is 3 / 10.
[0244] It should be noted that the probability ratio of the subqueue sequence number designator specifying each submessage subqueue is determined by the ratio of the maximum submessage sizes of each submessage subqueue, so that the submessage subqueue with a larger maximum submessage size has a higher probability of being specified. This can reduce the occurrence of submessage subqueues with smaller maximum submessage sizes being frequently specified, thereby causing the number of tokens in the token bucket to always be lower than the maximum submessage size of other submessage subqueues, and reduce the problem of submessages in submessage subqueues with larger maximum submessage sizes being unable to be sent due to a small number of tokens, and can ensure that submessages in multiple submessage subqueues can be sent normally.
[0245] It should be noted that the probability that the subqueue sequence number specifies the subqueue sequence number of each sub-message subqueue can also be determined in a variety of ways. The designated probability of each sub-message subqueue is determined based on the number of sub-message subqueues. Alternatively, a step-by-step determination method is used. First, the maximum sub-message size of the sub-message subqueue is arranged in the position of the sub-message subqueue in multiple sub-message subqueues, and its corresponding designated probability is determined. For example, the maximum sub-message size corresponding to the sub-message subqueue with subqueue sequence number 1 is 5, the maximum sub-message size corresponding to the sub-message subqueue with subqueue sequence number 2 is 2, and the maximum sub-message size corresponding to the sub-message subqueue with subqueue sequence number 3 is 3. Now, the subqueue sequence number designation probability of the sub-message subqueues corresponding to the top 30% of the maximum sub-message size is set to 0.6. The subqueue sequence number designation probabilities of other sub-message subqueues are the same. Then, the probability of designating subqueue sequence number 1 is 0.6, the probability of designating subqueue sequence number 2 is 0.2, and the probability of designating subqueue sequence number 3 is 0.2.
[0246] In step 1330, if the byte length of the head sub-message in the sub-message sub-queue corresponding to the sub-queue sequence number specified by the sub-queue sequence number designator is not greater than the first token number, the head sub-message is taken out and sent.
[0247] For the sub-message sub-queue corresponding to the sub-queue sequence number specified by the sub-queue sequence number designator, compare the byte length of the head sub-message in the sub-message sub-queue with the first token number. If the byte length of the head sub-message is not greater than the first token number, then remove the head sub-message and send it. If the byte length of the head sub-message is greater than the first token number, then continue polling the sub-message queues corresponding to other applications.
[0248] In the embodiment of steps 1310 to 1330 above, the sub-message queue includes multiple sub-message sub-queues, and different sub-message sub-queues correspond to different maximum sub-message sizes. Then, for a sub-message sub-queue with a smaller maximum sub-message size, the number of tokens accumulated in the token bucket is sufficient for sending sub-messages in the sub-message sub-queue, thereby reducing the occurrence of header blocking problems and improving the fairness of shared connection data transmission. In addition, the embodiment of the present disclosure is provided with a sub-queue sequence number designator, and the probability ratio of the sub-queue sequence number designator to designate each sub-message sub-queue is determined by the ratio of the maximum sub-message sizes of each sub-message sub-queue. Then, the sub-message sub-queue with a larger maximum sub-message size has a higher probability of being designated. This can reduce the occurrence of sub-message sub-queues with smaller maximum sub-message sizes being frequently designated, thereby causing the number of tokens in the token bucket to always be lower than the maximum sub-message size of other sub-message sub-queues, reduce the problem of sub-messages in sub-message sub-queues with larger maximum sub-message sizes being unable to be sent due to a small number of tokens, and improve the fairness of shared connection data transmission.
[0249] In another embodiment, referring to Figure 15 , step 430 includes:
[0250] Step 1510: Take out the head sub-message and place it into the sending queue shared by multiple sub-message queues;
[0251] Step 1520: Take the sub-message from the sending queue and split it into messages;
[0252] Step 1530: Allocate one of the multiple candidate paths to the separated message;
[0253] Step 1540: Send the message to the destination node through the assigned candidate path.
[0254] Steps 1510 to 1540 are described in detail below.
[0255] In step 1510, the head sub-message is taken out and placed into a sending queue shared by multiple sub-message queues.
[0256] The sending queue contains multiple sub-messages. The sub-messages in the sending queue are the sub-messages that the source node will send to the destination node. The sub-message queues of multiple applications share the same sending queue. The sending queue follows the first-in-first-out principle. Therefore, the order in which the first sub-message is taken out from each sub-message queue is the order in which the sending queue sends each sub-message. Figure 6A , the sending queue stores sub-messages from sub-message queues of multiple applications.
[0257] When polling the sub-message queues of multiple applications, the first sub-message to be taken out is determined by the first token number in the token bucket. Then, the first sub-message is taken out and placed in the sending queue to wait for sending.
[0258] In step 1520, the sub-messages are taken out from the sending queue and split into messages.
[0259] A message is a unit of data exchanged and transmitted in a network. It is a block of data that a source node wants to send at one time. It can also be considered the unit of network transmission. Therefore, sub-messages need to be split into messages for transmission.
[0260] In addition, the sending queue follows the first-in-first-out principle, so the sub-message taken out from the sending queue is the head sub-message of the queue. Figure 6A As shown, the head sub-message in the sending queue is the head sub-message of the sub-message queue corresponding to application 1. The sub-message is taken out and split into messages.
[0261] In step 1530, one of the multiple candidate paths is allocated to the separated message.
[0262] A candidate path is a path along which a message from a source node to a destination node is sent. The message is sent to the destination node via a candidate path. The source node and the destination node are transmitted via multiple paths. Figure 6A , the reliable transport layer of the source node is set up with multiple paths. In order to reduce the occurrence of network congestion, it is necessary to select an idle path from multiple candidate paths as the candidate path for the separated message. Figure 6A In the example, assuming that path 2 is still idle, the candidate path is allocated to the separated message.
[0263] It should be noted that when a sub-message is split into multiple packets, different packets may be sent via different candidate paths. Assuming that a sub-message is split into packets 1, 2, and 3, and candidate path 2 has one free slot and candidate path 5 has two free slots, packet 1 can be assigned to candidate path 1, and packets 2 and 3 can be assigned to candidate path 5.
[0264] In step 1540, the message is sent to the destination node via the assigned candidate path.
[0265] After determining the candidate path for the message, the message can be sent to the destination node via the candidate path. Assuming that the candidate path assigned to message 1 is path 2, message 1 is sent to the destination node via path 2.
[0266] In the embodiment of steps 1510 to 1540 described above, the head sub-message retrieved during the polling process is placed in a send queue. The message is then retrieved from the send queue and split into packets, which are then sent to the destination node via the assigned candidate path. The send queue allows multiple sub-messages to be sent in order, while the multiple candidate paths allow packets to be sent to the destination node simultaneously via multiple candidate paths, thereby increasing the message sending rate.
[0267] Steps 410 to 430 have been explained in detail above. Below, some specific points or derived content involved will be described in detail by topic. These topics include the processing of various bitmaps during message transmission, the determination of the first token placement rate, etc.
[0268] Processing of each bitmap during message transmission
[0269] In step 1540, the message is sent to the destination node via the assigned candidate path.
[0270] In the embodiment of the above steps 1510 to 1540, the head sub-message is taken out and placed in a sending queue shared by multiple sub-message queues. After that, the sub-message is taken out from the sending queue, split into messages, and one of multiple candidate paths is assigned to the split message to send the message to the destination node through the assigned candidate path.
[0271] In this case, in one embodiment, referring to Figure 16 , step 1540 includes:
[0272] Step 1610: Assign a message sending sequence number to each message sent through the assigned candidate path;
[0273] Step 1620: Create a first message bitmap, where the first message bitmap includes bits corresponding to the sequence numbers of the messages sent, wherein the bits corresponding to the sequence numbers of the messages sent are initialized to a first value.
[0274] Step 1630: Record the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs in a corresponding manner in the first mapping table;
[0275] Step 1640: Add the message sending sequence number, message ID, sub-message ID, message ID, offset, application ID, and allocated candidate path ID to the message, and send it to the destination node through the allocated candidate path.
[0276] Steps 1610 to 1640 are described in detail below.
[0277] In step 1610, a message sending sequence number is assigned to each sent message through the assigned candidate path.
[0278] The message sending sequence number is the result of the candidate path numbering the message it needs to transmit. The message sending sequence number corresponds to the candidate path, so different paths may have the same path fragment sequence number. Figure 17A On path 0, the message assigned sequence number 3 is g1. On path 1, the message assigned sequence number 3 is g2. On path 2, the message assigned sequence number 3 is h1.
[0279] The candidate path assigns a message sending sequence number to each message sent, which facilitates determining whether the message is sent and the order in which the messages are sent.
[0280] In step 1620, a first message bitmap is created, where the first message bitmap includes bits corresponding to the sequence numbers of each message sent, wherein the bits corresponding to the sequence numbers of each message sent are initialized to a first value.
[0281] The first message bitmap is used to indicate whether the candidate path corresponding to the first message bitmap has received a confirmation response from the destination node. The confirmation response is the response information generated by the destination node after receiving the message sent from the source node. Specifically, refer to Figure 19 ,After the source node sends the message to the destination node, it will receive a confirmation response from the destination node, indicating that the message has been correctly sent to the destination node.
[0282] The first message bitmap includes bits corresponding to the sequence numbers of each message. When the bits corresponding to the sequence numbers of the messages are at the first value, the candidate path has not received the reception confirmation message corresponding to the sequence numbers of the messages. When the first message bitmap is created, the messages that need to be sent through the candidate path have not been sent. Therefore, the candidate path has not received the confirmation response corresponding to any sequence number of the messages, and the bits corresponding to the sequence numbers of the messages need to be initialized to the first value. For example, referring to Figure 17A In path 0, the corresponding bits of message sending sequence number 3, message sending sequence number 4, and message sending sequence number 5 in the first message bitmap are initialized to the first value.
[0283] The first value can be set as needed. In actual use, the first value is usually set to 0 for ease of use.
[0284] In step 1630, the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs are recorded in the first mapping table.
[0285] Message ID is used to distinguish each message. Message ID corresponds to each message. Figure 17A , the message identifier of message g1 is g1, the message identifier of message i 1 is i 1, and the message identifier of message l 2 is l 2.
[0286] The sub-message ID refers to the ID of the sub-message to which the message belongs, and is also used to distinguish between various sub-messages. Figure 17A The sub-message identifier of the sub-message to which message g1 belongs is g, and the sub-message identifier of the sub-message to which message h2 belongs is h.
[0287] The message ID refers to the ID of the message to which the sub-message of the message belongs, and is used to distinguish between different messages. Figure 17A The message identifier of the message to which the sub-message to which the message g1 belongs is A, and the message identifier of the message to which the sub-message to which the message h2 belongs is A.
[0288] The offset is an attribute that identifies the unique position of each sub-message in the message. The offset of each sub-message corresponding to the message is distributed in increasing order according to its position in the message, so as to uniquely identify the position of the sub-message in the message. Figure 17A , the byte size of message A is 50, and the submessages g and h are equal in size, then the offset of submessage g in message A is 0, and the offset of submessage h in message A is 25.
[0289] The application identifier refers to the identifier of the application to which the message to which the sub-message belongs belongs, and is also used to distinguish between different applications. Figure 17A The application identifier of the application to which the message to which the sub-message to which the message g1 belongs belongs is 1, and the application identifier of the application to which the message to which the sub-message to which the message k1 belongs belongs is 3.
[0290] The first mapping table is a table that records the mapping relationships between the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message within the message, and the application identifier of the application to which the message belongs. Other information about the message can be determined using one of the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message within the message, and the application identifier of the application to which the message belongs.
[0291] Reference Figure 17A and Figure 17B Each path is provided with a corresponding first mapping table. In the first mapping table of path 0, the message sends a message with sequence number 3, whose message identifier is g1. The sub-message identifier corresponding to the message is g, the message identifier is A, the offset is 0, and the application identifier is 1.
[0292] In step 1640, the message sending sequence number, message ID, sub-message ID, message ID, offset, application ID and allocated candidate path ID are added to the message and sent to the destination node via the allocated candidate path.
[0293] After determining the message's sequence number, message ID, submessage ID, message ID, offset, application ID, and assigned candidate path ID, this information is added to the message and sent to the destination node via the assigned candidate path. The destination node, based on the information in the message, can restore the message to a message and send it to the corresponding application, completing the message transmission.
[0294] Figure 18AThis is the message format of the message sent by the source node via the candidate path. It can be clearly seen that the message includes a message sequence number (PSN), a sub-message identifier (Sub-Message ID), a message identifier (Message ID), an offset (Offset), and an application identifier (Source APP.ID). The message sequence number is usually stored in the UDP packet header to distinguish individual messages.
[0295] Reference Figure 19 , the source node of the embodiment of the present disclosure determines the sub-message to be sent through the first token number in the token bucket and the byte length of the head sub-message in the sub-message queue during the polling process, and splits the sub-message into messages. After determining the candidate path corresponding to the message, a first message bitmap is created, each bit of the first message bitmap corresponds to the sequence number of each message, and the bit corresponding to the sequence number of each message is initialized to a first value. Afterwards, based on the mapping relationship between the message sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs, a first mapping table is established. And this information and the assigned candidate path identifier are added to the message, and sent to the destination node through the assigned candidate path.
[0296] The embodiment of the above steps 1610 to 1640 is provided with a first message bitmap and a first mapping table so that the source node can record the information of the message. Through the value of each bit in the first message bitmap, it is possible to determine whether the destination node has received the message with the message sending sequence number corresponding to each bit. The creation of the first mapping table can determine other information through any information in the table. In addition, the embodiment of the present disclosure adds the message sending sequence number, message identifier, sub-message identifier, message identifier, offset, application identifier and allocated candidate path identifier to the message, so as to send it to the destination node through the candidate path, so that the destination node can restore the received message into information to ensure the normal progress of the message transmission process.
[0297] In one embodiment, referring to Figure 20 After step 430, the message sending method further includes:
[0298] Step 210: Receive a confirmation response from the destination node, which includes the message sending sequence number and candidate path identifier;
[0299] Step 2020: forward the confirmation response to the candidate path corresponding to the candidate path identifier, so that the candidate path sets the bit corresponding to the message sending sequence number in the first message bitmap to the second value;
[0300] Step 2030: Search the first mapping table for the message identifier, sub-message identifier, message identifier, offset, and application identifier corresponding to the message sending sequence number through the candidate path.
[0301] Steps 2010 to 2030 are described in detail below.
[0302] In step 2010, a confirmation response from the destination node is received, where the confirmation response includes a message sending sequence number and a candidate path identifier.
[0303] An acknowledgment is a response message sent by the destination node to the source node. It contains the message's dispatch sequence number and candidate path identifier. This acknowledgment indicates that the destination node has received the message corresponding to the message's dispatch sequence number, sent via the candidate path corresponding to the candidate path identifier.
[0304] Figure 18B The message format of the confirmation response includes the candidate path identifier (Path ID) and the message sequence number (PSN).
[0305] Reference Figure 17A , assuming that the source node receives a confirmation response from the destination node, and the candidate path identifier in the confirmation response is 0 and the message sending sequence number is 4, it can be determined that the destination node has received message i 1.
[0306] In step 220, the confirmation response is forwarded to the candidate path corresponding to the candidate path identifier, so that the candidate path sets the bit corresponding to the message sending sequence number in the first message bitmap to the second value.
[0307] In the first message bitmap, if one of the bits is the second value, it means that the source node receives the message corresponding to the bit and sends the message corresponding to the sequence number.
[0308] After receiving the confirmation response, the path obtains the message sending sequence number and candidate path identifier in the confirmation response. Then, the confirmation response is forwarded to the candidate path corresponding to the candidate path identifier. After receiving the confirmation response, the path sets the bit corresponding to the message sending sequence number in the first message bitmap to the second value.
[0309] It should be noted that the second value can be set to any value, as long as the second value is not equal to the first value. When the first value is set to 0, the second value can be set to 1.
[0310] Reference Figure 17A and Figure 19 Assuming that the candidate path identifier in the confirmation response is 0 and the message sending sequence number is 4, the confirmation response is first forwarded to path 0, and path 0 sets the position corresponding to the message sending sequence number 4 in the first message bitmap to the second value.
[0311] In step 2030, the message identifier, sub-message identifier, message identifier, offset and application identifier corresponding to the message sending sequence number are searched in the first mapping table through the candidate path.
[0312] Each candidate path is provided with a corresponding first mapping table. By searching in the first mapping table based on the message sending sequence number, the message identifier, sub-message identifier, message identifier, offset and application identifier corresponding to the message corresponding to the message sending sequence number can be determined.
[0313] For example, refer to Figure 17B and Figure 19 Assume that the candidate path identifier in the confirmation response is 0 and the message sending sequence number is 4. Based on the candidate path identifier, determine the first mapping table of candidate paths corresponding to the candidate path identifier. Based on the message sending sequence number 4, determine the message identifier g1, sub-message identifier g, message identifier A, offset 0, and application identifier 1 corresponding to message sending sequence number 4.
[0314] In the embodiment of steps 2010 to 2030, after sending the message to the destination node, a confirmation response is received from the destination node. Based on the candidate path identifier in the confirmation response, the confirmation response is forwarded to the path corresponding to the candidate path identifier, and the position corresponding to the message sending sequence number in the first message bitmap is set to the second value. By searching the first mapping table, the message identifier, sub-message identifier, message identifier, offset, and application identifier corresponding to the message sending sequence number can be determined. The setting of the second value in the first message bitmap can determine that the destination node has received the message with the message sending sequence number corresponding to each bit, thereby determining whether the message is transmitted normally between the source node and the destination node. Other information of the message can be determined by the first mapping table, and further, whether the sub-message or even the message is transmitted normally between the source node and the destination node, so that the message not received by the destination node can be retransmitted, thereby improving the integrity of the message during the transmission process.
[0315] In one embodiment, referring to Figure 21 After step 1520, the message sending method further includes:
[0316] Step 2110: Assign message identifiers to the split messages, and create a first sub-message bitmap corresponding to the sub-message identifiers, the first sub-message bitmap including bits corresponding to the respective message identifiers, wherein the bits corresponding to the respective message identifiers are initialized to a first value;
[0317] Corresponding to step 2110, after step 2030, the message sending method further includes:
[0318] Step 2120: Set the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier to a second value.
[0319] Step 2110 and step 2120 are described in detail below.
[0320] In step 2110, a message identifier is assigned to the split message, and a first sub-message bitmap corresponding to the sub-message identifier is created. The first sub-message bitmap includes bits corresponding to each message identifier, wherein the bits corresponding to each message identifier are initialized to a first value.
[0321] The first sub-message bitmap corresponds to the sub-message identifier and is used to indicate whether acknowledgments have been received for the multiple messages in the sub-message corresponding to the sub-message identifier. When a bit in the first sub-message bitmap is at the first value, it indicates that no acknowledgment has been received for the message with the message identifier corresponding to that bit. Therefore, after the sub-message is split into messages, each bit in the first sub-message bitmap corresponding to the sub-message is initialized to the first value.
[0322] Reference Figure 17A and Figure 19 After splitting the submessages into their corresponding messages, the split messages are assigned message identifiers to distinguish them. A first submessage bitmap is then created for the submessages, and the positions corresponding to the message identifiers in the first submessage bitmap are set to the first value. For example, after splitting submessage g into two messages, the two messages are assigned message identifiers g1 and g2, and a first submessage bitmap is created for submessage g. The bits of message identifiers g1 and g2 in the first submessage bitmap are set to the first value.
[0323] In step 2120, the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier is set to a second value.
[0324] If the bit in the first sub-message bitmap is the second value, it indicates that the source node has received a confirmation response of the message having the message identifier corresponding to the bit.
[0325] After confirming the sub-message identifier and the message identifier corresponding to the message by searching the first mapping table, a first sub-message bitmap corresponding to the sub-message identifier is determined, and the bit corresponding to the message identifier in the first sub-message bitmap is set to the second value. Figure 19 After determining that the message identifier is g1 and the sub-message identifier is g, the bit corresponding to the message identifier g in the first sub-message bitmap corresponding to the sub-message identifier g is set to a second value.
[0326] The first value and the second value in the first sub-message bitmap can be set as needed, as long as the first value and the second value are not equal. In the embodiment of the present disclosure, the first value is usually set to 0 and the second value is set to 1.
[0327] The embodiment of steps 2110 and 2120 described above includes a first sub-message bitmap, which corresponds to a sub-message identifier. When each bit in the first sub-cancellation bitmap is a first value, the source node has not received a message with the message identifier corresponding to that bit. However, when each bit in the first sub-cancellation bitmap is a second value, the source node has received a message with the message identifier corresponding to that bit. The first sub-message bitmap can be used to determine whether the sub-message has been correctly transmitted to the destination node, allowing for retransmission of messages not received by the destination node, thereby improving message integrity during transmission.
[0328] In one embodiment, referring to Figure 22 After step 410, the message sending method further includes:
[0329] Step 2210: Assign sub-message identifiers to the separated sub-messages, and create a first message bitmap corresponding to the message identifiers, the first message bitmap including bits corresponding to the respective sub-message identifiers, wherein the bits corresponding to the respective sub-message identifiers are initialized to a first value;
[0330] Corresponding to step 2210, after step 2120, the message sending method further includes:
[0331] Step 2220: If the bits corresponding to the message identifiers in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value, search the first message bitmap corresponding to the message identifier for the bit corresponding to the sub-message identifier according to the offset;
[0332] Step 2230: Set the bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier to a second value;
[0333] Step 2240: If the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value, notify the application corresponding to the application identifier.
[0334] Steps 2210 to 2240 are described in detail below.
[0335] In step 2210, a sub-message identifier is assigned to the separated sub-message, and a first message bitmap corresponding to the message identifier is created. The first message bitmap includes a bit corresponding to each sub-message identifier, wherein the bit corresponding to each sub-message identifier is initialized to a first value.
[0336] The first message bitmap corresponds to the message identifier and is used to indicate whether acknowledgments have been received for the messages of the multiple sub-messages in the message corresponding to the message identifier. When a bit in the first message bitmap is at the first value, it indicates that acknowledgments have not been received for the multiple messages containing the sub-message corresponding to that bit, meaning that the destination node has not received the complete sub-message. Therefore, after a message is split into sub-messages, each bit in the first message bitmap corresponding to that message is initialized to the first value.
[0337] Reference Figure 17A and Figure 19 After splitting the message into submessages, each submessage is assigned a submessage identifier to distinguish the submessages. A first message bitmap corresponding to the message is then created, and the positions corresponding to the submessage identifiers in the first message bitmap are set to the first value. For example, after splitting message A into two submessages, the two submessages are assigned submessage identifiers g and h, and a first message bitmap for message A is created. The bits of submessage identifiers g and h in the first message bitmap are set to the first value.
[0338] In step 2220, if the bits corresponding to each message identifier in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value, the bit corresponding to the sub-message identifier is searched in the first message bitmap corresponding to the message identifier according to the offset.
[0339] If the bits corresponding to each message identifier in the first sub-message bitmap are all the second value, it indicates that the source node has received acknowledgments for multiple messages of the sub-message corresponding to the first sub-message bitmap, that is, the destination node has received the complete sub-message. Therefore, based on the offset of the sub-message in the message, the bit corresponding to the sub-message identifier is searched in the first message bitmap corresponding to the message identifier.
[0340] Reference Figure 17A and Figure 19 In the first sub-message bitmap corresponding to sub-message g, if the bits corresponding to messages g1 and g2 are both the second value, then the bit corresponding to sub-message identifier g is searched in the first message bitmap of message A according to offset 0.
[0341] In step 2230, the bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier is set to the second value.
[0342] For each bit in the first sub-message bitmap, if it is the second value, it indicates that a confirmation response of multiple messages having the sub-message corresponding to the bit is received, that is, the destination node receives the complete sub-message.
[0343] Reference Figure 17A and Figure 19In the first sub-message bitmap corresponding to sub-message g, if the bits corresponding to messages g1 and g2 are both the second value, indicating that the destination node has received the complete sub-message g, then the bit corresponding to the sub-message identifier g in the first bitmap of message A is set to the second value.
[0344] In step 2240, if the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value, the application corresponding to the application identifier is notified.
[0345] If the bits corresponding to each sub-message identifier in the first message bitmap are all at the second value, this indicates that the source node has received acknowledgments for the multiple sub-messages in the message corresponding to the first message bitmap, meaning that the destination node has received the complete message. Therefore, the message has been successfully transmitted from the source node to the destination node and has been successfully transmitted. The application corresponding to the application identifier is then notified, notifying the application that the message has been sent to the destination node.
[0346] The embodiment of the above steps 2210 to 2240 is provided with a first message bitmap, and each bit in the first message bitmap corresponds to a sub-message identifier. In the case where the bits corresponding to each message identifier in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value, based on the offset and the message identifier, the bit corresponding to the sub-message identifier is determined in the first message bitmap, and the bit is set to the second value to indicate that a confirmation message of the message corresponding to the sub-message has been received. In the case where the bits corresponding to each sub-message identifier in the first message bitmap corresponding to the message identifier are all set to the second value, the message is correctly transmitted from the source node to the destination node, and then the application corresponding to the application identifier is notified. The embodiment of the present disclosure can determine whether the message is correctly transmitted to the destination node through the first message bitmap, and then retransmit the message that has not been received, thereby improving the accuracy of the message in the shared connection transmission process. In addition, in the process of message transmission, the degree of message transmission can be determined based on the first message bitmap, the first sub-message bitmap, and the first message bitmap, thereby realizing visualization of message transmission.
[0347] Determination of the first token placement rate
[0348] In one embodiment, referring to Figure 23 , a method for determining the first token placement rate includes:
[0349] Step 2310: Obtain the priority of the application corresponding to the sub-message queue;
[0350] Step 2320: Determine the remaining capacity of the token bucket corresponding to the sub-message queue;
[0351] Step 2330: Determine a first token placement rate based on the priority and the remaining capacity.
[0352] Steps 2310 to 2330 are described in detail below.
[0353] In step 2310, the priority of the application corresponding to the sub-message queue is obtained.
[0354] Priority refers to the priority with which messages from an application are transmitted on a shared connection between a source node and a destination node. Messages from higher-priority applications are transmitted over a shared connection before messages from lower-priority applications. For example, if Application A has a priority of 0.8 and Application B has a priority of 0.7, messages from Application A will be transmitted first.
[0355] Furthermore, different applications have different priorities, and the priority of the same application can also vary. For example, for a conversational application and a news push application, if the news push application pushes only entertainment news during time period A, the conversational application has a higher priority than the news push application. However, if the news push application needs to push breaking news, the news push application has a lower priority than the conversational application.
[0356] In step 2320, the remaining capacity of the token bucket corresponding to the sub-message queue is determined.
[0357] The remaining capacity is the difference between the maximum capacity of the token bucket and the current number of tokens. For example, if the maximum capacity of the token bucket is 50 and there are 32 tokens in the token bucket, the remaining capacity of the token bucket is 18.
[0358] In step 2330 , a first token placement rate is determined based on the priority and the remaining capacity.
[0359] The higher the priority of the application corresponding to the sub-message queue, the higher the priority of the sub-message transmission in the shared connection, and the faster the sub-message is retrieved and sent.
[0360] When the number of first tokens in the token bucket is equal to or greater than the byte length of the head sub-message, the head sub-message of the sub-message queue is removed and sent, and tokens corresponding to the byte length are removed from the token bucket. Assuming that the maximum capacity of the token bucket corresponding to the sub-message queue is much larger than the maximum sub-message size, if the first token placement rate is low, the maximum number of tokens in the token bucket will always remain near the maximum sub-message size, resulting in excessive remaining capacity in the token bucket and a waste of token bucket resources. To address this issue, the first token placement rate can be determined based on the remaining capacity. The greater the remaining capacity of the token bucket, the greater the first token placement rate. Therefore, the higher the priority of the application corresponding to the sub-message queue, the greater the remaining capacity of the token bucket, and the greater the first token placement rate.
[0361] It should be noted that the embodiment of the present disclosure can establish a relationship between priority, remaining capacity and the first token placement rate. Specifically, the weighted sum of priority and remaining capacity can be calculated and used as the first token placement rate. The weight of priority is set to the third weight, the weight of remaining capacity is set to the fourth weight, and the sum of the third weight and the fourth weight is 1. Then, the product of the third weight and priority, the product of the fourth weight and remaining capacity is calculated, and the sum of the two products and the product of the maximum token placement rate are used as the first token placement rate, wherein the maximum token placement rate is determined based on the performance of the source node. Assuming that the maximum token placement rate is 800M / s, the third weight is 0.8, the fourth weight is 0.2, the priority is 0.9, and the maximum remaining capacity is 0.8, then the calculated first token placement rate is 704M / s.
[0362] In the embodiment of steps 2310 to 2330, the first token placement rate is determined based on the priority of the application corresponding to the sub-message queue and the remaining capacity of the token bucket corresponding to the sub-message queue. The first token placement rate is determined based on the priority, allowing messages corresponding to high-priority applications to be transmitted to the destination node first. Determining the first token placement rate based on the remaining capacity maintains a low remaining capacity, thereby reducing token bucket resource waste.
[0363] Description of the message receiving method at the destination node according to the embodiment of the present disclosure
[0364] In addition, if Figure 24 As shown, the message receiving method provided by the embodiment of the present disclosure is used for a destination node, and the destination node has multiple applications. The message receiving method includes:
[0365] Step 2410: Receive a message from a source node, where the message includes a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of the message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs. In the source node, the sub-message is separated from the message based on the maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application. A token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled. If the byte length of the head sub-message in the sub-message queue is not greater than a first token number, the head sub-message is removed and sent. The first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0366] Step 2420: Based on the message identifier and the sub-message identifier, restore the message to the sub-message corresponding to the sub-message identifier;
[0367] Step 2430: Based on the sub-message identifier, the message identifier, and the offset, restore the sub-message to the message corresponding to the message identifier.
[0368] Steps 2410 to 2430 are described in detail below.
[0369] In step 2410, a message is received from a source node, the message having a message identifier of the message, a sub-message identifier of the sub-message to which the message belongs, a message identifier of the message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs, wherein the sub-message is separated from the message in the source node based on the maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application, a token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled, and if the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0370] Figure 18A The message format of the message received by the source node includes the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs.
[0371] Reference Figure 7 The source node divides the messages in the application's message queue into sub-messages based on the maximum sub-message size corresponding to the application and places them into the application's corresponding sub-message queue. The source node then sets a token bucket for each sub-message queue and adds tokens to the token bucket at a first token placement rate until the token bucket is full. The source node polls the sub-message queues corresponding to each application. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is removed and sent to the destination node, so that the destination node receives the receive message from the source node.
[0372] In step 2420, based on the message identifier and the sub-message identifier, the message is restored to the sub-message corresponding to the sub-message identifier.
[0373] A message ID is used to distinguish the messages corresponding to a submessage. Based on a message's submessage ID, the submessage to which it belongs can be determined. Once multiple messages corresponding to the same submessage have been identified, they can be rearranged based on the message IDs to restore them to their submessages.
[0374] Assume that the destination node receives multiple messages with sub-message identifiers all being g, obtain the message identifiers of the multiple messages, which are g1, g2, and g3 respectively, and rearrange them based on the message identifiers being message g1, message g2, and message g3, and restore them to sub-message g, which is [g1 g2 g3].
[0375] In step 2430, based on the sub-message identifier, the message identifier and the offset, the sub-message is restored to the message corresponding to the message identifier.
[0376] A submessage identifier is used to distinguish submessages within the same message. Based on the message identifier, the message to which the submessage belongs can be determined. Furthermore, the submessage's position within the message can be determined based on the offset, allowing the submessages to be rearranged to recover the restored message.
[0377] Assuming that the message identifiers of the multiple sub-messages restored in step 2420 are all A, obtain the sub-message identifiers and offsets of the multiple sub-messages. The offset of the sub-message corresponding to the sub-message identifier g is 0, and the offset corresponding to the sub-message h is 25. The position of the sub-message in the message is determined based on the offset to rearrange the multiple sub-messages to obtain the restored message A, and the message A is [gh].
[0378] Reference Figure 25 and Figure 26 In the disclosed embodiment, a message is received from a source node. Based on the message identifier and sub-message identifier corresponding to the message, the message is restored to the sub-message corresponding to the sub-message identifier. After determining the sub-message, the message identifier can be used to determine the message to which the sub-message belongs. Furthermore, the position of the sub-message within the message is determined based on the offset, and the multiple sub-messages are rearranged to obtain the restored message.
[0379] In the embodiment of steps 2410 to 2430 described above, the source node divides messages in the message queue corresponding to the application into submessages based on the maximum submessage size corresponding to the application, and places them into the corresponding submessage queue. Since the message has been divided into smaller submessages, even if there are differences in size between the submessages, and a larger submessage creates a header block for the smaller submessages, the larger submessage is much smaller than the entire message. Therefore, even if header block occurs, the effect is not significant. Each application may have a different maximum submessage size. Dividing submessages based on the maximum submessage size corresponding to the application allows applications that frequently generate large messages to be assigned an appropriate maximum submessage size based on their characteristics, further mitigating the header block effect. A token bucket is provided for each submessage queue. Tokens are added to the token bucket at a first token rate. When polling a submessage queue, if the byte length of the head submessage in the submessage queue is found to be less than the number of tokens in the token bucket, the head submessage is removed and sent, and the corresponding token is deducted from the token bucket. If the byte length is greater than the number of tokens in the token bucket, the head submessage is not removed and sent. In this way, when the sub-messages of a large message are still large, the number of tokens accumulated in the token bucket during polling may not be enough to send the sub-message, and the polling will continue to the sub-message queues of other applications. If there are smaller sub-messages in the sub-message queues of other applications, the number of tokens accumulated in the corresponding token bucket is sufficient for sending the sub-message, and it may be sent before the larger sub-message, without causing header block. In this way, the occurrence of header block problems is reduced and the fairness of shared connection data transmission is improved. In addition, the destination node restores the message to a message based on the message ID, sub-message ID, message ID and offset of the message, thereby improving the accuracy of message reception.
[0380] The above is a general description of step 2410 to step 2430. Since step 2410 has been described in sufficient detail above, only step 2420 and step 2430 will be explained in detail below.
[0381] In step 2420, based on the message identifier and the sub-message identifier, the message is restored to the sub-message corresponding to the sub-message identifier.
[0382] In one embodiment, referring to Figure 27 , step 2420 includes:
[0383] Step 2710: If the second sub-message bitmap corresponding to the sub-message identifier does not exist at the destination node, create a second sub-message bitmap;
[0384] Step 2720: If the bit corresponding to the message identifier does not exist in the second sub-message bitmap, create a bit corresponding to the message identifier in the second sub-message bitmap and initialize the bit corresponding to the message identifier to a first value;
[0385] Step 2730: Set the bit corresponding to the message identifier in the second sub-message bitmap to a second value, and restore the message to the sub-message corresponding to the sub-message identifier according to the message identifier.
[0386] Steps 2710 to 2730 are described in detail below.
[0387] In step 2710, if the second sub-message bitmap corresponding to the sub-message identifier does not exist at the destination node, a second sub-message bitmap is created.
[0388] The second sub-message bitmap corresponds to the sub-message identifier and is used to indicate whether multiple messages in the sub-message corresponding to the sub-message identifier have been received. If the second sub-message bitmap corresponding to the sub-message identifier does not exist at the destination node, it means that no message of the sub-message corresponding to the sub-message identifier has been received between the destination nodes. Therefore, a second sub-message bitmap can be created. Specifically, referring to Figure 18A The message received by the destination node includes a sub-message identifier. Based on the sub-message identifier, a second sub-message bitmap corresponding to the sub-message identifier may be created. If the destination node does not have a second sub-message bitmap corresponding to sub-message identifier A, a second sub-message bitmap corresponding to sub-message identifier A is created.
[0389] It should be noted that the message may also include the number of multiple messages corresponding to the sub-message. According to the number, a second sub-message bitmap is created so that each bit in the second sub-message bitmap corresponds to the message identifier one-to-one.
[0390] In step 2720, if the bit corresponding to the message identifier does not exist in the second sub-message bitmap, a bit corresponding to the message identifier is created in the second sub-message bitmap and the bit corresponding to the message identifier is initialized to the first value.
[0391] If the bit corresponding to the message ID does not exist in the second sub-message bitmap, it indicates that the message corresponding to the message ID has not been received. To ensure a one-to-one correspondence between each bit in the second sub-message bitmap and the message ID, a bit corresponding to the message ID is created in the second sub-message bitmap. For example, if the destination node receives a message with a message ID of 15 and the length of the second sub-message bitmap is only 14, a bit needs to be added to the end of the second sub-message bitmap to make it correspond to the message ID 15.
[0392] In the second sub-message bitmap, if one of the bits is the first value, it means that the destination node has not received the message corresponding to the bit. Therefore, when creating each bit of the second sub-message bitmap, each bit needs to be initialized to the first value.
[0393] In step 2730, the bit corresponding to the message identifier in the second sub-message bitmap is set to a second value, and the message is restored to the sub-message corresponding to the sub-message identifier according to the message identifier.
[0394] After creating and initializing the bit corresponding to the message identifier in the second sub-message bitmap, since the destination node has received the message corresponding to the message identifier, the bit corresponding to the message identifier in the second sub-message bitmap needs to be set to a second value to indicate that the message has been received.
[0395] Based on the position of the bit corresponding to the message identifier in the second sub-message bitmap, the message can be restored to the sub-message corresponding to the sub-message identifier according to the message identifier. For example, if the message identifier corresponding to the message is g4 and the sub-message identifier is g, the message can be determined to be the fourth message in the sub-message and placed in the corresponding position in the sub-message.
[0396] It should be noted that the first value and the second value can be set as needed, as long as the first value and the second value are not equal. For example, the first value can be set to 0 and the second value can be set to 1.
[0397] Reference Figure 25 and Figure 26 , the embodiment of the present disclosure is provided with a second sub-message bitmap, and is capable of creating a second sub-message bitmap for a message that has not been received before based on the sub-message identifier of the message, and is capable of creating a bit corresponding to the message identifier in the second sub-message bitmap based on the message identifier. After the bit is created, each bit is first initialized to a first value. If a message with a message identifier corresponding to a bit in the second sub-message bitmap is received, the bit can be set to a second value. Through the setting of the second sub-message bitmap, the embodiment of the present disclosure can determine the transmission progress of the sub-message to ensure that the destination node can receive the complete sub-message.
[0398] In step 2430, based on the sub-message identifier, the message identifier and the offset, the sub-message is restored to the message corresponding to the message identifier.
[0399] In one embodiment, referring to Figure 28 , step 2430 includes:
[0400] Step 2810: If the bits corresponding to each message identifier in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, and the second message bitmap corresponding to the message identifier does not exist at the destination node, then create a second message bitmap;
[0401] Step 2820: If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, create a bit corresponding to the sub-message identifier in the second message bitmap according to the offset, and initialize the bit corresponding to the sub-message identifier to the first value;
[0402] Step 2830: Set the bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier to a second value, and restore the sub-message to the message corresponding to the message identifier according to the offset.
[0403] Steps 2810 to 2830 are described in detail below.
[0404] In step 2810, if the bits corresponding to each message identifier in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, and the second message bitmap corresponding to the message identifier does not exist at the destination node, then a second message bitmap is created.
[0405] The second message bitmap corresponds to the message identifier and is used to indicate whether the messages of multiple sub-messages in the message corresponding to the message identifier, i.e., multiple sub-messages corresponding to the complete message, have been received. If the bits corresponding to each message identifier in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, then the destination node has received the complete sub-message corresponding to the sub-message identifier.
[0406] If the second message bitmap corresponding to the message identifier does not exist at the destination node, it means that no sub-message of the message corresponding to the message identifier has been received between the destination nodes. Therefore, a second message bitmap can be created. Specifically, refer to Figure 18A The message received by the destination node includes a message identifier. Based on the message identifier, a second message bitmap corresponding to the message identifier may be created. If the destination node does not have a second message bitmap corresponding to the message identifier A, then a second message bitmap corresponding to the message identifier is created.
[0407] It should be noted that the message may also include the number of multiple sub-messages corresponding to the message. Based on the number, a second message bitmap is created so that each bit in the second message bitmap corresponds one-to-one to a sub-message of the sub-message.
[0408] In step 2820, if the bit corresponding to the sub-message identifier does not exist in the second message bitmap, the bit corresponding to the sub-message identifier is created in the second message bitmap according to the offset, and the bit corresponding to the sub-message identifier is initialized to the first value.
[0409] If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, it means that the complete sub-message corresponding to the sub-message identifier has not been received before. In order to make each bit in the second message bitmap correspond to the sub-message identifier one-to-one, the bit corresponding to the sub-message identifier is created in the second sub-message bitmap according to the offset. For example, the offset of the sub-message received by the destination node is 8. If the length of the second message bitmap is only 6, then it is necessary to add a bit at the end of the second message bitmap so that the bit corresponds to the sub-message with an offset of 8. In addition, if the offset of the sub-message is 8, then the message also includes a sub-message with an offset of 7 that has not been received. Therefore, another bit can be created so that the re-created bit corresponds to the sub-message with an offset of 7.
[0410] In the second message bitmap, if one of the bits is the first value, it means that the destination node has not received the complete sub-message corresponding to the bit. Therefore, when creating each bit of the second message bitmap, each bit needs to be initialized to the first value.
[0411] In step 2830, the bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier is set to a second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset.
[0412] After creating and initializing the bit corresponding to the sub-message identifier in the second message bitmap, since the destination node has received the sub-message corresponding to the sub-message identifier, the bit corresponding to the sub-message identifier in the second message bitmap needs to be set to a second value to indicate that the sub-message has been received.
[0413] Based on the position of the bit corresponding to the sub-message identifier in the second message bitmap, the sub-message can be restored to the message corresponding to the message identifier according to the offset. For example, if the sub-message identifier corresponding to the sub-message is g, the message identifier is A, and the offset is 0, the sub-message can be determined to be the first sub-message of the message and placed at the corresponding position in the message.
[0414] It should be noted that the first value and the second value can be set as needed, as long as the first value and the second value are not equal. For example, the first value can be set to 0 and the second value can be set to 1.
[0415] Reference Figure 25 and Figure 26In the embodiment of the present disclosure, a second message bitmap is provided, and the second message bitmap can be created for a sub-message that has not been received before based on the message identifier of the sub-message, and a bit corresponding to the sub-message identifier can be created in the second message bitmap based on the offset of the sub-message. After the bit is created, each bit is first initialized to a first value. If a sub-message with a sub-message identifier corresponding to a bit in the second message bitmap is received, the bit can be set to the second value, and the sub-message can be restored to the message corresponding to the message identifier according to the offset.
[0416] The embodiment of steps 2810 to 2830 described above is provided with a second message bitmap, and is capable of creating a second message bitmap for a sub-message that has not been received before based on the message identifier of the sub-message, and is capable of creating a bit corresponding to the sub-message identifier in the second message bitmap based on the offset of the sub-message. The bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier of the received message is set to a second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset. By setting the second message bitmap, the embodiment of the present disclosure can determine the transmission progress of the message to ensure that the destination node can receive the complete message.
[0417] In one embodiment, referring to Figure 29 After step 2430, the message receiving method further includes:
[0418] Step 2910: If the bits corresponding to the sub-message identifiers in the second message bitmap corresponding to the message identifier are all set to the second value, notify the application corresponding to the application identifier.
[0419] It should be noted that if the bits corresponding to each sub-message identifier in the second message bitmap corresponding to the message identifier are all set to the second value, it means that the destination node has received the complete message corresponding to the message identifier. Then, the application corresponding to the application identifier can be notified so that the application of the destination node receives the message of the source node application. For example, referring to Figure 3B , determine that the bits corresponding to each sub-message identifier in the second message bitmap of message 2 are all set to the second value, send message 2 to application 5, and notify application 5 that the complete message 2 has been received.
[0420] In one embodiment, the message also has a message sending sequence number and a candidate path identifier of the path for transmitting the message, referring to Figure 30 After step 2410, the message receiving method further includes:
[0421] Step 3010: forward the message to the candidate path corresponding to the candidate path identifier;
[0422] Step 3020: If the second message bitmap corresponding to the candidate path identifier does not exist, create a second message bitmap through the candidate path;
[0423] Step 3030: If the bit corresponding to the message identifier does not exist in the second message bitmap, create a bit corresponding to the message identifier in the second message bitmap, and initialize the bit corresponding to the message identifier to a first value;
[0424] Step 3040: Set the bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier to a second value.
[0425] Step 2420 is performed under the premise that the bits corresponding to the respective message identifiers in the second message bitmap corresponding to the candidate path identifiers are all set to the second value.
[0426] Steps 3010 to 3040 are described in detail below.
[0427] In step 3010, the message is forwarded to the candidate path corresponding to the candidate path identifier.
[0428] The source and destination nodes transmit data via multiple paths. Each path corresponds to a specific path. Therefore, after receiving a message, it must be forwarded to the candidate path corresponding to the candidate path identifier. For example, if the candidate path identifier for a message is 3, the message was sent to the destination node via path 3 at the source node. Therefore, the message must be forwarded to path 3 at the destination node for further processing.
[0429] In step 3020, if the second message bitmap corresponding to the candidate path identifier does not exist, a second message bitmap is created through the candidate path.
[0430] The second message bitmap indicates whether the candidate path corresponding to the second message bitmap has received multiple messages corresponding to the multiple bits in the second message bitmap. If the second message bitmap corresponding to the candidate path identifier does not exist, it indicates that the candidate path corresponding to the candidate path identifier has not previously received any messages. Therefore, it is necessary to create a second message bitmap based on the candidate paths.
[0431] It should be noted that, referring to Figure 18A ,The message sent by the source node also includes the message sending sequence number. Therefore, the candidate path can create a second message bitmap based on the message sending sequence number, and arrange multiple messages in the order of the message sending sequence number.
[0432] In step 3030, if the bit corresponding to the message identifier does not exist in the second message bitmap, a bit corresponding to the message identifier is created in the second message bitmap and the bit corresponding to the message identifier is initialized to the first value.
[0433] If a bit corresponding to a message ID does not exist in the second message bitmap, this indicates that the message corresponding to that message ID has not been received. To ensure a one-to-one correspondence between each bit in the second message bitmap and a message ID, a bit corresponding to the message ID is created in the second message bitmap. For example, if the destination node receives a message with a message ID of 15, and if the second message bitmap does not contain a bit corresponding to message ID 15, a bit is added to the second message bitmap to make that bit correspond to message ID 15.
[0434] In the second message bitmap, if one bit is the first value, it means that the candidate path has not received the message corresponding to the bit. Therefore, when creating each bit of the second message bitmap, each bit needs to be initialized to the first value.
[0435] In step 3040, the bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier is set to a second value.
[0436] After the bit corresponding to the message identifier is created and initialized in the second message bitmap, since the candidate path has received the message corresponding to the message identifier, the bit corresponding to the message identifier in the second message bitmap needs to be set to the second value to indicate that the candidate path has received the message. For example, if the message identifier corresponding to the message is g4, the bit corresponding to the message identifier g4 in the second message bitmap corresponding to the candidate path identifier may be set to the second value.
[0437] It should be noted that the first value and the second value can be set as needed, as long as the first value and the second value are not equal. For example, the first value can be set to 0 and the second value can be set to 1.
[0438] In addition, refer to Figure 25 and Figure 26 Step 2420 is performed only after the candidate path receives the message, that is, only after the bits corresponding to each message identifier in the second message bitmap corresponding to the candidate path identifier are set to the second value. Only when the corresponding bits in the second message bitmap of the candidate path for the multiple messages corresponding to the sub-message are set to the second value is the message restored to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier.
[0439] In the embodiment of steps 3010 to 3040 described above, a second message bitmap is provided on the candidate path. Based on the message identifier and sub-message identifier, the message is restored to the sub-message corresponding to the sub-message identifier, assuming that the bits corresponding to each message identifier in the second message bitmap corresponding to the candidate path identifier are all set to the second value. This disclosed embodiment receives a message via the candidate path, determines whether the message has been received using the second message bitmap, and then restores multiple messages into a message based on the message identifier, sub-message identifier, message identifier, offset, etc. of the received message, thereby ensuring the correctness of message generation and improving the accuracy of message reception.
[0440] In one embodiment, referring to Figure 31 After step 2430, the message receiving method further includes:
[0441] Step 3110: Generate a confirmation response, which includes the message sending sequence number and candidate path identifier;
[0442] Step 3120: Send a confirmation response to the source node.
[0443] Step 3110 and step 3120 are described in detail below.
[0444] In step 3110, a confirmation response is generated, which includes the message sending sequence number and the candidate path identifier.
[0445] The confirmation response is used to indicate that the candidate path to the destination node has received the message. Figure 18B , the confirmation response contains the message sending sequence number and candidate path identifier.
[0446] In step 3120, a confirmation response is sent to the source node.
[0447] After generating the confirmation response, the confirmation response is sent to the source node, so that the source node determines whether the message needs to be retransmitted based on the confirmation response.
[0448] The embodiment of the above steps 3110 to 3120 sends a confirmation response to the source node. The source node response sent includes the message sending sequence number and the candidate path identifier. Then the source node can determine whether the message needs to be retransmitted through the candidate path corresponding to the candidate path identifier, and retransmit the message that has been sent but has not received a confirmation response, thereby ensuring that the message can be correctly transmitted to the destination node.
[0449] In one embodiment, referring to Figure 32A and Figure 32BIn the related art, large message 2 can be sent only after large message 1 is sent. However, in the embodiment of the present disclosure, large message 1 and large message 2 can be sent simultaneously, so that multiple applications can fairly share the bandwidth of the shared connection at both the micro time scale (microsecond level) and the macro time scale (second level), thereby improving the fairness of data transmission in the shared connection.
[0450] In one embodiment, referring to Figure 33A and Figure 33B In the related art, small messages can only be sent after large messages are sent. Large messages cause congestion to the messages. However, the embodiments of the present disclosure can send large messages and small messages at the same time, so that small messages can be sent quickly in a short time, reducing the congestion problem caused by large messages to the messages, and allowing small messages to be transmitted with low latency.
[0451] Implementation details of the message sending and receiving method of the disclosed embodiment
[0452] Refer to the following Figure 34 , which illustrates in detail the implementation details of the message sending and receiving method of the embodiment of the present disclosure.
[0453] In step 3411, the source node divides the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and puts the sub-messages into the sub-message queue corresponding to the application.
[0454] In one embodiment, messages in a message queue corresponding to an application are divided into message basic units. The message basic units are examined one by one in a front-to-back order. The message basic unit to be examined and the previous message basic unit are input into a connection smoothness evaluation model to obtain a connection smoothness score. The message basic units preceding the message basic unit to be examined are used as anchor sequences, and the connection sequence of the previous message basic units and the message basic unit to be examined is used as the sequence to be examined. The anchor sequence and the sequence to be examined are input into a similarity evaluation model to obtain a similarity score. Based on the connection smoothness score and similarity score, and the maximum sub-message size, the messages in the message queue corresponding to the application are divided into sub-messages and placed into the sub-message queue corresponding to the application.
[0455] In one embodiment, if the connection smoothness score is greater than a first threshold, the similarity score is greater than a second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, then the next message basic unit of the message basic unit to be examined will continue to be examined until the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, and the anchor sequence will be treated as a sub-message and placed in the sub-message queue corresponding to the application.
[0456] In one embodiment, the maximum sub-message size corresponding to the application is obtained. If the message in the message queue corresponding to the application is not larger than the maximum sub-message size, the message is treated as a sub-message and placed in the sub-message queue corresponding to the application. If the message in the message queue corresponding to the application is larger than the maximum sub-message size, sub-messages are separated from the message according to the maximum sub-message size and placed in the sub-message queue corresponding to the application.
[0457] In step 3412, the source node assigns a sub-message identifier to the separated sub-message and creates a first message bitmap corresponding to the message identifier. The first message bitmap includes bits corresponding to each sub-message identifier, wherein the bits corresponding to each sub-message identifier are initialized to a first value.
[0458] In step 3413, the source node sets a token bucket for each sub-message queue, and puts tokens into the token bucket at a first token placement rate until the token bucket is full.
[0459] In step 3414, the source node polls the sub-message queues corresponding to each application.
[0460] In one embodiment, a subqueue sequence number is assigned to each sub-message subqueue. When a sub-message queue is polled, a subqueue sequence number is assigned using a subqueue sequence number designator. The probability ratio of the subqueue sequence numbers assigned by the subqueue sequence number designator to each sub-message subqueue is equal to the ratio of the maximum sub-message sizes of each sub-message subqueue. If the byte length of the head sub-message in the sub-message subqueue corresponding to the subqueue sequence number designated by the subqueue sequence number designator is not greater than the first token number, the head sub-message is removed and sent.
[0461] In one embodiment, the subqueue sequence number designator designates a probability ratio of the subqueue sequence numbers of the respective sub-message subqueues equal to a ratio of the maximum sub-message sizes of the respective sub-message subqueues.
[0462] In step 3415, if the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the source node takes out the head sub-message and sends it, places it in the sending queue shared by multiple sub-message queues, and takes out the sub-message from the sending queue and splits it into messages.
[0463] In step 3416, the source node assigns a message identifier to the split message and creates a first sub-message bitmap corresponding to the sub-message identifier. The first sub-message bitmap includes bits corresponding to each message identifier, wherein the bits corresponding to each message identifier are initialized to a first value.
[0464] In step 3417, the source node allocates one of the multiple candidate paths to the separated message.
[0465] In step 3418, the source node assigns message sending sequence numbers through candidate paths and creates a first message bitmap and a first mapping table. The first message bitmap includes bits corresponding to each message sending sequence number, wherein the bits corresponding to each message sending sequence number are initialized to a first value.
[0466] In one embodiment, the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs are recorded correspondingly in the first mapping table.
[0467] In step 3419, the source node sends the message to the destination node via the assigned candidate path.
[0468] In step 3420, the source node takes out tokens of the number of bytes from the token bucket corresponding to the sub-message queue, where the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0469] In step 3421, the destination node receives a message from the source node.
[0470] It should be noted that the message has the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs. Among them, the sub-message is separated from the message in the source node based on the maximum sub-message size corresponding to the application, and placed in the sub-message queue corresponding to the application. A token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0471] In step 3422, the destination node forwards the message to the candidate path corresponding to the candidate path identifier.
[0472] Specifically, if the second message bitmap corresponding to the candidate path identifier does not exist, a second message bitmap is created using the candidate path. If the bit corresponding to the message identifier does not exist in the second message bitmap, a bit corresponding to the message identifier is created in the second message bitmap and initialized to the first value. The bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier is set to the second value.
[0473] In step 3423, the destination node restores the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier.
[0474] Specifically, if the destination node does not exist in the second sub-message bitmap corresponding to the sub-message identifier, a second sub-message bitmap is created. If the bit corresponding to the message identifier does not exist in the second sub-message bitmap, a bit corresponding to the message identifier is created in the second sub-message bitmap and initialized to the first value. The bit corresponding to the message identifier in the second sub-message bitmap is set to the second value, and the message is restored to the sub-message corresponding to the sub-message identifier according to the message identifier.
[0475] In step 3424, the destination node restores the sub-message to the message corresponding to the message identifier based on the sub-message identifier, message identifier and offset.
[0476] Specifically, if the bits corresponding to each message identifier in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value and do not exist in the second message bitmap corresponding to the message identifier at the destination node, then a second message bitmap is created. If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, then a bit corresponding to the sub-message identifier is created in the second message bitmap according to the offset and initialized to the first value. The bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier is set to the second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset.
[0477] In step 3425, the destination node generates a confirmation response, which includes the message sending sequence number and the candidate path identifier.
[0478] In step 3426, the destination node sends a confirmation response to the source node.
[0479] In step 3427, the source node receives the confirmation response from the destination node, and forwards the confirmation response to the candidate path corresponding to the candidate path identifier, so that the candidate path sets the bit corresponding to the message sending sequence number in the first message bitmap to the second value.
[0480] In step 3428, the source node searches the first mapping table through the candidate path for the message identifier, sub-message identifier, message identifier, offset, and application identifier corresponding to the message sending sequence number.
[0481] In step 3429, the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier is set to the second value.
[0482] In step 3430, if the bits corresponding to each message identifier in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value, the bit corresponding to the sub-message identifier is searched in the first message bitmap corresponding to the message identifier according to the offset.
[0483] In step 3431, the bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier is set to a second value.
[0484] In step 3432, if the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value, the application corresponding to the application identifier is notified.
[0485] Description of the apparatus and device of the present disclosure
[0486] It is to be understood that, although the steps in the above-mentioned flowcharts are shown in sequence according to the arrow representations, these steps are not necessarily performed in sequence according to the order represented by the arrows. Unless otherwise specified in the present embodiment, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned flowcharts may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0487] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the characteristics of the object, such as object attribute information or attribute information sets, the permission or consent of the object will be obtained first, and the collection, use and processing of such data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain object attribute information, the object's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the object's separate permission or separate consent, the necessary object-related data for the normal operation of the embodiment of the present application will be obtained.
[0488] Figure 35 This is a schematic diagram of the structure of a message sending device provided in an embodiment of the present disclosure. The message sending device 3500 is used for a source node. The source node has multiple applications, each of which corresponds to a message queue and a sub-message queue. The message sending device 3500 includes:
[0489] The message splitting unit 3510 is used to split the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and put the sub-messages into the sub-message queue corresponding to the application;
[0490] A first setting unit 3520 is configured to set a token bucket for each sub-message queue, and to put tokens into the token bucket at a first token placement rate until the token bucket is full.
[0491] The polling unit 3530 is used to poll the sub-message queues corresponding to each application. If the byte length of the head sub-message in the sub-message queue is not greater than the first token number, the head sub-message is taken out and sent, and tokens of the number of byte lengths are taken out from the token bucket corresponding to the sub-message queue, where the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0492] Optionally, different applications may correspond to different maximum sub-message sizes;
[0493] The message dividing unit 3510 is specifically used for:
[0494] Get the maximum sub-message size corresponding to the application;
[0495] If the message in the message queue corresponding to the application is not larger than the maximum sub-message size, the message is treated as a sub-message and placed in the sub-message queue corresponding to the application;
[0496] If the message in the message queue corresponding to the application is larger than the maximum sub-message size, sub-messages are separated from the message according to the maximum sub-message size and placed in the sub-message queue corresponding to the application.
[0497] Optionally, the sub-message queue includes multiple sub-message sub-queues, each sub-message sub-queue has a different maximum sub-message size, and each sub-message sub-queue shares a token bucket corresponding to the sub-message queue;
[0498] The polling unit 3530 is specifically configured to:
[0499] Set the sub-queue sequence number for each sub-message sub-queue;
[0500] When a sub-message queue is polled, a sub-queue sequence number is assigned through the sub-queue sequence number assignor, wherein the probability ratio of the sub-queue sequence numbers assigned by the sub-queue sequence number assignor to each sub-message sub-queue is equal to the ratio of the maximum sub-message sizes of each sub-message sub-queue;
[0501] If the byte length of the head sub-message in the sub-message sub-queue corresponding to the sub-queue sequence number specified by the sub-queue sequence number designator is not greater than the first token number, the head sub-message is taken out and sent.
[0502] Optionally, the message sending device 3500 further includes:
[0503] A first acquiring unit, configured to acquire the priority of the application corresponding to the sub-message queue;
[0504] A first determining unit, configured to determine a remaining capacity in a token bucket corresponding to a sub-message queue;
[0505] The second determining unit is configured to determine a first token placement rate based on the priority and the remaining capacity.
[0506] Optionally, the message dividing unit 3510 is further configured to:
[0507] Divide the messages in the message queue corresponding to the application into basic message units;
[0508] In order from front to back, the message basic units are examined one by one, the message basic unit to be examined and the previous message basic unit are input into the connection smoothness evaluation model to obtain the connection smoothness score, each message basic unit before the message basic unit to be examined is used as an anchor sequence, and the connection sequence of each previous message basic unit and the message basic unit to be examined is used as the sequence to be examined, and the anchor sequence and the sequence to be examined are input into the similarity evaluation model to obtain the similarity score;
[0509] Based on the connection smoothness score, similarity score, and maximum sub-message size, the message in the message queue corresponding to the application is divided into sub-messages and placed in the sub-message queue corresponding to the application.
[0510] Optionally, the message dividing unit 3510 is further configured to:
[0511] If the connection smoothness score is greater than the first threshold, the similarity score is greater than the second threshold, and the size of the sequence to be examined is not greater than the maximum sub-message size, then continue to examine the next message basic unit of the message basic unit to be examined until the connection smoothness score is not greater than the first threshold, or the similarity score is not greater than the second threshold, or the size of the sequence to be examined is greater than the maximum sub-message size, and treat the sequence to be examined as a sub-message and put it into the sub-message queue corresponding to the application.
[0512] Optionally, the polling unit 3530 is specifically configured to:
[0513] Take out the first sub-message from the queue and place it into the send queue shared by multiple sub-message queues;
[0514] Take the sub-message from the sending queue and split it into messages;
[0515] Allocate one candidate path from multiple candidate paths for the separated message;
[0516] Send the message to the destination node through the assigned candidate path.
[0517] Optionally, the polling unit 3530 is further configured to:
[0518] Assign a message sending sequence number to each message sent through the allocated candidate path;
[0519] Creating a first message bitmap, the first message bitmap including bits corresponding to the sequence numbers of each message sent, wherein the bits corresponding to the sequence numbers of each message sent are initialized to a first value;
[0520] Record the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs in a corresponding manner in the first mapping table;
[0521] The message sending sequence number, message ID, sub-message ID, message ID, offset, application ID and allocated candidate path ID are added to the message and sent to the destination node through the allocated candidate path.
[0522] Optionally, the message sending device 3500 further includes:
[0523] A second receiving unit is configured to receive a confirmation response from the destination node, wherein the confirmation response includes a message sending sequence number and a candidate path identifier;
[0524] a first forwarding unit, configured to forward the confirmation response to a candidate path corresponding to the candidate path identifier, so that the candidate path sets a bit corresponding to the message sending sequence number in the first message bitmap to a second value;
[0525] The first search unit is used to search the message identifier, sub-message identifier, message identifier, offset and application identifier corresponding to the message sending sequence number in the first mapping table through the candidate path.
[0526] Optionally, the message sending device 3500 further includes:
[0527] a first creating unit, configured to assign a message identifier to the split message and create a first sub-message bitmap corresponding to the sub-message identifier, the first sub-message bitmap including a bit corresponding to each message identifier, wherein the bit corresponding to each message identifier is initialized to a first value;
[0528] The first setting unit is configured to set the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier to a second value.
[0529] Optionally, the message sending device 3500 further includes:
[0530] a second creating unit, configured to assign sub-message identifiers to the separated sub-messages, and create a first message bitmap corresponding to the message identifiers, the first message bitmap including bits corresponding to the respective sub-message identifiers, wherein the bits corresponding to the respective sub-message identifiers are initialized to a first value;
[0531] a second setting unit configured to search, according to the offset, for a bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier if the bits corresponding to the respective message identifiers in the first sub-message bitmap corresponding to the sub-message identifier are all set to a second value;
[0532] a third setting unit, configured to set a bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier to a second value;
[0533] The first notification unit is configured to notify the application corresponding to the application identifier if the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value.
[0534] Figure 36 This is a schematic diagram of the structure of a message receiving device provided in an embodiment of the present disclosure. The message receiving device 3600 is used in a destination node, which has multiple applications. The message receiving device 3600 includes:
[0535] A first receiving unit 3610 is configured to receive a message from a source node, the message including a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of the message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs. In the source node, the sub-message is separated from the message based on the maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application. A token bucket is set for each sub-message queue, and the sub-message queues corresponding to each application are polled. If the byte length of the head sub-message in the sub-message queue is not greater than a first token number, the head sub-message is removed and sent, wherein the first token number is the number of tokens in the token bucket corresponding to the sub-message queue.
[0536] A first restoring unit 3620 is configured to restore the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier;
[0537] The second restoring unit 3630 is configured to restore the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset.
[0538] Optionally, the first restoring unit 3620 is specifically configured to:
[0539] If the destination node does not exist in the second sub-message bitmap corresponding to the sub-message identifier, create a second sub-message bitmap;
[0540] If the bit corresponding to the message identifier does not exist in the second sub-message bitmap, creating a bit corresponding to the message identifier in the second sub-message bitmap, and initializing the bit corresponding to the message identifier to the first value;
[0541] The bit corresponding to the message identifier in the second sub-message bitmap is set to a second value, and the message is restored to the sub-message corresponding to the sub-message identifier according to the message identifier.
[0542] Optionally, the second restoring unit 3630 is specifically configured to:
[0543] If the bits corresponding to the respective message identifiers in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, and the second message bitmap corresponding to the message identifier does not exist at the destination node, then creating a second message bitmap;
[0544] If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, creating a bit corresponding to the sub-message identifier in the second message bitmap according to the offset, and initializing the bit corresponding to the sub-message identifier to the first value;
[0545] The bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier is set to a second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset.
[0546] Optionally, the message receiving device 3600 further includes:
[0547] The second notification unit is configured to notify the application corresponding to the application identifier if the bits corresponding to the sub-message identifiers in the second message bitmap corresponding to the message identifier are all set to a second value.
[0548] Optionally, the message further includes a message sending sequence number and a candidate path identifier of a candidate path for transmitting the message;
[0549] The message receiving device 3600 further includes:
[0550] Forward the message to the candidate path corresponding to the candidate path identifier;
[0551] a third creating unit, configured to create a second message bitmap through the candidate path if the second message bitmap corresponding to the candidate path identifier does not exist;
[0552] a fourth creating unit, configured to create a bit corresponding to the message identifier in the second message bitmap if the bit corresponding to the message identifier does not exist in the second message bitmap, and initialize the bit corresponding to the message identifier to a first value;
[0553] a third setting unit, configured to set a bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier to a second value;
[0554] The step of restoring the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier is performed under the premise that the bits corresponding to each message identifier in the second message bitmap corresponding to the candidate path identifier are all set to the second value.
[0555] Optionally, the message receiving device 3600 further includes:
[0556] A first generating unit is configured to generate a confirmation response, wherein the confirmation response includes a message sending sequence number and a candidate path identifier;
[0557] The first sending unit is configured to send a confirmation response to the source node.
[0558] Reference Figure 37 , Figure 37 The structural block diagram of the terminal part for implementing the message sending and receiving method of the embodiment of the present disclosure includes: Radio Frequency (RF) circuit 3710, memory 3715, input unit 3730, display unit 3740, sensor 3750, audio circuit 3760, wireless fidelity (WiFi) module 3770, processor 3780, and power supply 3790. It will be understood by those skilled in the art that Figure 37 The terminal structure shown does not constitute a limitation on the mobile phone or computer, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0559] The RF circuit 3710 may be used for receiving and sending signals during information transmission or calls. In particular, after receiving downlink information from the base station, it is sent to the processor 3780 for processing; in addition, the designed uplink data is sent to the base station.
[0560] The memory 3715 may be used to store software programs and modules. The processor 3780 executes various functional applications and data processing of the content terminal by running the software programs and modules stored in the memory 3715 .
[0561] The input unit 3730 may be configured to receive input digital or character information and generate key signal input related to the settings and function control of the content terminal. Specifically, the input unit 3730 may include a touch panel 3731 and other input devices 3732.
[0562] The display unit 3740 may be configured to display input information or provided information and various menus of the content terminal. The display unit 3740 may include a display panel 3741.
[0563] The audio circuit 3760, the speaker 3761, and the microphone 3762 may provide an audio interface.
[0564] In this embodiment, the processor 3780 included in the terminal can execute the message sending and receiving method of the previous embodiment.
[0565] The terminals of the embodiments of the present disclosure include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to content recommendation, data screening, etc.
[0566] Figure 38A structural block diagram of part of a server for implementing the message sending and receiving method of an embodiment of the present disclosure. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 3822 (for example, one or more processors) and memory 3832, and one or more storage media 3830 (for example, one or more mass storage devices) for storing application programs 3842 or data 3844. Among them, the memory 3832 and the storage medium 3830 can be short-term storage or persistent storage. The program stored in the storage medium 3830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 3822 can be configured to communicate with the storage medium 3830 to execute a series of instruction operations in the storage medium 3830 on the server.
[0567] The server may also include one or more power supplies 3826, one or more wired or wireless network interfaces 3850, one or more input and output interfaces 3858, and / or one or more operating systems 3841, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0568] The central processor 3822 in the server can be used to execute the message sending and receiving method of the embodiment of the present disclosure.
[0569] The embodiments of the present disclosure further provide a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the message sending and receiving methods of the aforementioned embodiments.
[0570] The present disclosure also provides a computer program product, which includes a computer program. A processor of a computer device reads and executes the computer program, so that the computer device implements the above-mentioned message sending and receiving method.
[0571] The terms "first," "second," "third," "fourth," and the like (if any) in the specification of the present disclosure and the accompanying drawings are used to distinguish between similar contents and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present disclosure described herein, for example, can be implemented in orders other than those illustrated or described herein. In addition, the terms "comprises" and "comprising," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0572] It should be understood that in the present disclosure, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated content, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and following associated content is in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0573] It should be understood that in the description of the embodiments of the present disclosure, the meaning of multiple (or multiple items) is more than two, greater than, less than, exceed, etc. are understood to exclude the number itself, and above, below, within, etc. are understood to include the number itself.
[0574] In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0575] Units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0576] In addition, the functional units in the various embodiments of the present disclosure may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0577] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server 130, or network device, etc.) to execute all or part of the steps of the various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0578] It should also be understood that the various implementations provided in the embodiments of the present disclosure can be combined arbitrarily to achieve different technical effects.
[0579] The above is a specific description of the implementation methods of the present disclosure, but the present disclosure is not limited to the above implementation methods. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present disclosure. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present disclosure.
Claims
1. A message sending method, characterized in that: For a source node, the source node has multiple applications, each of the applications corresponds to a message queue and a sub-message queue, and the message sending method includes: Based on the maximum sub-message size corresponding to the application, the message in the message queue corresponding to the application is divided into sub-messages, and the sub-messages are placed in the sub-message queue corresponding to the application; A token bucket is set for each sub-message queue, and tokens are placed in the token bucket at a first token placement rate until the token bucket is full. The token bucket is used to select the sub-message queue to which the head sub-message is to be sent from the sub-message queues corresponding to each application. The first number of tokens in the token bucket represents a byte length threshold for selecting the head sub-message to be sent. Poll the sub-message queues corresponding to each of the applications, select the sub-message queue whose head sub-message has a byte length not greater than the first number of tokens, take out the head sub-message in the selected sub-message queue and send it, and take out tokens of the number of byte lengths from the token bucket corresponding to the sub-message queue. For the sub-message queue whose head sub-message has a byte length greater than the first number of tokens, do not take out the head sub-message and send it.
2. The message sending method according to claim 1, wherein: The maximum sub-message size corresponding to different applications is different; The dividing the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and placing the sub-messages into the sub-message queue corresponding to the application, includes: Obtaining the maximum sub-message size corresponding to the application; If the message in the message queue corresponding to the application is not larger than the maximum sub-message size, treating the message as a sub-message and putting it into the sub-message queue corresponding to the application; If the message in the message queue corresponding to the application is larger than the maximum sub-message size, the sub-messages are separated from the message according to the maximum sub-message size and placed in the sub-message queue corresponding to the application.
3. The message sending method according to claim 1, wherein: The sub-message queue includes a plurality of sub-message sub-queues, each of the sub-message sub-queues has a different maximum sub-message size, and each of the sub-message sub-queues shares the token bucket corresponding to the sub-message queue; The polling of the sub-message queues corresponding to the respective applications, selecting the sub-message queue whose head sub-message has a byte length not greater than the first token number, and taking out and sending the head sub-message in the selected sub-message queue, comprises: Setting a sub-queue sequence number for each of the sub-message sub-queues; When polling one of the sub-message queues, specifying a sub-queue sequence number through a sub-queue sequence number designator, wherein the probability ratio of the sub-queue sequence numbers of the sub-message sub-queues specified by the sub-queue sequence number designator is equal to the ratio of the maximum sub-message sizes of the sub-message sub-queues; If the byte length of the head sub-message in the sub-message sub-queue corresponding to the sub-queue sequence number specified by the sub-queue sequence number designator is not greater than the first token number, the head sub-message is taken out and sent.
4. The message sending method according to claim 1, wherein: The step of taking out the head sub-message and sending it includes: Taking out the head sub-message of the queue and placing it into a sending queue shared by multiple sub-message queues; Taking out the sub-message from the sending queue and splitting it into messages; Allocating one of a plurality of candidate paths to the separated message; The message is sent to the destination node through the assigned candidate path.
5. The message sending method according to claim 4, wherein: The step of sending the message to the destination node through the allocated candidate path includes: Assigning a message sending sequence number to each of the sent messages through the assigned candidate path; Creating a first message bitmap, the first message bitmap comprising bits corresponding to the sequence numbers of the messages sent, wherein the bits corresponding to the sequence numbers of the messages sent are initialized to a first value; Recording the message sending sequence number, the message identifier of the message, the sub-message identifier of the sub-message to which the message belongs, the message identifier of the message to which the sub-message belongs, the offset of the sub-message in the message, and the application identifier of the application to which the message belongs in a first mapping table; The message sending sequence number, the message identifier, the sub-message identifier, the message identifier, the offset, the application identifier and the allocated candidate path identifier are added to the message, and sent to the destination node through the allocated candidate path.
6. The message sending method according to claim 5, characterized in that: After polling the sub-message queues corresponding to the respective applications, selecting the sub-message queue whose head sub-message has a byte length no greater than a first number of tokens, taking out the head sub-message in the selected sub-message queue and sending it, and taking out tokens of the byte length from the token bucket corresponding to the sub-message queue, the message sending method further comprises: receiving a confirmation response from the destination node, wherein the confirmation response includes the message sending sequence number and the candidate path identifier; Forwarding the confirmation response to the candidate path corresponding to the candidate path identifier, so that the candidate path sets the bit corresponding to the message sending sequence number in the first message bitmap to a second value; The message identifier, the sub-message identifier, the message identifier, the offset, and the application identifier corresponding to the message sending sequence number are searched in the first mapping table through the candidate path.
7. The message sending method according to claim 6, wherein: After taking the sub-messages from the sending queue and splitting them into messages, the message sending method further includes: assigning the message identifiers to the split messages, and creating a first sub-message bitmap corresponding to the sub-message identifiers, the first sub-message bitmap including bits corresponding to the respective message identifiers, wherein the bits corresponding to the respective message identifiers are initialized to the first value; After searching the message identifier, the sub-message identifier, the message identifier, the offset and the application identifier corresponding to the message sending sequence number in the first mapping table through the candidate path, the message sending method further includes: setting the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier to the second value.
8. The message sending method according to claim 7, wherein: After dividing the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application and placing the sub-messages into the sub-message queue corresponding to the application, the message sending method further includes: assigning the sub-message identifiers to the divided sub-messages, and creating a first message bitmap corresponding to the message identifiers, the first message bitmap including bits corresponding to the respective sub-message identifiers, wherein the bits corresponding to the respective sub-message identifiers are initialized to the first value; After setting the bit corresponding to the message identifier in the first sub-message bitmap corresponding to the sub-message identifier to the second value, the message sending method further includes: If the bits corresponding to the message identifiers in the first sub-message bitmap corresponding to the sub-message identifier are all set to the second value, searching the first message bitmap corresponding to the message identifier for the bit corresponding to the sub-message identifier according to the offset; Setting the bit corresponding to the sub-message identifier in the first message bitmap corresponding to the message identifier to the second value; If the bits corresponding to the sub-message identifiers in the first message bitmap corresponding to the message identifier are all set to the second value, the application corresponding to the application identifier is notified.
9. A message receiving method, characterized in that: For a destination node, the destination node having multiple applications, the message receiving method includes: Receive a message from a source node, the source node having multiple applications, each of the applications corresponding to a message queue and a sub-message queue, the message having a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of a message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs, wherein the sub-message is separated from the message in the source node based on a maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application, set a token bucket for each sub-message queue, poll the sub-message queues corresponding to each application, select the sub-message queue whose head sub-message has a byte length not greater than a first token number in the token bucket, take out the head sub-message in the selected sub-message queue and send it, wherein the token bucket is used to select the sub-message queue to which the head sub-message is to be sent from the sub-message queues corresponding to each application, and the first token number represents a byte length threshold for selecting the head sub-message to be sent; Based on the message identifier and the sub-message identifier, restoring the message to the sub-message corresponding to the sub-message identifier; Based on the sub-message identifier, the message identifier, and the offset, the sub-message is restored to the message corresponding to the message identifier.
10. The message receiving method according to claim 9, characterized in that: The restoring the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier includes: If the second sub-message bitmap corresponding to the sub-message identifier does not exist at the destination node, create the second sub-message bitmap; If the bit corresponding to the message identifier does not exist in the second sub-message bitmap, creating a bit corresponding to the message identifier in the second sub-message bitmap, and initializing the bit corresponding to the message identifier to a first value; The bit corresponding to the message identifier in the second sub-message bitmap is set to a second value, and the message is restored to the sub-message corresponding to the sub-message identifier according to the message identifier.
11. The message receiving method according to claim 10, wherein: The restoring the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset includes: If the bits corresponding to the respective message identifiers in the second sub-message bitmap corresponding to the sub-message identifier are all set to the second value, and the destination node does not exist in the second message bitmap corresponding to the message identifier, then creating the second message bitmap; If the bit corresponding to the sub-message identifier does not exist in the second message bitmap, creating a bit corresponding to the sub-message identifier in the second message bitmap according to the offset, and initializing the bit corresponding to the sub-message identifier to a first value; The bit corresponding to the sub-message identifier in the second message bitmap corresponding to the message identifier is set to the second value, and the sub-message is restored to the message corresponding to the message identifier according to the offset.
12. The message receiving method according to claim 10, wherein: After restoring the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset, the message receiving method further includes: If the bits corresponding to the sub-message identifiers in the second message bitmap corresponding to the message identifier are all set to the second value, the application corresponding to the application identifier is notified.
13. The message receiving method according to claim 9, wherein: The message also has a message sending sequence number and a candidate path identifier of a candidate path for transmitting the message; After receiving the message from the source node, the message receiving method further includes: Forwarding the message to the candidate path corresponding to the candidate path identifier; If the second message bitmap corresponding to the candidate path identifier does not exist, creating the second message bitmap through the candidate path; If the bit corresponding to the message identifier does not exist in the second message bitmap, creating a bit corresponding to the message identifier in the second message bitmap, and initializing the bit corresponding to the message identifier to a first value; Setting the bit corresponding to the message identifier in the second message bitmap corresponding to the candidate path identifier to a second value; Among them, the step of restoring the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier is performed under the premise that the bits corresponding to each message identifier in the second message bitmap corresponding to the candidate path identifier are set to the second value.
14. The message receiving method according to claim 13, wherein: After restoring the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset, the message receiving method further includes: Generate a confirmation response, the confirmation response including the message sending sequence number and the candidate path identifier; The confirmation response is sent to the source node.
15. A message sending device, characterized in that: Used for a source node, the source node has multiple applications, each of the applications corresponds to a message queue and a sub-message queue, and the message sending device includes: a message dividing unit, configured to divide the message in the message queue corresponding to the application into sub-messages based on the maximum sub-message size corresponding to the application, and put the sub-messages into the sub-message queue corresponding to the application; a first setting unit, configured to set a token bucket for each sub-message queue, wherein the token bucket is configured to place tokens at a first token placement rate until the token bucket is full, wherein the token bucket is configured to select a sub-message queue to which a head sub-message is to be sent from the sub-message queues corresponding to the respective applications, wherein a first number of tokens in the token bucket represents a byte length threshold for selecting the head sub-message to be sent; A polling unit is used to poll the sub-message queues corresponding to each of the applications, select the sub-message queue whose head sub-message has a byte length not greater than the first token number, take out the head sub-message in the selected sub-message queue and send it, and take out tokens of the number of byte lengths from the token bucket corresponding to the sub-message queue. For the sub-message queue whose head sub-message has a byte length greater than the first token number, the head sub-message will not be taken out and sent.
16. A message receiving device, characterized in that: For a destination node, the destination node having multiple applications, the message receiving means comprising: A first receiving unit is configured to receive a message from a source node, wherein the source node has multiple applications, each of which corresponds to a message queue and a sub-message queue. The message has a message identifier of the message, a sub-message identifier of a sub-message to which the message belongs, a message identifier of a message to which the sub-message belongs, an offset of the sub-message in the message, and an application identifier of the application to which the message belongs. The sub-message is separated from the message in the source node based on a maximum sub-message size corresponding to the application and placed in a sub-message queue corresponding to the application. A token bucket is set for each sub-message queue, and the sub-message queue corresponding to each application is polled. The sub-message queue whose byte length of the head sub-message is not greater than a first token number in the token bucket is selected, and the head sub-message in the selected sub-message queue is taken out and sent. The token bucket is used to select the sub-message queue to which the head sub-message is to be sent from the sub-message queues corresponding to each application, and the first token number represents a byte length threshold for selecting the head sub-message to be sent. a first restoring unit, configured to restore the message to the sub-message corresponding to the sub-message identifier based on the message identifier and the sub-message identifier; The second restoring unit is configured to restore the sub-message to the message corresponding to the message identifier based on the sub-message identifier, the message identifier, and the offset.
17. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the message sending method according to any one of claims 1 to 8 or the message receiving method according to any one of claims 9 to 14 is implemented.
18. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the message sending method according to any one of claims 1 to 8 or the message receiving method according to any one of claims 9 to 14 is implemented.
19. A computer program product, comprising a computer program, wherein the computer program is read and executed by a processor of a computer device, so that the computer device executes the message sending method according to any one of claims 1 to 8 or the message receiving method according to any one of claims 9 to 14.
Citation Information
Patent Citations
Data transmission method and device, network equipment and storage medium
CN117914965A