Order-preserving forwarding methods and related equipment for multi-core processing of elephant streams

CN121151339BActive Publication Date: 2026-08-14SHENZHEN AOWEI LINGXIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

但ECMP是基于哈希选路,会导致同一条大象流的数据包被哈希到相同的CPU内核处理,当一条大象流长时间占用某个CPU内核时,会导致多核负载不均衡问题

Benefits of technology

[0016]有益效果:本发明提供了一种多核处理大象流的保序转发方法及相关设备,本发明技术方案网络接口收到大象流后,会将每条报文的报文描述信息中的保序标记置为有效,之后再将每条报文描述信息按照序列编号递增轮询写入多个输入缓存队列;多核处理器的每个CPU内核再通过独占绑定关系从多个输入缓存队列中获取报文描述信息并进行并行处理,并行处理完之后再将报文描述信息按同序列编号强制写入多个输出缓存队列;最后在轮询输出缓存队列并基于保序标记进行保序或非保序输出处理。本发明大象流保序转发方法,能够充分利用多核处理器的并行处理能力,且不增加额外的重排序缓存资源,确保大象流报文的有序发送,提高网络资源利用率和数据传输效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121151339B_ABST
    Figure CN121151339B_ABST
Patent Text Reader

Abstract

This invention provides a method and related equipment for order-preserving forwarding of elephant streams using multi-core processing. After receiving the elephant stream, the network interface of this invention sets the order-preserving flag in the message description information of each message to valid. Then, it sequentially writes the message description information of each message into multiple input buffer queues according to the sequence number. Each CPU core of the multi-core processor then retrieves the message description information from the multiple input buffer queues through an exclusive binding relationship and processes it in parallel. After parallel processing, the message description information is forcibly written into multiple output buffer queues according to the same sequence number. Finally, the output buffer queues are polled, and order-preserving or non-order-preserving output processing is performed based on the order-preserving flag. This invention's order-preserving forwarding method for elephant streams can fully utilize the parallel processing capabilities of multi-core processors without adding additional reordering buffer resources, ensuring the orderly transmission of elephant stream messages and improving network resource utilization and data transmission efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication technology, and in particular to a method and related equipment for preserving the order of large streams in multi-core processing. Background Technology

[0002] With the development of cloud computing and big data services, the proportion of long-duration, high-bandwidth "elephant streams" within data centers and backbone networks is increasing. If these elephant streams become out of order, it will lead to receiver buffer bloat, decreased throughput, and even application-layer retransmissions, severely impacting transmission efficiency and user experience.

[0003] Existing technologies typically allocate packet sequence numbers sequentially within the same flow upon receiving messages and employ ECMP (Equal-Cost Multi-Path) for load balancing, enabling multi-core parallel processing. After multi-core processing is complete, out-of-order reordering is used to restore the message order, thus achieving ordered transmission. However, ECMP is based on hash-based routing, which can cause packets from the same large flow to be hashed to the same CPU core for processing. When a large flow occupies a particular CPU core for an extended period, it can lead to multi-core load imbalance. Furthermore, out-of-order reordering increases the reordering cache, incurring additional resource overhead.

[0004] Therefore, when leveraging the advantages of multi-core parallel processing to handle large-scale data transmission, effectively ensuring the order of packets and improving network connection performance and utilization has become an important direction that network processor design and network communication technology need to continuously focus on and improve. Summary of the Invention

[0005] This invention provides a method and related equipment for order-preserving forwarding of elephant streams in multi-core processing. The main purpose of this invention is to solve the technical problems mentioned in the background art of the prior art.

