A communication method, apparatus, readable storage medium, and computer program product

CN122802442APending Publication Date: 2026-09-22JIANGSU DAODA INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611307992.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

OHT控制涉及复杂的数据交互,因此数据并发量大,若通信接收端采用传统的同步阻塞方式处理业务,会严重占用并堵塞底层TCP(Transmission Control Protocol,传输控制协议)传输通道,导致后续数据传输产生巨大时延甚至通信中断

Benefits of technology

[0016]本发明通过单通道负责数据的读取与分发,利用异步线程池对数据进行处理,实现了通信层与业务层的解耦,从而充分发挥单通道的吞吐量,避免通道层面的队头阻塞;通过限流管理及触发限流时的持久化存储和延迟处理,既能够避免内存和CPU(CentralProcessing Unit,中央处理器)被冲垮,又能够避免业务数据的缺失;通过延迟处理前的数据去重和重新排序,能够避免对数据进行重复处理和乱序处理。由此,能够提高通信的效率和稳定性,既可避免系统资源耗尽,又可保障通信数据的完整性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122802442A_ABST
    Figure CN122802442A_ABST
Patent Text Reader

Abstract

The application provides a communication method, device, readable storage medium and computer program product, the method comprises the following steps: reading a data message, and identifying the service reply type to which the data message belongs; if it is an asynchronous reply, the receiving end directly returns an acknowledgement message through a single channel, and the service data corresponding to the data message is handed over to an asynchronous thread pool for processing; if it is a synchronous reply, the receiving end does not block the underlying communication of the single channel, the service data corresponding to the data message is handed over to the asynchronous thread pool for processing, and after the processing is completed, the service processing result is returned through the single channel; whether a preset flow limiting condition is triggered is judged in real time; if the preset flow limiting condition is triggered, the direct processing of the service data corresponding to the data message is suspended, and the to-be-processed data is stored persistently; when the preset flow limiting condition is removed, the to-be-processed data stored persistently is extracted, and after data deduplication and reordering, the to-be-processed data is handed over to the asynchronous thread pool for processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically to a communication method, apparatus, readable storage medium, and computer program product. Background Technology

[0002] In OHT (Overhead Hoist Transport) control systems, single-channel (single TCP connection) communication is typically used to achieve stable, reliable, and low-latency control. OHT control involves complex data interactions, resulting in high data concurrency. If the receiving end uses traditional synchronous blocking methods to process data, it will severely occupy and block the underlying TCP (Transmission Control Protocol) transmission channel, leading to significant delays or even communication interruptions in subsequent data transmission. Furthermore, during peak traffic periods, simply discarding packets as a rate-limiting method can cause the loss of important data and frequent retries by the sending end, further exacerbating system crashes; conversely, not discarding packets will exhaust thread pool resources. Summary of the Invention

[0003] To solve the above-mentioned technical problems, the present invention provides a communication method, apparatus, readable storage medium, and computer program product, which can improve the efficiency and stability of communication, avoid system resource exhaustion, and ensure the integrity of communication data.

[0004] The technical solution adopted in this invention is as follows:

[0005] A communication method is applied to a receiving end in a single-channel full-duplex communication environment. The communication method includes the following steps: reading data packets and identifying the service response type to which the data packets belong, wherein the service response type includes asynchronous response and synchronous response; if the service response type is asynchronous response, the receiving end directly returns an acknowledgment message through the single channel and hands over the service data corresponding to the data packet to an asynchronous thread pool for processing; if the service response type is synchronous response, the receiving end does not block the underlying communication of the single channel, hands over the service data corresponding to the data packet to the asynchronous thread pool for processing, and after processing is completed, returns the service processing result through the single channel; determining in real time whether a preset rate limiting condition is triggered; if the preset rate limiting condition is triggered, pausing the direct processing of the service data corresponding to the data packet and instead persistently storing the data to be processed; when the preset rate limiting condition is lifted, retrieving the persistently stored data to be processed, deduplicating and reordering the data, and then handing it over to the asynchronous thread pool for processing.

[0006] Based on the application layer header of the data packet, determine whether the data packet requires a synchronous or asynchronous response in order to identify the business response type to which the data packet belongs.

[0007] The single channel is a TCP channel. The receiving end directly returns an acknowledgment message through the single channel. Specifically, after the I / O (Input / Output) receiving thread of the TCP channel parses the data packet, it directly returns an ACK (Acknowledge character) message to the sending end through the TCP channel to indicate successful reception. After returning the ACK message, the I / O receiving thread of the TCP channel is immediately released.

