Message communication method, device, equipment and medium
By using a preset protocol in a distributed service to create a connection between the sender and the receiver to establish information and retransmit message packets, the problems of resource overhead and message reliability are solved, and efficient and reliable message communication is achieved.
Patent Information
- Application Number
- CN202211129424.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2042-09-16
AI Technical Summary
The message communication method in distributed services cannot solve the problems of high resource overhead and message reliability at the same time. Especially after the internal network topology is built, there are problems of message loss and disorder.
Within the distributed service, the sender and receiver create connection establishment information through a preset protocol and send a communication establishment request before sending the initial message packet. If the message packet is lost, it is retransmitted based on the session information. This simplifies the communication connection establishment process, avoids multiple handshakes, improves efficiency, and ensures the reliability of messages through retransmission.
On the basis of solving the resource overhead problem, the reliability of message communication is guaranteed, the communication connection is quickly established through the preset protocol, resource consumption is reduced, and the successful sending of the message packet is ensured by retransmission when the message packet is lost.
Smart Images

Figure CN115499484B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a message communication method, apparatus, device, and medium. Background Art
[0002] In a distributed service, the entire cluster contains a large number of services, and network messages can be exchanged between any two of them. For example, in a distributed game service, objects in the game are called entities, and entities can be services, which means that network messages can be exchanged between any two entities. In other words, distributed services contain a large number of communication objects.
[0003] In related technologies, message communication between different communication objects in distributed services can be implemented using the Transmission Control Protocol (TCP). Due to the high resource overhead of TCP, an internal network topology is constructed to address this resource overhead. However, this method of message communication requires jumping through multiple internal communication objects, which can lead to problems such as message loss and message disorder, and still poses message reliability issues. In summary, the message communication method in distributed services cannot simultaneously solve the problem of high resource overhead and ensure message reliability. Summary of the Invention
[0004] In order to solve the above technical problems, the present disclosure provides a message communication method, apparatus, device and medium.
[0005] An embodiment of the present disclosure provides a message communication method, which is applied to a sending end within a distributed service, including:
[0006] Before sending the initial message packet, the sending end creates connection establishment information with the receiving end, and sends a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate using a preset protocol;
[0007] Acquiring session information created by the receiving end based on the connection establishment information, and establishing a communication connection with the receiving end based on the session information;
[0008] If it is determined that the initial message packet is lost, the initial message packet is resent to the receiving end based on the session information.
[0009] An embodiment of the present disclosure provides a message communication method, which is applied to a receiving end within a distributed service, including:
[0010] receiving a communication establishment request sent by a sending end, wherein the communication establishment request includes an initial message packet and connection establishment information, wherein the connection establishment information is created by the sending end before sending the initial message packet, and the sending end and the receiving end communicate via a preset protocol;
[0011] Creating session information based on the connection establishment information, and returning the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information;
[0012] The initial message packet is received, which is resent by the sending end based on the session information when the sending end determines that the initial message packet is lost.
[0013] The present disclosure also provides a message communication device, which is provided at a sending end within a distributed service and includes:
[0014] a sending module, configured to create connection establishment information with a receiving end before sending an initial message packet, and send a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate via a preset protocol;
[0015] an establishing module, configured to obtain session information created by the receiving end based on the connection establishment information, and establish a communication connection with the receiving end based on the session information;
[0016] A resending module is configured to resend the initial message packet to the receiving end based on the session information if it is determined that the initial message packet is lost.
[0017] The present disclosure also provides a message communication device, which is provided at a receiving end within a distributed service and includes:
[0018] a receiving module, configured to receive a communication establishment request sent by a sending end, wherein the communication establishment request includes an initial message packet and connection establishment information, wherein the connection establishment information is created by the sending end before sending the initial message packet, and the sending end and the receiving end communicate via a preset protocol;
[0019] a return module, configured to create session information based on the connection establishment information, and return the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information;
[0020] The retransmission receiving module is configured to receive the initial message packet retransmitted by the sending end based on the session information when determining that the initial message packet is lost.
[0021] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the message communication method provided by the embodiment of the present disclosure.
[0022] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the message communication method provided by the embodiment of the present disclosure.
[0023] The technical solution provided by the embodiment of the present disclosure has the following advantages over the prior art: the message communication solution provided by the embodiment of the present disclosure, the sending end inside the distributed service creates connection establishment information with the receiving end before sending the initial message packet, and sends a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate through a preset protocol; obtains the session information created by the receiving end based on the connection establishment information, and establishes a communication connection with the receiving end based on the session information; if it is determined that the initial message packet is lost, the initial message packet is resent to the receiving end based on the session information. The above technical solution is adopted, by setting a preset protocol inside the distributed service, so that the sending end and the receiving end can quickly establish a communication connection when sending a message packet through the preset protocol, without the need for multiple handshakes, thereby improving the efficiency of establishing a communication connection, avoiding the problem of high resource overhead caused by the use of the TCP protocol in related technologies, and when the message packet is lost, the message packet can be successfully sent by retransmission, thereby ensuring the reliability of message communication, and guaranteeing the reliability of the message on the basis of solving the resource overhead problem. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0025] Figure 1 A schematic diagram of a message communication in the related art;
[0026] Figure 2 A flowchart of a message communication method provided in some embodiments of the present disclosure;
[0027] Figure 3 A schematic diagram of establishing a communication connection provided in some embodiments of the present disclosure;
[0028] Figure 4 A schematic diagram of message retransmission provided in some embodiments of the present disclosure;
[0029] Figure 5 A schematic diagram of a message packet provided for some embodiments of the present disclosure;
[0030] Figure 6 A schematic diagram of process migration provided for some embodiments of the present disclosure;
[0031] Figure 7 A flowchart of another message communication method provided in some embodiments of the present disclosure;
[0032] Figure 8 A schematic diagram of residual connection processing provided in some embodiments of the present disclosure;
[0033] Figure 9 A schematic diagram of residual data packet processing provided in some embodiments of the present disclosure;
[0034] Figure 10 A schematic structural diagram of a message communication device provided in some embodiments of the present disclosure;
[0035] Figure 11 A schematic structural diagram of another message communication device provided in some embodiments of the present disclosure;
[0036] Figure 12 A schematic structural diagram of an electronic device provided in some embodiments of the present disclosure. DETAILED DESCRIPTION
[0037] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0038] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0039] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0040] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0041] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0042] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0043] In related technologies, message communication between different communication objects in a distributed service can be achieved through the Transmission Control Protocol (TCP). TCP is a common protocol used to ensure message reliability. It is applicable to mutual communication between any two network hosts or services. TCP establishes a connection through a three-way handshake. Each TCP segment has a sequence number. By using the sequence number, the TCP layer can deliver the information in the received segment to the application layer in the correct order, and the sender detects lost transmission data and retransmits the data to ensure reliability. However, TCP connections have a large resource overhead. For a server, the maximum number of TCP connections that can be supported is 65535. In a distributed service, any two internal service processes can communicate with each other. Assuming that a server deploys 50 service processes and the entire cluster has a total of 10,000 service processes, when using TCP to connect all services, a server needs to support 500,000 connections.
[0044] In order to solve the resource overhead problem, the distributed game service architecture can usually ensure the reliability of messages through reasonable network topology design combined with TCP. Figure 1This is a schematic diagram of a message communication technique in the related art. The diagram shows the network topology structure in a distributed game service. A multi-layer network structure is constructed using router and multi-port forwarder processes. Two connected processes directly use TCP connections, and two game processes communicate messages through multiple layers of relays. For example, in the diagram, between game process 11 and game process 21, the following sequence follows: game process 11 -> router 1 -> multi-port forwarder -> router 2 -> game process 21. However, after constructing the internal network topology, message communication must jump through multiple internal communication objects (e.g., processes). Multiple message communications between two communication objects can lead to message loss and message disarray due to factors such as a dynamic increase in the number of internal communication objects, server downtime, or network failures in the computer room. For example, messages can be lost due to disconnection and reconnection, or messages can be routed to the wrong link after capacity expansion and the addition of new routers. This still poses message reliability issues. In summary, the message communication method in distributed services cannot simultaneously address the high resource overhead and guarantee message reliability.
[0045] In order to solve the above problems, an embodiment of the present disclosure provides a message communication method, which is introduced below in conjunction with specific embodiments.
[0046] Figure 2 This is a flow chart of a message communication method provided by some embodiments of the present disclosure. The method can be executed by a message communication device, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. Figure 2 As shown, the method is applied to the sending end within the distributed service, including:
[0047] Step 101: Create connection establishment information with the receiving end before sending the initial message packet, and send a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate through a preset protocol.
[0048] The message communication method of the embodiments of the present disclosure can be executed by a communication object within a distributed service that acts as a sender. A communication object is a broad term that can include objects capable of message communication, such as network hosts and entities within a game. Any communication object within a distributed service can serve as a sender in the embodiments of the present disclosure, and any other communication object communicating with that communication object can serve as a receiver in the embodiments of the present disclosure.
[0049] The initial message packet may be the first message packet that the sender needs to send to the receiver. Due to the internal communication of the distributed service, all message contents are credible. Therefore, the two communicating objects can also send message packets before establishing a communication connection, but the message packets will not be stored. The connection establishment information can be understood as unilateral information created by the sender when it determines that it does not have an established connection with the current receiver. It can include a connection sequence number and a connection timestamp, and store it locally. The preset protocol can be a new protocol in the embodiment of the present disclosure that can establish a communication connection without handshaking, and can be a custom protocol.
[0050] In an embodiment of the present disclosure, the sending end within the distributed service can create connection establishment information with the receiving end before sending the initial message packet and cache it locally, add the initial message packet and connection establishment information to the communication establishment request and send it to the receiving end through a preset protocol to enable the receiving end to perform subsequent operations.
[0051] Step 102: Acquire session information created by the receiving end based on the connection establishment information, and establish a communication connection with the receiving end based on the session information.
[0052] The session information may be created by the receiving end based on the communication establishment request of the sending end, and is used to indicate the session ID of the subsequent communication connection established between the sending end and the receiving end. The session information is created by the receiving end and sent to the sending end to establish the communication connection.
[0053] Specifically, after the receiving end receives the communication establishment request, it can store the connection establishment information and confirm the need to establish a communication connection with the receiving end based on the connection establishment information. It can then create a session information and return the session information to the sending end; after the sending end receives the session information, it can establish a session with the receiving end based on the session information, that is, establish a communication connection link between the sending end and the receiving end, and subsequently message communication can be carried out based on this link.
[0054] For example, Figure 3 A schematic diagram of establishing a communication connection provided in some embodiments of the present disclosure, such as Figure 3As shown in the figure, seq represents the sequence number of the message packet, and ack represents the confirmation packet, indicating that the sent data has been confirmed to be received correctly, and the sender and the receiver can communicate through routing; the process of establishing a communication connection may include: the sender sends a communication establishment request including the initial message packet seq1 and the connection establishment information to the receiver; the receiver replies with the confirmation packet ack1 and the session information created based on the connection establishment information to the sender; the sender establishes a communication connection with the receiver based on the session information, and then the sender can send subsequent message packets seq3 and seq4 to the receiver based on the communication connection, and receive corresponding confirmation packets ack3 and ack4; during the communication establishment process, the sender can also send message packet seq2 to the receiver, and receive the corresponding confirmation packet ack2.
[0055] In this solution, since the content of all messages within the distributed service is trustworthy, the process of establishing a communication connection can be simplified. Unlike TCP, there is no need for a three-way handshake. Instead, the connection is quickly established when the message is actually sent, which improves the efficiency of establishing the communication connection.
[0056] Step 103: If it is determined that the initial message packet is lost, the initial message packet is resent to the receiving end based on the session information.
[0057] After sending the initial message packet, if the sending end determines that the duration of not receiving the confirmation packet of the initial message packet is greater than the preset duration, it is determined that the initial message packet is lost. The initial message packet can then be resent to the receiving end based on the session information. If the retransmitted message packet is still lost after the retransmission, multiple retransmissions can be performed. In the case of multiple retransmissions, the above-mentioned preset duration is continuously extended until the confirmation message packet is successful.
[0058] For example, Figure 4 A schematic diagram of message retransmission is provided for some embodiments of the present disclosure. In the figure, seq represents the sequence number of the message packet, ack represents the confirmation packet, and the request to establish a session is the above-mentioned communication establishment request. The sending end sends a communication establishment request including an initial message packet seq1 and connection establishment information to the receiving end. The initial message packet seq1 confirms packet loss; the receiving end replies with session information to the sending end; the sending end establishes a communication connection with the receiving end based on the session information, and then the sending end can resend the initial message packet seq1 to the receiving end based on the communication connection.
[0059] In the above scheme, the reliability of message communication is guaranteed by the message retransmission mechanism.
[0060] In some embodiments, the message communication method may further include: if it is determined that the initial message packet is lost before the session information is obtained, resending the communication establishment request to the receiving end.
[0061] If the sending end determines that the initial message packet is lost before step 102, since the communication connection with the receiving end has not yet been established, message retransmission is prohibited. Instead, the sending end triggers the retransmission of the communication establishment request to the receiving end, thereby resending the initial message packet and establishing the communication connection. That is, for the sending end, there are two states: a connecting state and a successful connection state. The connecting state means that the sending end has created the connection establishment information but has not yet obtained the session information to establish the communication connection. The successful connection state means that the communication connection with the receiving end has been established. In the connecting state, message retransmission is prohibited, while in the successful connection state, message retransmission is allowed.
[0062] The message communication solution provided by the embodiment of the present disclosure is that the sending end inside the distributed service creates connection establishment information with the receiving end before sending the initial message packet, and sends a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate through a preset protocol; obtains the session information created by the receiving end based on the connection establishment information, and establishes a communication connection with the receiving end based on the session information; if it is determined that the initial message packet is lost, the initial message packet is resent to the receiving end based on the session information. The above technical solution is adopted, by setting a preset protocol inside the distributed service, so that the sending end and the receiving end can quickly establish a communication connection when sending a message packet through the preset protocol, without the need for multiple handshakes, thereby improving the efficiency of establishing a communication connection, and avoiding the problem of high resource overhead caused by the use of the TCP protocol in related technologies, and when the message packet is lost, the message packet can be successfully sent by retransmission, thereby ensuring the reliability of message communication and guaranteeing the message reliability on the basis of solving the resource overhead problem.
[0063] In some embodiments, because the sending and receiving ends communicate via a preset protocol, embodiments of the present disclosure may redesign the structure of the message packet, of which the initial message packet is one. The basic header information of the message packet includes the protocol number, a tag field, a communication object identifier, and a peer process identifier. The tag field includes a first field indicating whether to retransmit and a second field indicating whether the message is the minimum sequence number. The message packet header includes connection establishment information, session information, and a message sequence number. The connection establishment information includes a connection timestamp and a connection sequence number.
[0064] For example, Figure 5 A schematic diagram of a message packet provided in some embodiments of the present disclosure, such as Figure 5As shown, the first field in the tag field of the basic packet header marks whether the message is retransmitted. Different routing rules can be used for retransmitted and non-retransmitted message packets to avoid a long period of retransmission and failure to deliver due to a certain routing link being unavailable; the second field marks whether the message has the smallest sequence number; the mark of whether the smallest sequence number indicates that the current message has the smallest sequence number and has not received an acknowledgment character (ACK). The first message packet sent must be marked with the smallest sequence number, and the receiving end processes the message packets in sequence starting from the smallest sequence number; the communication object identifier (ID) and the peer process identifier (ID) are used to route the message packet. The communication object identifier can be identification information that uniquely represents the receiving end, and the peer process identifier can be an identifier that uniquely represents the process of intermediate message forwarding. The message packet header includes connection establishment information, session information, and message sequence number. The session information can be a session identifier that uniquely represents the communication connection established between the sending end and the receiving end, and the message sequence number can uniquely represent the processing order of the current message packet.
[0065] In the above solution, by redesigning the header of the message packet within the distributed service, it is applicable to the communication connection of the above embodiment, which helps to solve subsequent problems during the transmission of the message packet.
[0066] In some embodiments, the message communication method may further include: if the duration of not sending subsequent message packets is greater than a first duration threshold, and / or a notification is received from the message routing end that the receiving end does not exist, closing the communication connection with the receiving end.
[0067] The subsequent message packet is a message packet sent after the sender establishes a communication connection with the receiver, and is used to distinguish it from the initial message packet. The first duration threshold can be a duration threshold set for the sender, which can be set according to actual circumstances. For example, the first duration threshold can be 5 minutes. The message routing end can be a routing end that relays messages between the sender and the receiver. In the embodiments of the present disclosure, the sender and the receiver can communicate messages directly or through the message routing end.
[0068] If the sending end determines that no subsequent message packets have been sent within the first duration threshold, i.e., that no messages have been sent for a period of time, it can proactively close the communication connection with the receiving end and send a closure notification to the receiving end, prompting the receiving end to also close the communication connection. Alternatively, if the message routing end detects that the receiving end has gone offline, it can trigger a notification to the sending end indicating that the receiving end no longer exists. Upon receiving this notification, the sending end can close the communication connection with the receiving end. Optionally, the sending end and the receiving end can clear the communication connection after closing it.
[0069] In the above solution, the sending end can actively or passively disconnect the communication connection with the receiving end at a certain time to save resource overhead.
[0070] In some embodiments, the message communication method may further include: during the migration process of the receiving end from the initial process to the target process, sending the target message packet to the initial process and the target process, wherein the initial process forwards the first part of the message packet in the target message packet to the target process after receiving it, and the receiving end suspends message processing and confirmation reply during the migration process; if it is confirmed that the migration process has failed and the second part of the message packet in the target message packet is lost, the target message packet is resent to the initial process.
[0071] Within a distributed service, a process can include multiple communication objects. The processes containing these communication objects support migration. The initial process represents the receiving end's process before migration, while the target process represents the receiving end's process after migration. Target message packets can be any number of message packets sent by the sender during the migration of the receiving end's process.
[0072] Specifically, during the migration process of the receiving end from the initial process to the target process, the sending end sends the first part of the target message packet to the initial process through the old route, and sends the second part of the target message packet to the target process through the new route. After receiving the first part of the message packet in the target message packet, the initial process can directly forward it to the target process. After receiving the second part of the message packet, the receiving end in the target process can submit it to the protocol layer for caching; if the sending end confirms that the migration process has failed and executes the rollback, the second part of the message packet sent to the target process may be lost. Since the receiving end can suspend message processing and reply to the confirmation packet during the migration process, the sending end determines that the duration of the confirmation packet of the second part of the message packet is greater than the preset duration, then it can be determined that the second part of the message packet is lost, and the second part of the message packet is resent to the initial process.
[0073] For example, Figure 6 A schematic diagram of process migration provided in some embodiments of the present disclosure, such as Figure 6 As shown in the figure, the migration process of the receiving end process is shown. The receiving end process migrates from the initial process to the target process. During the migration process, the sender sends part of the message to the initial process and part of the message to the target process. The initial process directly forwards the received part of the message to the target process. The receiving end can suspend message processing and reply to confirmation packets during the migration process, and resume message processing and reply to confirmation packets after the migration is completed.
[0074] In gaming scenarios, service migrations occur. For example, an object or service can migrate from one physical server to another. For network communication, this is conceptually similar to the dynamic change of the other party's address. In the above solution, by pausing message processing and confirming responses when the communicating party undergoes process migration, a retransmission mechanism can be used to ensure message reliability in the event of a migration failure.
[0075] Figure 7 This is a flow chart of another message communication method provided by some embodiments of the present disclosure. The method can be executed by a message communication device, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. Figure 7 As shown, the method is applied to the receiving end within the distributed service, including:
[0076] Step 701: Receive a communication establishment request sent by a sending end. The communication establishment request includes an initial message packet and connection establishment information. The connection establishment information is created by the sending end before sending the initial message packet. The sending end and the receiving end communicate through a preset protocol.
[0077] Any communication object in a distributed service can serve as a receiving end in accordance with an embodiment of the present disclosure, and another communication object communicating with the communication object can serve as a sending end in accordance with an embodiment of the present disclosure.
[0078] In an embodiment of the present disclosure, the sending end within the distributed service can create connection establishment information with the receiving end before sending the initial message packet and cache it locally, add the initial message packet and connection establishment information to the communication establishment request and send it to the receiving end through a preset protocol; the receiving end can receive the communication establishment request.
[0079] Step 702: Create session information based on the connection establishment information, and return the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information.
[0080] After receiving the communication establishment request, the receiving end can store the connection establishment information and confirm the need to establish a communication connection with the receiving end based on the connection establishment information. Then, it can create a session information and return the session information to the sending end. After receiving the session information, the sending end can establish a session with the receiving end based on the session information, that is, establish a communication connection link between the sending end and the receiving end, and subsequently message communication can be carried out based on this link.
[0081] Step 703: Receive the initial message packet resent by the sending end based on the session information when determining that the initial message packet is lost.
[0082] After sending the initial message packet, if the sending end determines that the duration of not receiving the confirmation packet of the initial message packet is greater than the preset duration, it is determined that the initial message packet is lost. The initial message packet can then be resent to the receiving end based on the session information. If the retransmitted message packet is still lost after the retransmission, multiple retransmissions can be performed. In the case of multiple retransmissions, the above-mentioned preset duration is continuously extended until the confirmation message packet is successful.
[0083] The message communication solution provided by the embodiment of the present disclosure is that the receiving end inside the distributed service can receive the communication establishment request sent by the sending end, and the communication establishment request includes an initial message packet and connection establishment information. The connection establishment information is created by the sending end before sending the initial message packet. The sending end and the receiving end communicate through a preset protocol; create session information based on the connection establishment information, and return the session information to the sending end so that the sending end establishes a communication connection with the receiving end based on the session information; receive the initial message packet resent by the sending end based on the session information when determining that the initial message packet is lost. The above technical solution is adopted, by setting a preset protocol inside the distributed service, so that the sending end and the receiving end can quickly establish a communication connection when sending a message packet through the preset protocol, without the need for multiple handshakes, thereby improving the efficiency of establishing a communication connection, and avoiding the problem of high resource overhead caused by the use of the TCP protocol in related technologies. In addition, when the message packet is lost, the message packet can be successfully sent by retransmission, thereby ensuring the reliability of message communication and guaranteeing the message reliability on the basis of solving the resource overhead problem.
[0084] In some embodiments, the message communication method may further include: if the duration of not receiving subsequent message packets from the sender is greater than a second duration threshold, sending a detection message to the sender through the message routing end; if a notification that the sender does not exist is received from the message routing end, clearing the residual connection between the sender and the sender.
[0085] Among them, the second duration threshold can be a duration threshold set for the receiving end, which can be set according to actual conditions. The message routing end can be a routing end that transfers messages between the sending end and the receiving end. In the embodiment of the present disclosure, the sending end and the receiving end can communicate messages directly, or can communicate messages through the message routing end. The detection message can be a message used to determine whether the local end can successfully exchange information packets with the other end, and then determine whether there is a problem with the connection with the other end based on the returned information. For example, the detection message can use the ping command. The residual connection can be a communication connection that only exists unilaterally for the receiving end when the sending end directly closes the communication connection with the receiving end when it goes offline, and the close notification sent to the receiving end is not delivered.
[0086] Specifically, if the receiving end does not receive subsequent message packets from the sending end within a continuous period exceeding the second time threshold, it can send an activity detection message to the sending end, and the activity detection message is forwarded through the message routing end; if the receiving end receives a notification from the message routing end that the sending end does not exist, it can be determined that the sending end has gone offline and cleared the communication connection, and at this time the residual connection between the sending end and the sending end can be cleared.
[0087] For example, Figure 8 A schematic diagram of residual connection processing provided in some embodiments of the present disclosure, such as Figure 8 As shown in the figure, the process of residual connection processing by the receiving end can be specifically included: the receiving end can update the activity time, that is, the time when the sending end last sent a message; the close notification sent to the receiving end after the sending end goes offline is lost; if the receiving end does not receive subsequent message packets from the sending end for a duration greater than the second duration threshold, it is determined that the sending end has been inactive for a long time and a detection message can be sent to the sending end; when the receiving end receives a notification from the message routing end that the sending end does not exist, the residual connection between the receiving end and the sending end can be cleared.
[0088] In the above scheme, when the sending end actively closes the communication connection and the close notification is lost, the receiving end can clean up the residual connection through liveness detection, thereby avoiding message loss caused by unilateral retention of the communication connection and saving resource overhead.
[0089] In some embodiments, the message communication method may further include: if it is determined that there is a retransmission packet among the multiple processed first message packets, clearing the current communication connection at a preset time, wherein the preset time is greater than or equal to the sum of the connection time and the delay time of the current communication connection. Optionally, the message communication method may further include: if no local communication connection exists when the second message packet is received, determining whether the second message packet is an initial network residual packet; if the second message packet is an initial network residual packet, sending a confirmation request for the initial network residual packet to the sending end so that the sending end confirms the initial network residual packet; determining that the initial network residual packet is a target network residual packet based on the confirmation information returned by the sending end, and discarding the target network residual packet.
[0090] The first message packet may be a message packet that has been processed by the receiving end, and the retransmission packet may be a message packet that is retransmitted after confirming that a message packet is lost. The retransmission packet here refers to a retransmission packet among multiple first message packets. If a message packet is a retransmission packet, its basic packet header information has a first field marked as retransmission. The connection time of the current communication connection can be extracted from the connection timestamp of the basic packet header information in the first message packet. The delay time can be a preset fixed clearing time that can be set according to actual conditions. For example, the delay time can be set to 10 seconds. The preset time can be the specific time when the current communication connection is cleared or destroyed. The preset time is a time after the connection time exceeds the delay time, that is, the current communication connection is cleared at least after the connection time plus the delay time.
[0091] The second message packet can be a message packet received by the receiving end when there is no local communication connection, a message packet received by the receiving end after the current communication connection is cleared, or a message packet at another time. The initial network residual packet can be a preliminarily determined network residual packet, and the target network residual packet can be the final network residual packet determined by the sending end. For network residual packets, when a message packet is sent and no confirmation packet is received within a preset time, it can trigger the retransmission of the message packet, that is, the sending of a retransmission packet of the message packet. At this time, the message packet sent for the first time is not necessarily lost, and may still be in a link node of the cluster due to process or machine lag, etc., and has not yet been delivered. At this time, the retransmission packet of the message packet may reach the receiving end faster through a different link and be processed normally; in more extreme cases, the current communication connection is fully processed and closed and cleared, and the information packet sent for the first time is sent to the receiving end. This part of the message packet is called a network residual packet. Since the network residual packet received by the receiving end before the communication connection is closed and cleared can be directly identified and discarded, while the network residual packet received by the receiving end after the communication connection is closed and cleared cannot be directly identified and processed, the network residual packet in the embodiment of the present disclosure refers to a network residual packet that cannot be identified and processed.
[0092] Specifically, in order to process network residual packets, the receiving end can set a delayed clearing mechanism for the current communication connection with the sending end. Since network residual packets may only appear when there are retransmission packets, for multiple processed first message packets, it can be determined whether there are retransmission packets. Specifically, it can be determined whether to mark the retransmission based on the first field of the basic packet header information in each first message packet. If it is determined that there is no retransmission packet, the current communication connection can be directly closed and cleared, and the delayed clearing mechanism will not be triggered; if it is determined that there is a retransmission packet, the current communication connection can be cleared at a preset time, that is, at least after the connection time plus the delay time. For example, the connection time of the current communication connection is 10 seconds. If it is determined that there is a retransmission packet and the delay time is 10 seconds, the current communication connection will be cleared at least after 20 seconds.
[0093] When the receiving end receives the second message packet when there is no communication connection locally, it can determine whether it is the initial network residual packet based on the receiving time in the second message packet. If so, it sends a confirmation request for the initial network residual packet to the sending end so that the sending end confirms the initial network residual packet. If the confirmation information returned by the sending end indicates that the communication connection of the initial network residual packet does not exist, it can be determined that the initial network residual packet is the target network residual packet and the target network residual packet is discarded; if the confirmation information returned by the sending end indicates that the communication connection of the initial network residual packet exists, the second message packet can be processed; if it is determined that the second message packet is not the initial network residual packet, session information can be created to create a new communication connection with the sending end.
[0094] Optionally, determining whether the second message packet is an initial network residual packet includes: if the reception time of the second message packet is after the corresponding target time, determining that the second message packet is an initial network residual packet; otherwise, determining that the second message packet is not an initial network residual packet, and the target time is the sum of the connection time and the delay time in the second message packet.
[0095] When the receiving end determines whether the second message packet is an initial network residual packet, it can be determined based on the receiving time and target time of the second message packet. The target time can be the sum of the connection time obtained by extracting the connection timestamp of the basic packet header information in the second message packet and the preset delay time, that is, the time after the connection time passes the delay time; if the receiving time of the second message packet is after the above-mentioned target time, that is, outside the connection time plus the delay time, it is determined that the second message packet is received after its corresponding communication connection is cleared, and it is determined to be an initial network residual packet; if the receiving time of the second message packet is before the above-mentioned target time, that is, within the connection time plus the delay time, it means that no communication connection has been established before, and it can be determined that it is not an initial network residual packet.
[0096] For example, Figure 9 A schematic diagram of residual data packet processing provided in some embodiments of the present disclosure, such as Figure 9As shown in the figure, the processing process of the residual data packet at the receiving end is shown, specifically including: the sending end sends a packet, the connection time is T, it is blocked in route 1, and then resends and subsequently sends packets, which are transferred through route 2. The receiving end does not need to verify to establish a communication connection; the sending end sends a close instruction to the receiving end. After the receiving end closes the communication connection, due to the resend packet, it needs to delay until T+X time to clear the communication connection, X is the delay time; then the network residual message blocked by route 1 is continued to be forwarded. After the receiving end receives the message packet, the connection time of the message packet is T. If it is determined that the reception time of the message packet is greater than T+X, it may be a network residual packet, that is, it exceeds the cleaning time and needs to be verified. A confirmation request can be sent to the sending end. If the sending end determines that the message packet has no connection verification and fails, the receiving end can confirm that the message packet is a network residual packet and discard it.
[0097] This solution does not require multiple handshakes to establish and disconnect connections. To address the problem of unrecognizable residual message packets, the above solution sets up a delay cleaning mechanism. According to the reception time of the message packet, the corresponding connection time and the delay time, the possible residual data packets can be judged, and the unrecognizable network residual packets can be finally determined for processing through confirmation by the sender, thereby solving the problem of processing unrecognizable network residual packets.
[0098] In some embodiments, the message communication method may further include: suspending message processing and confirmation reply during the migration process from the initial process to the target process at the receiving end; and starting message processing and confirmation reply after the migration process ends.
[0099] During the migration process from the initial process to the target process, the receiving end can suspend the message processing and confirmation reply process; the sending end sends the first part of the target message packet to the initial process via the old route, and sends the second part of the target message packet to the target process via the new route. After receiving the first part of the target message packet, the initial process can directly forward it to the target process. After receiving the second part of the message packet, the receiving end in the target process can submit it to the protocol layer for caching. After the migration process is completed, the message processing and confirmation reply process can be started. If the sending end confirms that the migration process has failed and performs a rollback, the second part of the message packet sent to the target process may be lost. Since the receiving end can suspend message processing and confirmation packet reply during the migration process, the sending end determines that the duration of the confirmation packet of the second part of the message packet is greater than the preset duration. In this case, it can be determined that the second part of the message packet is lost and the second part of the message packet is resent to the initial process.
[0100] In the above solution, by suspending message processing and confirming responses when the communication object performs process migration, the reliability of the message can be guaranteed through a retransmission mechanism when the migration fails.
[0101] In this solution, in distributed services, connections between different communication objects can be established without delay based on internal network characteristics and preset protocols, and the header structure of the message packet can be redesigned to solve the problem of network residual packets under the fast connection establishment method. It not only solves the message reliability problem between internal services with less resource overhead, but also solves the problem of migration of communication objects between processes.
[0102] Figure 10 This is a schematic diagram of the structure of a message communication device provided in some embodiments of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 10 As shown, the device is set at the sending end within the distributed service and includes:
[0103] The sending module 1001 is configured to create connection establishment information with a receiving end before sending an initial message packet, and send a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate via a preset protocol;
[0104] Establishing module 1002, configured to obtain session information created by the receiving end based on the connection establishment information, and establish a communication connection with the receiving end based on the session information;
[0105] The resending module 1003 is configured to resend the initial message packet to the receiving end based on the session information if it is determined that the initial message packet is lost.
[0106] Optionally, the device further includes a connection reconstruction module, configured to:
[0107] If it is determined that the initial message packet is lost before obtaining the session information, the communication establishment request is resent to the receiving end.
[0108] Optionally, the device further includes a connection closing module, configured to:
[0109] If the duration of not sending subsequent message packets is greater than the first duration threshold, and / or a notification that the receiving end does not exist is received from the message routing end, the communication connection with the receiving end is closed.
[0110] Optionally, the basic header information of the message packet includes a protocol number, a tag field, a communication object identifier and a peer process identifier, and the tag field includes a first field to mark whether it is retransmitted and a second field to mark whether it is the minimum sequence number; the message header of the message packet includes the connection establishment information, the session information and the message sequence number, and the connection establishment information includes a connection timestamp and a connection sequence number.
[0111] Optionally, the device further includes a migration module, configured to:
[0112] During the migration process of the receiving end from the initial process to the target process, the receiving end sends a target message packet to the initial process and the target process, wherein the initial process forwards the first part of the target message packet to the target process after receiving it, and the receiving end suspends message processing and confirmation reply during the migration process;
[0113] If it is confirmed that the migration process fails and the second part of the message packet in the target message packet is lost, the second part of the message packet is resent to the initial process.
[0114] The message communication device provided by the embodiments of the present disclosure can execute the message communication method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0115] Figure 11 This is a schematic diagram of the structure of another message communication device provided in some embodiments of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 11 As shown, the device is set at the receiving end within the distributed service and includes:
[0116] The receiving module 1101 is configured to receive a communication establishment request sent by a sending end, wherein the communication establishment request includes an initial message packet and connection establishment information, wherein the connection establishment information is created by the sending end before sending the initial message packet, and the sending end and the receiving end communicate via a preset protocol;
[0117] A return module 1102 is configured to create session information based on the connection establishment information and return the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information;
[0118] The retransmission receiving module 1103 is configured to receive the initial message packet retransmitted by the sending end based on the session information when the sending end determines that the initial message packet is lost.
[0119] Optionally, the device further includes a cleaning module, configured to:
[0120] If the duration of not receiving the subsequent message packet from the sending end is greater than the second duration threshold, sending a detection message to the sending end through the message routing end;
[0121] If a notification that the sending end does not exist is received from the message routing end, the remaining connection with the sending end is cleared.
[0122] Optionally, the device further includes a delay module, configured to:
[0123] If it is determined that there is a retransmission packet in the processed plurality of first message packets, the current communication connection is cleared at a preset time, wherein the preset time is greater than or equal to the sum of the connection time and the delay time of the current communication connection.
[0124] Optionally, the device further includes a residual package module, including:
[0125] A judging unit, configured to judge whether the second message packet is an initial network residual packet if no local communication connection exists when the second message packet is received;
[0126] a confirmation unit, configured to, if the second message packet is an initial network residual packet, send a confirmation request of the initial network residual packet to the sending end, so that the sending end confirms the initial network residual packet;
[0127] A processing unit is configured to determine, based on confirmation information returned by the sending end, that the initial network residual packet is a target network residual packet, and discard the target network residual packet.
[0128] Optionally, the judgment unit is used to:
[0129] If the reception time of the second message packet is after the corresponding target time, the second message packet is determined to be an initial network residual packet; otherwise, the second message packet is determined not to be an initial network residual packet, and the target time is the sum of the connection time and the delay time in the second message packet.
[0130] Optionally, the device further includes a migration processing module, including:
[0131] During the migration process of the receiving end from the initial process to the target process, suspending message processing and confirmation reply;
[0132] After the migration process is completed, the message processing and the confirmation reply are started.
[0133] The message communication device provided by the embodiments of the present disclosure can execute the message communication method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0134] An embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which implements the message communication method provided by any embodiment of the present disclosure when executed by a processor.
[0135] Figure 12 This is a schematic diagram of the structure of an electronic device provided in some embodiments of the present disclosure. Figure 12, which shows a schematic structural diagram of an electronic device 1200 suitable for implementing the embodiments of the present disclosure. The electronic device 1200 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 12 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0136] like Figure 12 As shown, the electronic device 1200 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage device 1208 into a random access memory (RAM) 1203. Various programs and data required for the operation of the electronic device 1200 are also stored in the RAM 1203. The processing device 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0137] Typically, the following devices may be connected to the I / O interface 1205: an input device 1206 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209. The communication device 1209 may allow the electronic device 1200 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 12 The electronic device 1200 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0138] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1209, or installed from the storage device 1208, or installed from the ROM 1202. When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the message communication method of the embodiment of the present disclosure are performed.
[0139] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0140] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0141] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0142] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: creates connection establishment information between the electronic device and the receiving end before sending the initial message packet, and sends a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate through a preset protocol; obtains the session information created by the receiving end based on the connection establishment information, and establishes a communication connection with the receiving end based on the session information; if it is determined that the initial message packet is lost, resends the initial message packet to the receiving end based on the session information.
[0143] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: receives a communication establishment request sent by a sending end, the communication establishment request includes an initial message packet and connection establishment information, the connection establishment information is created by the sending end before sending the initial message packet, and the sending end and the receiving end communicate through a preset protocol; creates session information based on the connection establishment information, and returns the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information; receives the initial message packet resent by the sending end based on the session information when it is determined that the initial message packet is lost.
[0144] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0146] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0147] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0148] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0149] It is understandable that before using the technical solutions disclosed in the embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0150] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0151] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0152] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A message communication method, characterized in that: Applied to the sender within the distributed service, including: Before sending an initial message packet, establishing connection establishment information with a receiving end, and sending a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate via a preset protocol; wherein the receiving end is located within the distributed service, the initial message packet is the first message packet sent by the sending end to the receiving end, and the connection establishment information is included in a message packet header of the message packet; Acquiring session information created by the receiving end based on the connection establishment information, and establishing a communication connection with the receiving end based on the session information; If it is determined that the initial message packet is lost, the initial message packet is resent to the receiving end based on the session information.
2. The method according to claim 1, characterized in that The method further comprises: If it is determined that the initial message packet is lost before obtaining the session information, the communication establishment request is resent to the receiving end.
3. The method according to claim 1, characterized in that The method further comprises: If the duration of not sending subsequent message packets is greater than the first duration threshold, and / or a notification that the receiving end does not exist is received from the message routing end, the communication connection with the receiving end is closed.
4. The method according to claim 1, wherein The basic header information of the message packet includes a protocol number, a tag field, a communication object identifier and a peer process identifier, wherein the tag field includes a first field indicating whether it is a retransmission and a second field indicating whether it is the smallest sequence number; the message header of the message packet includes the connection establishment information, the session information and the message sequence number, wherein the connection establishment information includes a connection timestamp and a connection sequence number.
5. The method according to claim 1, characterized in that The method further comprises: During the migration process of the receiving end from the initial process to the target process, the receiving end sends a target message packet to the initial process and the target process, wherein the initial process forwards the first part of the target message packet to the target process after receiving it, and the receiving end suspends message processing and confirmation reply during the migration process; If it is confirmed that the migration process fails and the second part of the message packet in the target message packet is lost, the second part of the message packet is resent to the initial process.
6. A message communication method, characterized in that: Applied to the receiving end within the distributed service, including: receiving a communication establishment request sent by a sending end, the communication establishment request including an initial message packet and connection establishment information, the connection establishment information being created by the sending end before sending the initial message packet, the sending end and the receiving end communicating via a preset protocol; wherein the sending end is located within the distributed service, the initial message packet is the first message packet sent by the sending end to the receiving end, and the connection establishment information is included in a message packet header of the message packet; Creating session information based on the connection establishment information, and returning the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information; The initial message packet is received, which is resent by the sending end based on the session information when the sending end determines that the initial message packet is lost.
7. The method according to claim 6, characterized in that The method further comprises: If the duration of not receiving the subsequent message packet from the sending end is greater than the second duration threshold, sending a detection message to the sending end through the message routing end; If a notification that the sending end does not exist is received from the message routing end, the remaining connection with the sending end is cleared.
8. The method according to claim 6, characterized in that The method further comprises: If it is determined that there is a retransmission packet in the processed plurality of first message packets, the current communication connection is cleared at a preset time, wherein the preset time is greater than or equal to the sum of the connection time and the delay time of the current communication connection.
9. The method according to claim 6, characterized in that The method further comprises: If no local communication connection exists when the second message packet is received, determining whether the second message packet is an initial network residual packet; If the second message packet is an initial network residual packet, sending a confirmation request of the initial network residual packet to the sending end, so that the sending end confirms the initial network residual packet; The initial network residual packet is determined to be a target network residual packet based on the confirmation information returned by the sending end, and the target network residual packet is discarded.
10. The method according to claim 9, characterized in that Determining whether the second message packet is an initial network residual packet includes: If the reception time of the second message packet is after the corresponding target time, the second message packet is determined to be an initial network residual packet; otherwise, the second message packet is determined not to be an initial network residual packet, and the target time is the sum of the connection time and the delay time in the second message packet.
11. The method according to claim 6, characterized in that The method further comprises: During the migration process of the receiving end from the initial process to the target process, suspending message processing and confirmation reply; After the migration process is completed, the message processing and the confirmation reply are started.
12. A message communication device, characterized in that: The sender set up within the distributed service includes: a sending module, configured to establish connection establishment information with a receiving end before sending an initial message packet, and send a communication establishment request to the receiving end, wherein the communication establishment request includes the initial message packet and the connection establishment information, and the sending end and the receiving end communicate via a preset protocol; wherein the receiving end is located within the distributed service, the initial message packet is the first message packet sent by the sending end to the receiving end, and the connection establishment information is included in a message packet header of the message packet; an establishing module, configured to obtain session information created by the receiving end based on the connection establishment information, and establish a communication connection with the receiving end based on the session information; A resending module is configured to resend the initial message packet to the receiving end based on the session information if it is determined that the initial message packet is lost.
13. A message communication device, characterized in that: The receiving end set up within the distributed service includes: a receiving module, configured to receive a communication establishment request sent by a sending end, the communication establishment request including an initial message packet and connection establishment information, the connection establishment information being created by the sending end before sending the initial message packet, the sending end and the receiving end communicating via a preset protocol; wherein the sending end is located within the distributed service, the initial message packet is the first message packet sent by the sending end to the receiving end, and the connection establishment information is included in a message packet header of the message packet; a return module, configured to create session information based on the connection establishment information, and return the session information to the sending end, so that the sending end establishes a communication connection with the receiving end based on the session information; The retransmission receiving module is configured to receive the initial message packet retransmitted by the sending end based on the session information when determining that the initial message packet is lost.
14. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the message communication method described in any one of claims 1-11.
15. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and the computer program is used to enable a computer to execute the message communication method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method for establishing connection and corresponding equipment
CN107995233A