[0006] The first aspect of this invention provides a method for order-preserving forwarding of elephant streams in multi-core processing, comprising: Construct an order-preserving processing system, which includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor, wherein each CPU core of the multi-core CPU processor is exclusively bound to a pair of input buffer queues and output buffer queues with the same sequence number; Each input packet received by the network interface is identified. If the input packet is an elephant stream packet, the order preservation flag in the packet description information of the input packet is set to valid. The message description information of each input message is written into multiple input buffer queues in a round-robin fashion according to the sequence number in ascending order by a preset input scheduler. Each CPU core obtains the message description information from its own dedicated input buffer queue and processes the message description information in parallel. After parallel processing is completed, the description information of each message is forcibly written into the output buffer queue with the same sequence number as its respective input buffer queue; For multiple output buffer queues, they are polled in ascending order of sequence number, and based on the message type corresponding to the message description information at the head of the queue, a preset order-preserving output scheduler or non-order-preserving output scheduler is loaded as needed to process the message description information for output.

[0007] In an optional embodiment of the first aspect of the present invention, the scheduling rule of the order-preserving output scheduler is as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then wait; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

[0008] In an optional embodiment of the first aspect of the present invention, the scheduling rule of the non-order-preserving output scheduler is as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then skip the current output buffer queue and jump to the next output buffer queue; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

[0009] In an optional embodiment of the first aspect of the present invention, the step of polling the multiple output buffer queues in ascending order of sequence number, and selecting a preset ordered output scheduler or a non-ordered output scheduler to output the message description information as needed based on the message type corresponding to the message description information at the head of the queue, includes: For multiple output buffer queues, they are polled in ascending order of sequence number; For each of the output buffer queues, obtain the message description information at the head of the output buffer queue; The message description information at the head of the queue is parsed to obtain the message type corresponding to the message description information at the head of the queue; If the message description information at the head of the queue corresponds to an ordered message, then the ordered output scheduler will output the message description information at the head of the queue. If the message description information at the head of the queue corresponds to a non-order-preserving message, then the message description information at the head of the queue is output and processed by the non-order-preserving output scheduler.

[0010] In an optional embodiment of the first aspect of the present invention, parsing the message description information of the queue head to obtain the message type corresponding to the message description information of the queue head includes: The message description information at the head of the queue is parsed to obtain the order preservation flag in the message description information at the head of the queue. If the order preservation flag is valid, then the message description information at the head of the queue is determined to correspond to an order preservation message; If the order preservation flag is invalid, then the message description information at the head of the queue is determined to correspond to a non-order preservation message.

[0011] In an optional embodiment of the first aspect of the present invention, after the parallel processing is completed, forcibly writing each message description information into the output buffer queue with the same sequence number as its respective input buffer queue includes: After parallel processing is completed, for each message description information, regardless of whether the message status corresponding to the message description information is discarded, the message description information is written into the output buffer queue with the same sequence number.

[0012] In an optional embodiment of the first aspect of the invention, the number of input buffer queues and the number of output buffer queues are both configured to be the same as the number of cores of the CPU processor.

[0013] A second aspect of the present invention provides an order-preserving forwarding device for multi-core processing of elephant streams, the order-preserving forwarding device for multi-core processing of elephant streams comprising: The order-preserving processing system includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor, wherein each CPU core of the multi-core CPU processor is exclusively bound to a pair of input buffer queues and output buffer queues with the same sequence number; The message recognition module is used to identify each input message received by the network interface. If the input message is an elephant stream message, the order preservation flag in the message description information of the input message is set to valid. The input queue writing module is used to write the message description information of each input message into multiple input buffer queues in a round-robin fashion according to the sequence number in ascending order through a preset input scheduler. The parallel processing module is used to obtain the message description information from the input buffer queue that is exclusively bound to each of the CPU cores, and to read the corresponding input message based on the message description information for parallel processing; The output queue writing module is used to force each message description information to be written into the output buffer queue with the same sequence number as its respective input buffer queue after parallel processing is completed; The output scheduling module is used to poll multiple output buffer queues in ascending order of sequence number, and select a preset order-preserving output scheduler or non-order-preserving output scheduler to process the output of the message description information based on the message type corresponding to the message description information at the head of the queue.