[0008] After processing is completed, the business processing result is returned through the single channel. Specifically, after the asynchronous thread pool finishes processing, a callback logic or event-driven mechanism is triggered to wake up the TCP sending thread, which then sends the final business processing result to the sending end through the full-duplex link of the TCP channel.

[0009] The preset rate limiting condition is triggered under the following circumstances: the number of data packets received by the receiving end per unit time exceeds the preset threshold of the token bucket; or the task queue of the asynchronous thread pool is full.

[0010] The direct processing of the business data corresponding to the data packet is suspended, and the data to be processed is instead persistently stored. Specifically, a lightweight thread persists the data packet, along with its unique identifier and timestamp, to the local storage medium and returns a status code to the sending end to indicate that rate limiting has been triggered.

[0011] When the preset rate limiting condition is lifted, the data to be processed in persistent storage is extracted, deduplicated, and reordered before being handed over to the asynchronous thread pool for processing. Specifically, this includes: when the background monitoring thread determines that the preset rate limiting condition has been lifted, reading the data to be processed in batches from the local storage medium; performing a deduplication operation on the read data to be processed based on the unique identifier carried by the data packet to delete duplicate data packets generated due to timeout retransmission at the sending end; performing a sorting operation on the deduplicated data to be processed based on the timestamp recorded in the persistent storage of the data to be processed or the sequence number contained in each data packet to restore the timing consistency of each data packet in the business logic; and resubmitting the sorted data to be processed to the asynchronous thread pool to complete the delayed processing.

[0012] A communication device for performing the aforementioned communication method.

[0013] A non-transitory computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the aforementioned communication method.

[0014] A computer program product includes a computer program or computer-executable instructions, which, when executed by a processor, implement the communication method.

[0015] The beneficial effects of this invention are:

[0016] This invention uses a single channel for data reading and distribution, and an asynchronous thread pool for data processing, thus decoupling the communication layer from the business layer. This fully leverages the throughput of the single channel and avoids head-of-line blocking at the channel level. Through rate limiting management and persistent storage and delayed processing when rate limiting is triggered, it prevents memory and CPU (Central Processing Unit) from being overwhelmed and avoids the loss of business data. Data deduplication and reordering before delayed processing avoids duplicate and out-of-order processing. Therefore, it improves communication efficiency and stability, preventing system resource exhaustion and ensuring the integrity of communication data. Attached Figure Description

[0017] Figure 1 This is a flowchart of a communication method according to an embodiment of the present invention. Detailed Implementation

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

[0019] The communication method, apparatus, readable storage medium, and computer program product of the present invention can be applied to the receiving end of a single-channel full-duplex communication environment. The receiving end can be a device in an OHT control system, such as an OHTC (Overhead Hoist Transport Controller).

[0020] like Figure 1 As shown, the communication method of this embodiment includes the following steps:

[0021] S1 reads the data message and identifies the business response type to which the data message belongs. The business response type includes asynchronous response and synchronous response.

[0022] In one embodiment of the present invention, the data packet structure may include an application layer packet header and a message body. The application layer packet header may include a type field of a preset length, and different values ​​of the type field are used to indicate whether the data packet is a synchronous or asynchronous response. Therefore, based on the application layer packet header of the data packet, it can be determined whether the data packet requires a synchronous or asynchronous response, thereby identifying the business response type to which the data packet belongs.

[0023] S2, if the business response type is asynchronous, the receiving end directly returns an acknowledgment message through a single channel and hands over the business data corresponding to the data packet to the asynchronous thread pool for processing.

[0024] In one embodiment of the present invention, the single channel is a TCP channel.

[0025] If the response is asynchronous, after the I / O receiving thread of the TCP channel parses the data packet, it can directly return an ACK packet indicating successful reception to the sending end through the TCP channel synchronously. After returning the ACK packet, the I / O receiving thread of the TCP channel is immediately released, thus achieving thread-level isolation between business processing and network I / O.

[0026] S3. If the business response type is synchronous, the receiving end will not block the underlying communication of the single channel, but will hand over the business data corresponding to the data packet to the asynchronous thread pool for processing. After the processing is completed, the business processing result will be returned through the single channel.

