Multichannel data communication method based on RUDP (Remote User Datagram Protocol), electronic equipment and storage medium
By introducing a multi-channel data communication method into the RUDP single-threaded design and dynamically allocating business data, it solves the data transmission delay and throughput problems in high-concurrency scenarios, achieves efficient data processing and transmission, and is suitable for diverse network topologies.
Patent Information
- Application Number
- CN202510973608.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-09-30
AI Technical Summary
Under the single-threaded design of RUDP, when network data traffic surges in high-concurrency scenarios, data verification, confirmation packet generation, and retransmission management tasks occupy thread resources, causing network sending and receiving operations to be blocked, affecting the system's real-time response capability and data transmission delay.
A multi-channel data communication method is adopted. The sender and receiver create multiple sending channels and processing channels respectively. Each channel contains an RUDP queue. Data processing is coordinated through DPDK threads, and business data is dynamically allocated to avoid single-channel congestion. It supports network topologies with different device performance.
It achieves the goal of improving the system's data processing efficiency and network throughput while ensuring data transmission reliability, adapting to diverse network topologies, and enhancing system practicality.
Smart Images

Figure CN120729964A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer network communication technology, and in particular to a multi-channel data communication method, electronic device and storage medium based on RUDP. Background Art
[0002] In modern real-time network communications, such as online gaming, video conferencing, and IoT device interactions, which require high network connectivity, the UDP protocol is widely adopted due to its connectionless and low-overhead nature. However, the unreliability of communication caused by frequent issues such as packet loss and out-of-order transmissions has limited its application in critical business scenarios. To address this, RUDP (ReliableUDP) introduces mechanisms such as acknowledgment, retransmission, and flow control based on UDP to improve reliability while maintaining low latency.
[0003] Traditional RUDP implementations typically use a multi-threaded architecture, separating network transmission and reception from RUDP processing. However, this design suffers from problems such as high inter-thread synchronization overhead and frequent context switching. To reduce system complexity and minimize the performance loss caused by thread scheduling, existing technologies propose merging network transmission and reception threads with RUDP processing threads. However, this single-threaded design faces significant technical challenges in practical applications: when network data traffic surges, the data verification, acknowledgment (ACK) generation, retransmission management, and other processing tasks required by the RUDP protocol will occupy a large amount of thread resources, resulting in blocked network transmission and reception operations. Especially in high-concurrency scenarios, this blocking will seriously affect the system's real-time responsiveness, resulting in increased data transmission delays, decreased throughput, and other problems.
[0004] Therefore, a new method is urgently needed to efficiently coordinate network transmission and reception with RUDP processing in this single-threaded environment, so as to achieve high throughput and low latency characteristics of system operation while ensuring data transmission reliability. Summary of the Invention
[0005] Purpose of the invention: This application provides a multi-channel data communication method, electronic device and storage medium based on RUDP to solve the problems existing in the prior art.
[0006] Technical solution: The present invention provides a multi-channel data communication method based on RUDP. The participants of the method include a sending end and a receiving end of the communication connection. The method includes the following steps:
[0007] Step 1: The sender creates N sending channels and the receiver creates M processing channels;
[0008] Step 2: The sender adds identifiers to all original services to be sent in order, determines the sending channel based on the identifier information of the original services, places all original services on the corresponding sending channel, and performs the first service processing operation. After the operation is completed, the service messages corresponding to all original services are obtained and sent to the receiving end;
[0009] Step 3: The receiving end receives all business messages, determines the processing channel based on the identification information in the business message, places all business messages on the corresponding processing channel to perform the second business processing operation, and obtains the business results corresponding to all business messages after the operation is completed and returns them to the sending end.
[0010] As an improvement of the present invention, the specific process of step 1 is as follows:
[0011] The sending end creates a first sending channel to an Nth sending channel; the receiving end creates a first processing channel to an Mth processing channel; each sending channel and each processing channel thread contains several RUDP queues; where N is equal to M or not equal to M;
[0012] The sender also creates a DPDK TX thread and a DPDK RX thread. The DPDK TX thread on the sender is used to traverse the RUDP queues of all sending channels to collect and send all business messages. The DPDK RX thread on the sender is used to receive business results.
[0013] The receiving end also creates the receiving end's DPDK TX thread and DPDK RX thread. The receiving end's DPDK TX thread is used to traverse the RUDP queues of all processing channels to collect all business results and send them. The receiving end's DPDK RX thread is used to receive business messages sent by the sending end.
[0014] As an improvement of the present invention, the specific process of step 2 is as follows:
[0015] Step 2-1: The sending end adds identifiers to n original services to be sent in order to obtain the first original service to the nth original service;
[0016] Step 2-2: Determine the sending channel of all original services based on the identification information of the original services;
[0017] Step 2-3: After all original services are placed in their corresponding sending channels, a first service processing operation is performed. After the operation is completed, a first processing result corresponding to each original service is obtained. Each first processing result also carries the identifier of the original service. Service messages are generated for the first processing results. Each service message includes the first processing result and the identifier of its original service. After the first service processing operation, first to nth service messages are obtained, including the first to nth first processing results.
[0018] Steps 2-4: The DPDK TX thread on the sending end traverses all sending channels, collects all business messages, and sends them to the DPDK RX thread on the receiving end in sequence.
[0019] As an improvement of the present invention, the specific process of step 2-2 is as follows:
[0020] Compare the number n of all original services and the number N of sending channels:
[0021] If the number of original services n is less than or equal to N, the original first service to the nth service are sequentially placed on the first transmission channel to the nth transmission channel;
[0022] If the number of original services n is greater than N, first, the first original service to the Nth original service are sequentially placed on the first sending channel to the Nth sending channel;
[0023] Next, for the xth original service among the N+1th original service to the nth original service (N+1≤x≤n), a modulo operation is performed on the identifier x: i=x mod N; wherein 1≤i≤N;
[0024] According to the instruction of i, the corresponding i-th sending channel is found as the sending channel of the x-th original business; the x-th original business is placed on the i-th sending channel.
[0025] As an improvement of the present invention, in step 2-3, an original service is placed in an RUDP queue of the corresponding sending channel to perform a first service processing operation, and the corresponding first processing result obtained is temporarily stored in the original RUDP queue.
[0026] As an improvement of the present invention, the specific process of step 3 is as follows:
[0027] Step 3-1: The receiving end receives all service messages through the DPDK RX thread of the receiving end, and parses to obtain the first service message to the nth service message;
[0028] Step 3-2: Determine the processing channel for all business messages based on the identification information in the business messages;
[0029] Step 3-3: After all business messages are placed in their corresponding processing channels, a second business processing operation is performed. After the operation is completed, a secondary processing result corresponding to each business message is obtained. Each secondary processing result also carries the identifier of the original business. Business results are generated for the secondary processing results: each business result includes the secondary processing result and the identifier of its original business. After the second business processing operation, the first to nth business results are obtained, including the first to nth secondary processing results.
[0030] Steps 3-4: The DPDK TX thread on the receiving end traverses all processing channels, collects all business results, and sends them to the DPDK RX thread on the sending end in sequence.
[0031] As an improvement of the present invention, the specific process of step 3-2 is as follows:
[0032] Compare the number of all business messages n and the number of processing channels M:
[0033] If the number of business messages n is less than or equal to M, the first business message to the nth business message are placed in the first processing channel to the nth processing channel in order;
[0034] If the number of service messages n is greater than M, first, the first service message to the Nth service message are placed in the first processing channel to the Mth processing channel in order;
[0035] Next, for the yth service message among the M+1th service message to the nth service message (M+1≤y≤n), a modulo operation is performed on the identifier y: j=y mod M; wherein 1≤j≤M;
[0036] According to j's instruction, find the corresponding j-th processing channel as the processing channel for the y-th business message; and put the y-th business message on the j-th processing channel.
[0037] As an improvement of the present invention, in step 3-3, a service message is placed in an RUDP queue of the corresponding processing channel to perform a second service processing operation, and the corresponding secondary processing result obtained is temporarily stored in the original RUDP queue.
[0038] As an improvement of the present invention, an electronic device is also provided, comprising
[0039] a memory for storing a set of instructions; and
[0040] At least one processor is configured to execute the set of instructions to enable the electronic device to perform the method as described above.
[0041] As an improvement of the present invention, a non-transitory computer-readable storage medium is further provided. The non-transitory computer-readable storage medium stores a set of computer instructions. When the set of instructions is executed, the computer is configured to execute the method described above.
[0042] Beneficial effects:
[0043] 1. Different business data is processed through independent RUDP queues in independent sending channels and processing channels, avoiding interference between services and ensuring that services can be processed and transmitted with more stable bandwidth and lower latency;
[0044] 2. The multi-channel design can dynamically allocate business data according to the real-time load conditions of each channel, effectively avoiding the congestion problem of a single channel, while making full use of the processing power of the computer, improving the data processing efficiency and utilization rate of the system, and significantly improving the overall network throughput; at the same time, the solution of dynamically adjusting the number of channels in this application can complete the data processing process even when the performance of the equipment at the sending and receiving ends is unequal, which is more practical in actual applications.
[0045] 3. The design with an unequal number of senders and receivers supports diverse network topologies. It is suitable for one-to-many and many-to-one broadcast and aggregation scenarios, as well as complex many-to-many communication needs, effectively improving the practicality of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0047] Figure 1 A schematic diagram of the data flow direction of the communication method of this application;
[0048] Figure 2 A flowchart of the communication method of this application;
[0049] Figure 3 This is a schematic diagram of the structure of the communication ends of this application. DETAILED DESCRIPTION
[0050] To make the objectives, technical solutions, and advantages of this application more clear, this application will be further described in detail below with reference to the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0051] The present invention provides a multi-channel data communication method based on RUDP, such as Figure 1 As shown, the participants of the method include the sending end and the receiving end of the communication connection. Figure 2 As shown, the method includes the following steps:
[0052] Step 1: The sender creates N sending channels and the receiver creates M processing channels;
[0053] Specifically, if Figure 3As shown, the sending end creates N sending channels with channel identifiers, for example: the first sending channel ... the Nth sending channel; the receiving end creates M processing channels with channel identifiers, for example: the first processing channel ... the Mth processing channel; as shown Figure 3 As shown in FIG, each sending channel and each processing channel thread contains several RUDP queues, where N can be equal to M or not.
[0054] The RUDP queue of the sending channel is used to temporarily store and process the original business to be sent by the sender. More specifically, an original business and the business message obtained after the original business is first processed are temporarily stored in an RUDP queue of the sending channel. Correspondingly, the RUDP queue of the processing channel is used to temporarily store and process the business messages to be sent by the receiving end. More specifically, a business message and the business result after the business message is secondarily processed are temporarily stored in an RUDP queue of the processing channel.
[0055] The sender also creates a DPDK (Data Plane Development Kit) TX thread and a DPDK RX thread. The DPDK TX thread traverses all send channels, more specifically, the RUDP queues of the send channels, to collect and send all service messages. The DPDK RX thread receives data, more specifically, the service results obtained after processing by the receiver. Correspondingly, the receiver also creates a DPDK TX thread and a DPDK RX thread. The DPDK TX thread traverses all processing channels, more specifically, the RUDP queues of the processing channels, to collect and send all service results. The DPDK RX thread receives service messages sent by the sender.
[0056] Step 2: The sender adds identifiers to all original services to be sent in order, determines the sending channel based on the identifier information of the original services, places all original services on the corresponding sending channel, and performs the first service processing operation. After the operation is completed, the service messages corresponding to all original services are obtained and sent to the receiving end;
[0057] Specifically:
[0058] Step 2-1: The sending end adds identifiers to n original services to be sent in order (for example, the time order of service processing or the time order of service generation), and obtains the first original service to the nth original service;
[0059] Step 2-2: Determine the sending channel of all original services based on the identification information of the original services:
[0060] Compare the number n of all original services and the number N of sending channels:
[0061] If the number of original services n is less than or equal to N, the original first service to the nth service are sequentially placed on the first transmission channel to the nth transmission channel;
[0062] If the number of original services n is greater than N, first, the first original service to the Nth original service are sequentially placed on the first sending channel to the Nth sending channel;
[0063] Next, for the xth original service among the N+1th original service to the nth original service (N+1≤x≤n), a modulo operation is performed on the identifier x: i=x mod N; wherein 1≤i≤N;
[0064] Based on the instruction of i, find the corresponding i-th sending channel and use it as the sending channel for the x-th original service. Place the x-th original service on the i-th sending channel. Repeat this step for the N+1-th original service through the n-th original service, until the n-th original service is placed on the corresponding sending channel. Note that each original service should be placed in one RUDP queue for the corresponding sending channel.
[0065] Step 2-3: After all original services are placed in their corresponding transmission channels, the first service processing operation is performed. More specifically, the first service processing operation is performed on the data related to the first to nth original services in the RUDP queue of the corresponding transmission channel. After the operation is completed, the first processing result corresponding to each original service is obtained and temporarily stored in the RUDP queue. Each first processing result can also be accompanied by the original service identifier. The first service processing operation includes format processing, encryption and decryption operations, service verification, retransmission management, etc.
[0066] Generate a service message based on the initial processing result: Each service message includes the initial processing result and the identifier of its original service, for example, the first through nth initial processing results. Therefore, after the first service processing operation, the first through nth service messages containing the first through nth initial processing results are obtained.
[0067] Steps 2-4: The DPDK TX thread on the sending end traverses all sending channels, more specifically, all RUDP queues of all sending channels, collects all business messages, and sends them to the DPDK RX thread on the receiving end in sequence.
[0068] Step 3: The receiving end receives all business messages, determines the processing channel based on the identification information in the business message, places all business messages on the corresponding processing channel to perform the second business processing operation, and obtains the business results corresponding to all business messages after the operation is completed and returns them to the sending end.
[0069] Specifically:
[0070] Step 3-1: The receiving end receives all service messages through the DPDK RX thread of the receiving end, and parses to obtain the first service message to the nth service message;
[0071] Step 3-2: Determine the processing channel for all business messages based on the identification information in the business message:
[0072] Compare the number of all business messages n and the number of processing channels M:
[0073] If the number of business messages n is less than or equal to M, the first business message to the nth business message are placed in the first processing channel to the nth processing channel in order;
[0074] If the number of service messages n is greater than M, first, the first service message to the Nth service message are placed in the first processing channel to the Mth processing channel in order;
[0075] Next, for the yth service message among the M+1th service message to the nth service message (M+1≤y≤n), a modulo operation is performed on the identifier y: j=y mod M; wherein 1≤j≤M;
[0076] Based on j's instructions, find the corresponding jth processing channel and use it as the processing channel for the yth service message. Place the yth service message on the jth processing channel. Repeat this step for service messages (M+1) through (n) until the nth service message is placed on the corresponding processing channel. Note that each service message should be placed on one RUDP queue for the corresponding processing channel.
[0077] Step 3-3: After all service messages are placed in their corresponding processing channels, the second service processing operation is performed. More specifically, the second service processing operation is performed on the data related to the first through nth service messages in the RUDP queue of the corresponding processing channel. After the operation is completed, the corresponding secondary processing results for each service message are obtained and temporarily stored in the RUDP queue. Each secondary processing result can also be accompanied by the identifier of its service message, that is, the identifier of the original service. The second service processing operation can also include encryption and decryption operations, format processing, service verification, retransmission management, etc.
[0078] Generate a business result based on the secondary processing result: Each business result includes the secondary processing result and the identifier of its original business, for example, the first through nth secondary processing results. Therefore, after the second business processing operation, the first through nth business results are obtained, including the first through nth secondary processing results.
[0079] Step 3-4: The DPDK TX thread on the receiving end traverses all processing channels, more specifically, all RUDP queues of all processing channels, collects all business results, and sends them to the DPDK RX thread on the sending end in sequence.
[0080] Furthermore, both the sending and receiving ends can dynamically adjust their respective channel thread ratios according to the business type and machine performance, thereby ensuring the rational allocation and application of computer resources.
[0081] Typically, a service consists of a proxy server (sender) and a service server (receiver). The sender is responsible for sending and receiving data, while the receiver handles the business logic. Therefore, the sender's performance does not require high configuration, and a small number of RUDP-based sending channels, such as two, can be created. The receiver handles the business and has higher performance requirements, so a large number of RUDP-based processing channels, such as eight, can be created. Data arrives at the sender first, which then selects a less-loaded sending channel to forward the data to the receiver. After processing, the receiver returns the data via the processing channel.
[0082] Furthermore, when one receiving end corresponds to multiple sending ends, according to the solution of this application, it is only necessary to create more channels according to different services to process business data, without concentrating all data processing in the network thread, thereby ensuring the smoothness of data transmission in the network thread.
[0083] The embodiment of the present application further includes an electronic device. The electronic device may include a memory for storing a set of instructions; and at least one processor configured to execute the set of instructions so that the electronic device performs the above-mentioned RUDP-based multi-channel data communication method.
[0084] An embodiment of the present application also includes a non-transitory computer-readable storage medium, which stores a set of computer instructions, and the set of instructions is used to enable the computer to execute the above-mentioned RUDP-based multi-channel data communication method when executed.
[0085] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0086] It can be seen that the multi-channel data communication method based on RUDP proposed in the present invention has wide applicability, can be effectively implemented in software and hardware, dynamically allocates business data according to the real-time load conditions of each channel, effectively avoids the problem of single-channel congestion, and makes full use of the processing power of the computer, improves the data processing efficiency and utilization rate of the system, and significantly improves the overall network throughput; at the same time, the solution of dynamically adjusting the number of channels in this application can complete the data processing process even when the performance of the devices at the sending and receiving ends are not equal, and is more practical in actual applications.
Claims
1. A multi-channel data communication method based on RUDP, wherein the participants of the method include a sending end and a receiving end of a communication connection, characterized in that: The method comprises the following steps: Step 1: The sender creates N sending channels and the receiver creates M processing channels; Step 2: The sender adds identifiers to all original services to be sent in order, determines the sending channel based on the identifier information of the original services, places all original services on the corresponding sending channel, and performs the first service processing operation. After the operation is completed, the service messages corresponding to all original services are obtained and sent to the receiving end; Step 3: The receiving end receives all business messages, determines the processing channel based on the identification information in the business message, places all business messages on the corresponding processing channel to perform the second business processing operation, and obtains the business results corresponding to all business messages after the operation is completed and returns them to the sending end.
2. The multi-channel data communication method based on RUDP according to claim 1, characterized in that: The specific process of step 1 is: The sending end creates a first sending channel to an Nth sending channel; the receiving end creates a first processing channel to an Mth processing channel; each sending channel and each processing channel thread contains several RUDP queues; where N is equal to M or not equal to M; The sender also creates a DPDK TX thread and a DPDK RX thread. The DPDK TX thread on the sender is used to traverse the RUDP queues of all sending channels to collect and send all business messages. The DPDK RX thread on the sender is used to receive business results. The receiving end also creates the receiving end's DPDK TX thread and DPDK RX thread. The receiving end's DPDK TX thread is used to traverse the RUDP queues of all processing channels to collect all business results and send them. The receiving end's DPDK RX thread is used to receive business messages sent by the sending end.
3. The multi-channel data communication method based on RUDP according to claim 2, characterized in that: The specific process of step 2 is: Step 2-1: The sending end adds identifiers to n original services to be sent in order to obtain the first original service to the nth original service; Step 2-2: Determine the sending channel of all original services based on the identification information of the original services; Step 2-3: After all original services are placed in their corresponding sending channels, a first service processing operation is performed. After the operation is completed, a first processing result corresponding to each original service is obtained. Each first processing result also carries the identifier of the original service. Service messages are generated for the first processing results. Each service message includes the first processing result and the identifier of its original service. After the first service processing operation, first to nth service messages are obtained, including the first to nth first processing results. Steps 2-4: The DPDK TX thread on the sending end traverses all sending channels, collects all business messages, and sends them to the DPDK RX thread on the receiving end in sequence.
4. The multi-channel data communication method based on RUDP according to claim 3, characterized in that: The specific process of step 2-2 is: Compare the number n of all original services and the number N of sending channels: If the number of original services n is less than or equal to N, the original first service to the nth service are sequentially placed on the first transmission channel to the nth transmission channel; If the number of original services n is greater than N, first, the first original service to the Nth original service are sequentially placed on the first sending channel to the Nth sending channel; Next, for the xth original service among the N+1th original service to the nth original service (N+1≤x≤n), a modulo operation is performed on the identifier x: i=x mod N; wherein 1≤i≤N; According to the instruction of i, find the corresponding i-th sending channel as the sending channel of the x-th original service; Put the xth original business onto the ith sending channel.
5. The multi-channel data communication method based on RUDP according to claim 3, characterized in that: In step 2-3, an original service is placed in an RUDP queue of the corresponding sending channel to perform a first service processing operation, and the corresponding first processing result obtained is temporarily stored in the original RUDP queue.
6. The multi-channel data communication method based on RUDP according to claim 3, characterized in that: The specific process of step 3 is: Step 3-1: The receiving end receives all service messages through the DPDK RX thread of the receiving end, and parses to obtain the first service message to the nth service message; Step 3-2: Determine the processing channel for all business messages based on the identification information in the business messages; Step 3-3: After all business messages are placed in their corresponding processing channels, the second business processing operation is executed. After the operation is completed, the secondary processing result corresponding to each business message is obtained. Each secondary processing result also carries the identifier of the original business; Generate business results based on the secondary processing results: each business result includes the secondary processing result and the identifier of its original business; After the second business processing operation, the first business result to the nth business result including the first secondary processing result to the nth secondary processing result are obtained; Steps 3-4: The DPDK TX thread on the receiving end traverses all processing channels, collects all business results, and sends them to the DPDK RX thread on the sending end in sequence.
7. The multi-channel data communication method based on RUDP according to claim 6, characterized in that: The specific process of step 3-2 is as follows: Compare the number of all business messages n and the number of processing channels M: If the number of business messages n is less than or equal to M, the first business message to the nth business message are placed in the first processing channel to the nth processing channel in order; If the number of service messages n is greater than M, first, the first service message to the Nth service message are placed in the first processing channel to the Mth processing channel in order; Next, for the yth service message among the M+1th service message to the nth service message (M+1≤y≤n), a modulo operation is performed on the identifier y: j=y mod M; wherein 1≤j≤M; According to j's instruction, find the corresponding j-th processing channel as the processing channel for the y-th business message; and put the y-th business message on the j-th processing channel.
8. The multi-channel data communication method based on RUDP according to claim 6, characterized in that: In step 3-3, a service message is placed in an RUDP queue of a corresponding processing channel to perform a second service processing operation, and the corresponding secondary processing result obtained is temporarily stored in the original RUDP queue.
9. An electronic device, characterized in that: include a memory for storing a set of instructions; and At least one processor is configured to execute the set of instructions so that the electronic device performs the method according to any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores a set of instructions for a computer, which, when executed, causes the computer to perform the method according to any one of claims 1 to 8.