[0014] A third aspect of the present invention provides a network communication device, the network communication device comprising: a memory and at least one processor, the memory storing instructions, and the memory and the at least one processor being interconnected via a line; The at least one processor invokes the instructions in the memory to cause the network communication device to execute the order-preserving forwarding method for multi-core processing elephant streams as described in any one of the first aspects of the present invention.

[0015] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the order-preserving forwarding method for multi-core processing elephant streams as described in any one of the first aspects of the present invention.

[0016] Beneficial Effects: This invention provides a method and related equipment for order-preserving forwarding of elephant streams using multi-core processing. After receiving the elephant stream, the network interface of this invention sets the order-preserving flag in the message description information of each message to valid. Then, it sequentially writes the message description information of each message into multiple input buffer queues according to the sequence number. Each CPU core of the multi-core processor then obtains the message description information from the multiple input buffer queues through exclusive binding and processes it in parallel. After parallel processing, the message description information is forcibly written into multiple output buffer queues according to the same sequence number. Finally, the output buffer queues are polled, and order-preserving or non-order-preserving output processing is performed based on the order-preserving flag. This invention's order-preserving forwarding method for elephant streams can fully utilize the parallel processing capabilities of multi-core processors without adding additional reordering buffer resources, ensuring the orderly transmission of elephant stream messages and improving network resource utilization and data transmission efficiency. Attached Figure Description

[0017] Figure 1 This is a schematic diagram illustrating one embodiment of the main steps of a multi-core processing elephant stream order-preserving forwarding method according to the present invention; Figure 2 This is a schematic diagram of an embodiment of the order-preserving processing system of the present invention; Figure 3 This is a schematic diagram of an embodiment of a multi-core processing elephant stream order-preserving forwarding device of the present invention; Figure 4 This is a schematic diagram of an embodiment of a network communication device according to the present invention. Detailed Implementation

[0018] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0019] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 The first aspect of this invention provides a method for order-preserving forwarding of elephant streams in multi-core processing, comprising: S100, Construct an order-preserving processing system, see [link / reference] Figure 2The order-preserving processing system of the present invention includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor. Each CPU core of the multi-core CPU processor exclusively binds to a pair of input buffer queues and output buffer queues with the same sequence number. In this invention, the number of input buffer queues and the number of output buffer queues can be set based on the number of cores of the multi-core CPU processor to fully utilize the parallel processing performance of the multi-core CPU processor. For example, the number of input buffer queues and the number of output buffer queues can be configured. To match the number of cores in the CPU processor, for example, if the multi-core CPU processor uses an 8-core processor, there are 8 input message buffer queues and 8 output message buffer queues. The sequence numbers of the multiple input buffer queues can be RX0~RX7, and the sequence numbers of the multiple output message buffer queues can be TX0~TX7. Of course, the starting numbers of the sequence numbers of the multiple input buffer queues and the multiple output message buffer queues can be arbitrarily chosen, as long as it is ensured that the sequence numbers of the multiple input buffer queues and the multiple output message buffer queues correspond one-to-one from small to large.

[0020] S200. Each input packet received by the network interface is identified. If the input packet is an elephant stream packet, the order preservation flag in the packet description information of the input packet is set to valid. In this invention, after each input packet is received by the network interface, a packet parser performs flow attribute identification on the input packet. One implementation of the flow attribute identification in this invention can be based on the amount of data carried by the input packet (which can be obtained from the packet description information carried by the input packet). For example, if the quantity of the input packet is above MB, then the input packet is determined to be an elephant stream packet; otherwise, it is determined not to be an elephant stream packet. Another implementation can also be... The message description information of the input message directly carries a flow attribute marker. Whether it is an elephant flow message can be determined directly by reading the flow attribute marker. In an exemplary embodiment of the present invention, the key fields carried in the message description information may include: a memory pointer (pointing to the starting address of the message data in memory); message length (the effective length of the data); order preservation marker; flow identifier; processing mode; processing status; and queue pointer, etc. (obtained after writing to the input buffer queue and used to link to the input / output buffer queue). When the input message is not an elephant flow message, the present invention may not trigger the message polling and writing mechanism, for example, it can still be processed based on the traditional ECMP hash routing.