[0027] In the case of a synchronous response, after the I / O receive thread of the TCP channel parses the data packet, it does not block the current TCP channel. Instead, it uses asynchronous processing, encapsulating the processing task and placing it into a specific asynchronous thread pool. Once the asynchronous thread pool has finished processing, it triggers callback logic or an event-driven mechanism to wake up the TCP send thread. The TCP send thread then sends the final business processing result to the sender through the full-duplex link of the TCP channel. This achieves synchronous response at the business level and non-blocking full-duplex asynchronous flow at the underlying TCP communication level.

[0028] S4 determines in real time whether the preset rate limiting conditions are triggered.

[0029] In one embodiment of the present invention, the preset rate limiting condition can be triggered under the following circumstances: the number of data packets received by the receiver within a unit time exceeds the preset threshold of the token bucket; or, the task queue of the asynchronous thread pool is full.

[0030] S5. If the preset rate limiting condition is triggered, the direct processing of the business data corresponding to the data packet will be suspended, and the data to be processed will be persistently stored instead.

[0031] For data packets that trigger the preset rate limiting conditions, they are neither discarded nor processed immediately. Instead, a lightweight thread persists the data packet, along with its unique identifier Message-ID and timestamp, to the local storage medium and returns a status code to the sending end to indicate that rate limiting has been triggered.

[0032] S6: When the preset rate limiting condition is lifted, the data to be processed in persistent storage is extracted, and after data deduplication and reordering, it is handed over to the asynchronous thread pool for processing.

[0033] If the number of data packets received by the background monitoring thread at the receiver within a unit of time is lower than the preset threshold of the token bucket, or if the task queue of the asynchronous thread pool is not fully loaded, the preset rate limiting condition is determined to be lifted. At this time, the data to be processed stored in batches can be read from the local storage medium.

[0034] Since the sender may initiate a retry due to not receiving a result during the rate limiting period, the receiver can first perform deduplication. Specifically, it can perform deduplication on the read data to be processed based on the unique identifier carried in the data packet, so as to delete duplicate data packets generated by the sender's timeout retransmission.

[0035] Then, based on the timestamps recorded during persistent storage or the sequence numbers contained in each data packet, the deduplicated data to be processed can be sorted to restore the temporal consistency of each data packet in the business logic.

[0036] Finally, the sorted data to be processed is resubmitted to the asynchronous thread pool to complete the delayed processing.

[0037] According to the communication method of this invention, a single channel is used for data reading and distribution, and an asynchronous thread pool is used for data processing. This decouples the communication layer from the business layer, thereby fully utilizing the throughput of the single channel and avoiding head-of-line blocking at the channel level. Through rate limiting management and persistent storage and delayed processing when rate limiting is triggered, both memory and CPU overload can be avoided, as well as the loss of business data. Data deduplication and reordering before delayed processing can prevent duplicate and out-of-order data processing. Therefore, the efficiency and stability of communication can be improved, avoiding system resource exhaustion and ensuring the integrity of communication data.

[0038] Based on the communication method described in the above embodiments, the present invention also proposes a communication device.

[0039] The communication device of this invention implements the communication method of any of the above embodiments of this invention. The specific implementation method can be referred to the above embodiments, and will not be repeated here.

[0040] The communication device according to embodiments of the present invention can improve the efficiency and stability of communication, avoid exhaustion of system resources, and ensure the integrity of communication data.

[0041] Based on the communication method described in the above embodiments, the present invention also proposes a non-transitory computer-readable storage medium.

[0042] The non-transitory computer-readable storage medium of the present invention stores a computer program thereon, which, when executed by a processor, can implement the communication method of any of the above embodiments of the present invention.

[0043] According to embodiments of the present invention, a non-transitory computer-readable storage medium, when a processor executes a computer program stored thereon, uses a single channel to handle data reading and distribution, and utilizes an asynchronous thread pool to process the data, thereby decoupling the communication layer from the business layer. This fully leverages the throughput of the single channel and avoids head-of-line congestion at the channel level. Through rate limiting management and persistent storage and delayed processing when rate limiting is triggered, both memory and CPU overload can be avoided, as well as the loss of business data. Data deduplication and reordering before delayed processing can prevent duplicate and out-of-order data processing. Therefore, communication efficiency and stability can be improved, both preventing system resource exhaustion and ensuring the integrity of communication data.

[0044] Based on the communication method described in the above embodiments, the present invention also proposes a computer program product.

[0045] The computer program product of this invention includes a computer program or computer-executable instructions, which, when executed by a processor, implement the communication method of any of the above embodiments.