[0021] In other embodiments of the present invention, if the message description information of the input message does not contain an order preservation flag, then when step S200 identifies the input message as an elephant flow message, an order preservation flag field can be added to the end of the message description information of the input message and the order preservation flag field can be set to valid. For the input message as a non-elephant flow message, the message description information of the non-elephant flow message may not carry an order preservation flag or may carry an order preservation flag but be set to invalid.

[0022] S300: The message description information of each input message is written into multiple input buffer queues in a round-robin fashion according to the sequence number, using a preset input scheduler. In this invention, when scheduling the message description information with the order-preserving flag, the input scheduler starts from the queue with the smallest sequence number among the multiple input buffer queues and writes the message description information of each input message into the corresponding input buffer queue in a round-robin fashion according to the queue number, so that the input messages that need to be forwarded in order form a fixed order in the multiple input buffer queues, ensuring that the input messages of the same elephant stream are assigned to different input buffer queues, and utilizing the multi-core of the CPU processor for parallel processing to improve the processing efficiency of the elephant stream.

[0023] S400: Each CPU core obtains the message description information from its own exclusively bound input buffer queue and processes the message description information in parallel. Each CPU core of the multi-core CPU processor can obtain the message description information to be processed from the corresponding input buffer queue through an exclusive binding relationship (each numbered input buffer queue can only correspond to one CPU core). For each message description information, the CPU core can first parse the memory pointer and message length in the message description information to read the corresponding input message, and then process the input message based on the processing method in the message description information. This invention improves the processing efficiency of the elephant stream by using the multi-core processor to process the message description information of the same elephant stream input message in parallel, and avoids the load imbalance problem caused by the elephant stream occupying part of the CPU core for a long time.

[0024] S500. After parallel processing is completed, each message description information is forcibly written into the output buffer queue with the same sequence number as its respective input buffer queue. In this invention, after the message is processed sequentially in the CPU kernel, the CPU kernel will write the message description information into the output message buffer queue. The writing method is the same as the input buffer queue with the same sequence number. For example, if the message description information was originally read from the input buffer queue with sequence number RX0, then the message description information processed by the CPU kernel will be written into the output buffer queue with sequence number TX0. Similarly, the message description information originally in the input buffer queue RX1 will be written into the input buffer queue TX1.

[0025] In this invention, for each message description, even if the message status in the message description after the CPU core finishes processing is discarded, the message description still needs to be sent to the corresponding output message buffer queue. The sequence number of the output message buffer queue is consistent with the sequence number of the input message buffer queue when the message description is obtained. That is, after the multi-core CPU processor completes parallel processing, for each message description, regardless of whether the message status corresponding to the message description is discarded, the message description is written to the output buffer queue with the same sequence number.

[0026] In this invention, since the number and number of the output buffer queue are ensured to correspond one-to-one with the number and number of the input buffer queue when configuring the input buffer queue and the output buffer queue, the CPU core can directly write the message description information of the message into the output buffer queue after processing the message, without needing to determine whether the current message needs to wait for output, thereby reducing the processor's waiting time and improving the processor's processing efficiency.

[0027] S600. For multiple output buffer queues, poll them in ascending order of sequence number, and based on the message type corresponding to the message description information at the head of the queue, load a pre-set ordered output scheduler or a non-ordered output scheduler as needed to process the message description information for output. In this invention, the processed message description information is scheduled for output through a pre-set scheduler. The pre-set scheduler is implemented using two polling schedulers: an ordered output scheduler (RR0) and a non-ordered output scheduler (RR1).

[0028] In an optional embodiment of the first aspect of the present invention, S600 may include: S601. For the multiple output buffer queues, poll them in ascending order of sequence number; for example, taking the aforementioned example, in this step, poll the multiple output buffer queues in the order of TX0~TX7.

[0029] S602. For each output buffer queue, obtain the message description information at the head of the queue. In this invention, each output buffer queue may contain multiple message description information entries. Step S602 only obtains the message description information at the head of the queue for judgment each time.

[0030] S603. Parse the message description information at the head of the queue to obtain the message type corresponding to the message description information at the head of the queue. In this step, the message type can be obtained by parsing the message description information at the head of the queue to obtain the order preservation flag in the message description information at the head of the queue. If the order preservation flag is valid, it is determined that the message description information at the head of the queue corresponds to an order-preserving message. If the order preservation flag is invalid, it is determined that the message description information at the head of the queue corresponds to a non-order-preserving message.

[0031] S604. If the message description information at the head of the queue corresponds to an ordered message, then the ordered output scheduler processes the message description information at the head of the queue. Specifically, in this invention, the ordered output scheduler (RR0) is responsible for scheduling the message description information of ordered messages in the output buffer queue. When the system is working, it starts from the output buffer queue with the smallest number among multiple output buffer queues, and polls each output buffer queue in ascending order of queue number. When polling a queue, it determines whether the message description information at the head of the current queue has an ordered flag. If it has an ordered flag, it schedules and outputs the current message description information and jumps to the next ordered queue. If the ordered flag in the current message description information is invalid, it waits until the message description information of the largest numbered queue in the ordered queue is scheduled, then returns to the smallest queue and starts a new round of scheduling.

[0032] In summary, the scheduling rules of the ordered output scheduler can be fully summarized as follows: starting from the output buffer queue with the smallest sequence number, polling in ascending order of sequence number; if the order preservation flag of the message description information at the head of the current output buffer queue is valid, then the message description information at the head of the current output buffer queue is scheduled and the process jumps to the next output buffer queue; if the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then the process waits; after polling the output buffer queue with the largest sequence number is completed, the process returns to the output buffer queue with the smallest sequence number for re-polling.

[0033] S605. If the message description information at the head of the queue corresponds to a non-order-preserving message, then the message description information at the head of the queue is output through the non-order-preserving output scheduler. Specifically, in this invention, the non-order-preserving output scheduler (RR1) is responsible for scheduling the message description information of non-order-preserving messages in the output buffer queue, and also starts polling from the smallest sequence number of multiple output buffer queues. The queue being polled is the queue in the order-preserving queue where the head is a non-order-preserving message. When the head is an order-preserving message, RR1 will not schedule the current queue. The RR1 scheduler completes the scheduling of all order-preserving queues where the head is a non-order-preserving message through polling.

[0034] In summary, the scheduling rules of the non-order-preserving output scheduler can be fully summarized as follows: starting from the output buffer queue with the smallest sequence number, polling in ascending order of sequence number; if the order-preserving flag of the message description information at the head of the current output buffer queue is invalid, then the message description information at the head of the current output buffer queue is scheduled and the process jumps to the next output buffer queue; if the order-preserving flag of the message description information at the head of the current output buffer queue is valid, then the current output buffer queue is skipped and the process jumps to the next output buffer queue; after polling the output buffer queue with the largest sequence number is completed, the process returns to the output buffer queue with the smallest sequence number for re-polling.

[0035] To better understand the complete process of order-preserving forwarding of elephant streams in multi-core processing according to the present invention, the present invention provides an example as follows: The multi-core CPU processor in the example uses an 8-core processor, with 8 input packet buffer queues and 8 output packet buffer queues. The 8 input packet buffer queues are numbered RX0~RX7, and the 8 output packet buffer queues are numbered TX0~TX7.