[0046] According to the computer program product of the present invention, when the computer program or computer-executable instructions are executed by the processor, a single channel is used for data reading and distribution, and an asynchronous thread pool is used for data processing. This decouples the communication layer from the business layer, thereby fully utilizing the throughput of the single channel and avoiding head-of-line blocking at the channel level. Through rate limiting management and persistent storage and delayed processing when rate limiting is triggered, both memory and CPU overload can be avoided, as well as the loss of business data. Through data deduplication and reordering before delayed processing, duplicate and out-of-order processing of data can be avoided. Thus, the efficiency and stability of communication can be improved, both preventing system resource exhaustion and ensuring the integrity of communication data.

[0047] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. "A plurality of" means two or more, unless otherwise explicitly specified.

[0048] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0049] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "over," and "on top" of the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.

[0050] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0051] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0052] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0053] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0054] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0055] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0056] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A communication method, characterized in that, The communication method, applied to a single-channel full-duplex communication environment, includes the following steps: Read the data packet and identify the business response type to which the data packet belongs, wherein the business response type includes asynchronous response and synchronous response; If the business response type is asynchronous, the receiving end directly returns a confirmation message through a single channel and hands over the business data corresponding to the data packet to the asynchronous thread pool for processing; If the business response type is synchronous, the receiving end will not block the underlying communication of the single channel, but will hand over the business data corresponding to the data packet to the asynchronous thread pool for processing. After the processing is completed, the business processing result will be returned through the single channel. Real-time determination of whether preset rate limiting conditions are triggered; If the preset rate limiting condition is triggered, the direct processing of the business data corresponding to the data packet will be suspended, and the data to be processed will be persistently stored instead. When the preset rate limiting conditions are lifted, the data to be processed in persistent storage is extracted, deduplicated and reordered, and then handed over to the asynchronous thread pool for processing.

2. The communication method according to claim 1, characterized in that, Based on the application layer header of the data packet, determine whether the data packet requires a synchronous or asynchronous response in order to identify the business response type to which the data packet belongs.

3. The communication method according to claim 1, characterized in that, The single channel is a TCP channel, and the receiving end directly returns an acknowledgment message through the single channel, specifically including: After parsing the data packet, the I / O receiving thread of the TCP channel directly returns an ACK packet to the sending end through the TCP channel to indicate successful reception, and immediately releases the I / O receiving thread of the TCP channel after returning the ACK packet.

4. The communication method according to claim 3, characterized in that, After processing is complete, the business processing result is returned through the single channel, specifically including: After the asynchronous thread pool finishes processing, it triggers callback logic or an event-driven mechanism to wake up the TCP sending thread, which then sends the final business processing result to the sending end through the full-duplex link of the TCP channel.

5. The communication method according to claim 1, characterized in that, The preset rate limiting condition is triggered under the following circumstances: The number of data packets received by the receiving end per unit time exceeds the preset threshold of the token bucket; Alternatively, the task queue of the asynchronous thread pool may be full.

6. The communication method according to claim 1, characterized in that, Suspend direct processing of the business data corresponding to the data packet, and instead persistently store the data to be processed, specifically including: A lightweight thread persists the data packet, along with its unique identifier and timestamp, to local storage and returns a status code to the sender indicating that rate limiting has been triggered.

7. The communication method according to claim 6, characterized in that, When the preset rate limiting condition is lifted, the data to be processed in persistent storage is retrieved, deduplicated, and reordered before being handed over to the asynchronous thread pool for processing, specifically including: When the background monitoring thread determines that the preset rate limiting condition has been lifted, it reads the stored data to be processed from the local storage medium in batches. Based on the unique identifier carried in the data packet, a deduplication operation is performed on the read data to be processed to delete duplicate data packets generated due to timeout retransmission at the sending end. Based on the timestamp recorded during persistent storage of the data to be processed or the sequence number contained in each data packet, a sorting operation is performed on the deduplicated data to be processed in order to restore the temporal consistency of each data packet in business logic. The sorted data to be processed is resubmitted to the asynchronous thread pool to complete the delayed processing.

8. A communication device, characterized in that, Perform the communication method according to any one of claims 1-7.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the communication method according to any one of claims 1-7.

10. A computer program product, characterized in that, It includes a computer program or computer-executable instructions, which, when executed by a processor, implement the communication method according to any one of claims 1-7.