[0036] Once the input message is identified as an elephant stream by the message parsing module, the input scheduling module will sequentially write the elephant stream messages into the received message buffer queues RX0~RX7 using a polling method.

[0037] In a multi-core CPU processor, each CPU core retrieves the message description information from its dedicated input message buffer queue and sends it to the output message buffer queue after processing. If the message is an ordered message (the message description information carries an order-keeping flag), the CPU must still send the message description information to the output message buffer queue even if the processing result is discard. Furthermore, the output message buffer queue number must match the input message buffer queue number when the message was received. This requirement does not apply if the message is not ordered.

[0038] The output scheduler is implemented using two schedulers: scheduler RR0 schedules only ordered packets in the output packet buffer queue, and scheduler RR1 schedules only unordered packets in the output packet buffer queue. Both schedulers use a round-robin scheduling method.

[0039] After a system reset, the RR0 scheduler starts polling the order-keeping queues in ascending order, beginning with the queue with the smallest output message buffer queue number. When polling a queue, it determines whether the current message is an order-keeping message. If so, the scheduler outputs the message description and moves to the next queue. If the message is not an order-keeping message, it waits. Once the queue with the largest number in the order-keeping queues is scheduled, the scheduler returns to the smallest queue and begins a new round of polling.

[0040] After a system reset, the RR1 scheduler also starts polling from the smallest index of the output message buffer queue. It only sends a scheduling request to the RR1 caller if the queue header contains a non-ordered message. The RR1 scheduler completes the scheduling of all queues with non-ordered messages at the beginning of their headers through a polling method.

[0041] The present invention uses the same round-robin method to schedule messages sequentially in both the input message buffer queue and the output message buffer queue, ensuring that the message output order is consistent with the input order, thus achieving the purpose of order preservation while reducing the resource overhead caused by reordering the buffer.

[0042] See Figure 3 The second aspect of the present invention provides an order-preserving forwarding device for multi-core processing of elephant streams, the order-preserving forwarding device for multi-core processing of elephant streams comprising: The order-preserving processing system 10 includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor, wherein each CPU core of the multi-core CPU processor is exclusively bound to a pair of input buffer queues and output buffer queues with the same sequence number. The message identification module 20 is used to identify each input message received by the network interface. If the input message is an elephant stream message, the order preservation flag in the message description information of the input message is set to valid. The input queue writing module 30 is used to write the message description information of each input message into multiple input buffer queues in a round-robin fashion according to the sequence number in ascending order through a preset input scheduler. The parallel processing module 40 is used to obtain the message description information from the input buffer queue that is exclusively bound to each of the CPU cores, and read the corresponding input message based on the message description information for parallel processing. The output queue writing module 50 is used to force each message description information to be written into the output buffer queue with the same sequence number as its respective input buffer queue after parallel processing is completed. The output scheduling module 60 is used to poll multiple output buffer queues in ascending order of sequence number, and select a preset order-preserving output scheduler or non-order-preserving output scheduler to output the message description information as needed based on the message type corresponding to the message description information at the head of the queue.

[0043] In an optional embodiment of the second aspect of the present invention, the scheduling rule of the order-preserving output scheduler is as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then wait; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

[0044] In an optional embodiment of the second aspect of the present invention, the scheduling rule of the non-order-preserving output scheduler is as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then skip the current output buffer queue and jump to the next output buffer queue; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

[0045] In an optional embodiment of the second aspect of the present invention, the output scheduling module includes: The queue polling unit is used to poll multiple output buffer queues in ascending order of their sequence numbers. The description acquisition unit is used to acquire the message description information of the head of the output buffer queue for each output buffer queue; The information parsing unit is used to parse the message description information at the head of the queue to obtain the message type corresponding to the message description information at the head of the queue. The order-preserving output unit is used to output the message description information of the head of the queue through the order-preserving output scheduler if the message description information of the head of the queue corresponds to an order-preserving message. The non-order-preserving output unit is used to output the message description information of the head of the queue through the non-order-preserving output scheduler if the message description information of the head of the queue corresponds to a non-order-preserving message.

[0046] In an optional embodiment of the second aspect of the present invention, the information parsing unit includes: The sequence preservation tag acquisition subunit is used to parse the message description information at the head of the queue and obtain the sequence preservation tag in the message description information at the head of the queue. The ordered message determination subunit is used to determine whether the message description information at the head of the queue corresponds to an ordered message if the ordered message flag is valid. The non-order-preserving message determination subunit is used to determine that the message description information at the head of the queue corresponds to a non-order-preserving message if the order-preserving flag is invalid.

[0047] In an optional embodiment of the second aspect of the present invention, the output queue writing module includes: The forced write unit is used to write each message description information into the output buffer queue with the same sequence number after parallel processing is completed, regardless of whether the message status corresponding to the message description information is discarded.

[0048] In an optional embodiment of the second aspect of the invention, the number of input buffer queues and the number of output buffer queues are both configured to be the same as the number of cores of the CPU processor.

[0049] Figure 4 This is a schematic diagram of a network communication device according to an embodiment of the present invention. The network communication device can vary significantly due to differences in configuration or performance, and may include one or more processors 70 (central processing units, CPUs) (e.g., one or more processors) and memory 80, and one or more storage media 90 (e.g., one or more mass storage devices) for storing applications or data. The memory and storage media can be temporary or persistent storage. The program stored in the storage media may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the network communication device. Furthermore, the processor may be configured to communicate with the storage media and execute the series of instruction operations stored in the storage media on the network communication device.

[0050] The network communication device of the present invention may further include one or more power supplies 100, one or more wired or wireless network interfaces 110, one or more input / output interfaces 120, and / or one or more operating systems, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 4 The network communication device structure shown does not constitute a limitation on the network communication device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0051] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the order-preserving forwarding method for multi-core processing elephant streams.

[0052] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system or system / unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0053] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0054] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for preserving the order of forwarding large streams in multi-core processing, characterized in that, include: Construct an order-preserving processing system, which includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor, wherein each CPU core of the multi-core CPU processor is exclusively bound to a pair of input buffer queues and output buffer queues with the same sequence number; Each input packet received by the network interface is identified. If the input packet is an elephant stream packet, the order preservation flag in the packet description information of the input packet is set to valid. The message description information of each input message is written into multiple input buffer queues in a round-robin fashion according to the sequence number in ascending order by a preset input scheduler. Each CPU core obtains the message description information from its own dedicated input buffer queue and processes the message description information in parallel. After parallel processing is completed, the description information of each message is forcibly written into the output buffer queue with the same sequence number as its respective input buffer queue; For multiple output buffer queues, they are polled in ascending order of sequence number, and based on the message type corresponding to the message description information at the head of the queue, a preset order-preserving output scheduler or non-order-preserving output scheduler is loaded as needed to process the message description information for output. The step of polling multiple output buffer queues in ascending order of sequence number, and selecting a preset ordered output scheduler or non-ordered output scheduler to output the message description information based on the message type corresponding to the message description information at the head of the queue, includes: For multiple output buffer queues, they are polled in ascending order of sequence number; For each of the output buffer queues, obtain the message description information at the head of the output buffer queue; The message description information at the head of the queue is parsed to obtain the message type corresponding to the message description information at the head of the queue; If the message description information at the head of the queue corresponds to an ordered message, then the ordered output scheduler will output the message description information at the head of the queue. If the message description information at the head of the queue corresponds to a non-order-preserving message, then the message description information at the head of the queue is output and processed by the non-order-preserving output scheduler. The scheduling rules of the order-preserving output scheduler are as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then wait; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

2. The method for order-preserving forwarding of multi-core processing elephant streams according to claim 1, characterized in that, The scheduling rules of the non-order-preserving output scheduler are as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then skip the current output buffer queue and jump to the next output buffer queue; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

3. The method for order-preserving forwarding of multi-core processing elephant streams according to claim 1, characterized in that, The step of parsing the message description information at the head of the queue to obtain the message type corresponding to the message description information at the head of the queue includes: The message description information at the head of the queue is parsed to obtain the order preservation flag in the message description information at the head of the queue. If the order preservation flag is valid, then the message description information at the head of the queue is determined to correspond to an order preservation message; If the order preservation flag is invalid, then the message description information at the head of the queue is determined to correspond to a non-order preservation message.

4. The method for order-preserving forwarding of multi-core processing elephant streams according to claim 1, characterized in that, After the parallel processing is completed, forcibly writing each message description information into the output buffer queue with the same sequence number as its respective input buffer queue includes: After parallel processing is completed, for each message description information, regardless of whether the message status corresponding to the message description information is discarded, the message description information is written into the output buffer queue with the same sequence number.

5. The method for order-preserving forwarding of multi-core processing elephant streams according to claim 1, characterized in that, The number of input buffer queues and the number of output buffer queues are both configured to be the same as the number of cores of the CPU processor.

6. A multi-core processing elephant stream order-preserving forwarding device, characterized in that, The multi-core processing elephant stream order-preserving forwarding device includes: The order-preserving processing system includes multiple input buffer queues with sequence numbers, multiple output buffer queues with sequence numbers, and a multi-core CPU processor, wherein each CPU core of the multi-core CPU processor is exclusively bound to a pair of input buffer queues and output buffer queues with the same sequence number; The message recognition module is used to identify each input message received by the network interface. If the input message is an elephant stream message, the order preservation flag in the message description information of the input message is set to valid. The input queue writing module is used to write the message description information of each input message into multiple input buffer queues in a round-robin fashion according to the sequence number in ascending order through a preset input scheduler. The parallel processing module is used to obtain the message description information from the input buffer queue that is exclusively bound to each of the CPU cores, and to read the corresponding input message based on the message description information for parallel processing; The output queue writing module is used to force each message description information to be written into the output buffer queue with the same sequence number as its respective input buffer queue after parallel processing is completed; An output scheduling module is used to poll multiple output buffer queues in ascending order of sequence number, and select, as needed, a preset ordered output scheduler or a non-ordered output scheduler to process the message description information based on the message type corresponding to the message description information at the head of the queue; the output scheduling module includes: The queue polling unit is used to poll multiple output buffer queues in ascending order of their sequence numbers. The description acquisition unit is used to acquire the message description information of the head of the output buffer queue for each output buffer queue; The information parsing unit is used to parse the message description information at the head of the queue to obtain the message type corresponding to the message description information at the head of the queue. The order-preserving output unit is used to output the message description information of the head of the queue through the order-preserving output scheduler if the message description information of the head of the queue corresponds to an order-preserving message. The non-order-preserving output unit is used to output the message description information of the head of the queue through the non-order-preserving output scheduler if the message description information of the head of the queue corresponds to a non-order-preserving message. The scheduling rules of the order-preserving output scheduler are as follows: Starting from the output buffer queue with the smallest sequence number, poll in ascending order of sequence number; If the order preservation flag of the message description information at the head of the current output buffer queue is valid, then the message description information at the head of the output queue is scheduled and the process jumps to the next output buffer queue. If the order preservation flag of the message description information at the head of the current output buffer queue is invalid, then wait; Once the output buffer queue with the largest sequence number has finished polling, the output buffer queue with the smallest sequence number is returned for re-polling.

7. A network communication device, characterized in that, The network communication device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor invokes the instructions in the memory to cause the network communication device to execute the order-preserving forwarding method for multi-core processing elephant streams as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the order-preserving forwarding method for multi-core processing elephant streams as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Multi-core and multi-thread method and system for preserving order of messages

    CN102868635A

  • Message processing method and device

    CN110505161A