Message processing method and device, computer device, readable storage medium and program product
By using a two-level classifier architecture, which utilizes a low-overhead first classifier for initial classification and a high-overhead second classifier for further classification, the problem of limited message processing performance improvement in existing technologies is solved, and a significant improvement in message processing performance is achieved.
Patent Information
- Application Number
- CN202411733763.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In complex nodes such as traffic rate limiting, the existing message processing flow incurs significant overhead from the classifier, resulting in limited performance improvement in message processing. This is especially true when locking is required to address concurrent access issues, where performance bottlenecks become apparent.
A two-level classifier architecture is adopted. The first classifier performs preliminary classification of packets based on low-overhead processing to form a set of packets of the same type. The second classifier then performs further classification based on high-overhead processing, reducing the number of calls to the second classifier.
By reducing the number of calls to the second classifier, message processing overhead is reduced, significantly improving message processing performance, especially in traffic-limiting services.
Smart Images

Figure CN119583686B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a message processing method and device, computer equipment, readable storage medium and program product. BACKGROUND
[0002] In a cloud network, a high-performance data plane processing framework based on DPDK (Data Plane Develop Kit) is often used to build virtual switches, cloud gateways and other core applications to meet the needs of various business scenarios. Among them, how to optimize the message processing pipeline of the high-performance network processing framework to improve application performance has been an important issue in this field.
[0003] And the node graph is a high-performance message processing library supported by DPDK, which abstracts different message processing methods into nodes and organizes the nodes into a graph through edges. In the node graph, how to efficiently move messages from one node to the next node is an important part.
[0004] The main message processing procedure currently used is that when processing messages, the node classifies messages according to the processing results in turn, and when the classification result of a message is consistent with that of the previous message, the message will not be directly moved to the next node for processing; when the classification result of a message is inconsistent with that of the previous message, the messages with the same classification result as the previous message are batched and moved to the next node for processing.
[0005] However, the current message processing procedure is still packet by packet, and in relatively complex nodes such as traffic rate limiting, the overhead of the classifier in the node is still large, and the improvement in message processing performance is limited. SUMMARY
[0006] Therefore, it is necessary to provide a message processing method, device, computer equipment, readable storage medium and program product capable of reducing message processing overhead and improving message processing performance to solve the above technical problems.
[0007] In a first aspect, the present application provides a message processing method applied to a first message processing node, the first message processing node comprising a first classifier and a second classifier, the first classifier and the second classifier having different processing methods for messages, and the processing overhead of the first classifier for messages being less than that of the second classifier for messages; the method comprising:
[0008] The first classifier classifies a plurality of messages in a received message sequence in turn based on a first processing method, obtains an mth message set, and sends the mth message set to the second classifier; the mth message set comprises at least one message belonging to a same first type; m is greater than or equal to 2.
[0009] The second classifier classifies the mth message set based on the second processing mode to obtain a second type of the messages in the mth message set; if the second type of the messages in the mth message set is different from the second type of the messages in the (m-1)th target message set, the (m-1)th target message set is sent to the second message processing node for processing the messages in the (m-1)th target message set by the second message processing node.
[0010] In one of the embodiments, the first classifier classifies the messages in the received message sequence based on the first processing mode to obtain the mth message set, including: the first classifier classifies the ith message in the message sequence based on the first processing mode to obtain a first type of the ith message; when the first type of the ith message is different from the first type of the (i-1)th message, if there is a message not sent to the second classifier before the (i-1)th message, the (m)th message set is formed according to the message not sent to the second classifier before the (i-1)th message and the (i-1)th message, and i is greater than or equal to 1.
[0011] In one of the embodiments, the method further includes: if the second type of the messages in the (m-2)th target message set is the same as the second type of the messages in the (m-1)th message set, the (m-2)th target message set and the (m-1)th message set are merged to obtain the (m-1)th target message set; if the second type of the messages in the (m-2)th target message set is different from the second type of the messages in the (m-1)th message set, the (m-1)th message set is taken as the (m-1)th target message set.
[0012] In one of the embodiments, the first classifier classifies the ith message in the received message sequence based on the first processing mode to obtain a first type of the ith message, including: the first classifier classifies the ith message based on metadata of the ith message to obtain the first type of the ith message; the metadata includes an inflow port of an inflow switch and / or an outflow port of an outflow switch of the ith message.
[0013] In one of the embodiments, the second classifier classifies the mth message set based on the second processing mode to obtain a second type of the messages in the mth message set, including: the second classifier processes the messages in the mth message set; based on a processing result of the messages in the mth message set, the second type of the messages in the mth message set is obtained.
[0014] In one of the embodiments, the method further comprises: when m is equal to 2, if the second type of the packets in the m-2th packet set is different from the second type of the packets in the m-1th packet set, sending the m-2th packet set to the third packet processing node, so that the third packet processing node processes the packets in the m-2th packet set.
[0015] In a second aspect, the present application further provides a packet processing device applied to a first packet processing node, the first packet processing node comprising a first classifier and a second classifier, the first classifier and the second classifier having different processing manners for packets, and the first classifier having a smaller processing cost for packets than the second classifier; the device comprising:
[0016] a first classification module, configured to sequentially classify, by the first classifier, a plurality of packets in a received packet sequence based on a first processing manner, to obtain an mth packet set, and send the mth packet set to the second classifier; the mth packet set comprising at least one packet belonging to a same first type; m being greater than or equal to 2;
[0017] a second classification module, configured to receive, by the second classifier, a second type of the packets in the mth packet set based on a second processing manner, and send an m-1th target packet set to a second packet processing node, so that the second packet processing node processes the packets in the m-1th target packet set, if the second type of the packets in the mth packet set is different from the second type of the packets in the m-1th target packet set.
[0018] In one of the embodiments, the first classification module is specifically configured to classify, by the first classifier, an ith packet in the packet sequence based on the first processing manner, to obtain a first type of the ith packet; and when the first type of the ith packet is different from the first type of an i-1th packet, if there is a packet not sent to the second classifier before the i-1th packet, the mth packet set is formed according to the packet not sent to the second classifier before the i-1th packet and the i-1th packet, i being greater than or equal to 1.
[0019] In one of the embodiments, the second classification module is further configured to: if the second type of the packets in the m-2th target packet set is the same as the second type of the packets in the m-1th packet set, merge the m-2th target packet set and the m-1th packet set to obtain the m-1th target packet set; and if the second type of the packets in the m-2th target packet set is different from the second type of the packets in the m-1th packet set, take the m-1th packet set as the m-1th target packet set.
[0020] In one of the embodiments, the first classification module is specifically configured to classify the ith message based on metadata of the ith message by the first classifier, to obtain a first type of the ith message; the metadata comprises an in-flow port of an in-flow switch and / or an out-flow port of an out-flow switch of the ith message.
[0021] In one of the embodiments, the second classification module is specifically configured to process the messages in the mth message set by the second classifier; and obtain a second type of the messages in the mth message set based on a processing result of the messages in the mth message set.
[0022] In one of the embodiments, the second classification module is further configured to, when m is equal to 2, if the second type of the messages in the m-2th message set is different from the second type of the messages in the m-1th message set, send the m-2th message set to the third message processing node, so that the third message processing node processes the messages in the m-2th message set.
[0023] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method in any one of the first aspect when executing the computer program.
[0024] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the method in any one of the first aspect when executed by a processor.
[0025] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, and the computer program implements the steps of the method in any one of the first aspect when executed by a processor.
[0026] The message processing method, device, computer device, readable storage medium and program product, through the first classifier in the first message processing node, sequentially classifies a plurality of messages in the received message sequence based on a first processing manner, obtains an mth message set, and sends the mth message set to a second classifier; the mth message set includes at least one message belonging to a same first type; m is greater than or equal to 2; and then through the second classifier in the first message processing node, the mth message set is classified based on a second processing manner, to obtain a second type of the messages in the mth message set; if the second type of the messages in the mth message set is different from the second type of the messages in the m-1th target message set, the m-1th target message set is sent to the second message processing node, so that the second message processing node processes the messages in the m-1th target message set. The processing manners of the first classifier and the second classifier for the messages are different, and the processing cost of the first classifier for the messages is less than the processing cost of the second classifier for the messages, so that the messages are first classified by the first classifier with less processing cost, and the messages belonging to the same first type are sent to the second classifier, and then the second classifier processes the messages belonging to the same first type, which reduces the number of calls of the second classifier, reduces the message processing cost, and improves the message processing performance. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other related drawings can be obtained without creative labor.
[0028] Figure 1 The application environment diagram of the message processing method in one embodiment;
[0029] Figure 2 The flowchart of the message processing method in one embodiment;
[0030] Figure 3 The flowchart of the message processing method in another embodiment;
[0031] Figure 4 One of the message processing principle diagrams in one embodiment;
[0032] Figure 5 The second of the message processing principle diagrams in one embodiment;
[0033] Figure 6 The third of the message processing principle diagrams in one embodiment;
[0034] Figure 7 Figure 4 is a message processing schematic diagram in an embodiment;
[0035] Figure 8 Figure 5 is a message processing schematic diagram in an embodiment;
[0036] Figure 9 Figure 6 is a message processing schematic diagram in an embodiment;
[0037] Figure 10 Figure 7 is a structural block diagram of a message processing device in an embodiment;
[0038] Figure 11 Figure 8 is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0039] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0040] In cloud networks, a high-performance data plane processing framework based on DPDK (Data Plane Develop Kit) is often used to construct virtual switches, cloud gateways and other core applications to meet the needs of various business scenarios. Among them, how to optimize the message processing pipeline of the high-performance network processing framework to improve the application performance has been an important issue in this field.
[0041] Node graph is a high-performance message processing library supported by DPDK. Different message processing methods are abstracted into nodes, and the nodes are organized together through links to form a graph. The node graph architecture reduces the processor instruction and data cache invalidation by implementing similar message processing logic in the same node, thereby reducing the memory latency in the message processing process to improve performance. At the same time, by taking advantage of the fact that most messages have the same processing flow in the node graph, nodes can process messages in batches to further improve message processing performance.
[0042] In the node graph, how to efficiently move the packet from one node to the next node is one of the important links. The main packet processing flow currently adopted is that the node classifies the packet according to the processing result in sequence when processing the packet, and the packet is not directly moved to the next node for processing when the classification result of the packet is consistent with that of the previous packet; when the classification result of the packet is inconsistent with that of the previous packet, the packets with the same previous classification result are batched and moved to the next node for processing. This method of batch moving the packets with the same next hop node from one node to another node can reduce the overhead caused by the flow of the packets one by one.
[0043] However, the current packet processing flow still has certain bottlenecks, that is, the classifier in the node still processes the packets one by one, and the overhead of the classifier is still large in a node with relatively complex processing such as flow rate limiting, so when the overhead of the classifier is much larger than the overhead of the packet movement, the improvement in the packet processing performance is limited. In particular, when a lock needs to be added to the classifier to solve the concurrent access problem, the performance bottleneck appears in the classifier itself.
[0044] The packet processing method provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 The data transmission between the plurality of packet processing nodes is performed through a network or a bus.
[0045] In an exemplary embodiment, as shown in Figure 2 A packet processing method is provided, and the method is applied to a first packet processing node including a first classifier and a second classifier. The first classifier and the second classifier have different processing modes for the packet, and the processing overhead of the first classifier for the packet is less than that of the second classifier for the packet. The method includes the following steps 201 and 202. Wherein:
[0046] Step 201: The first classifier classifies a plurality of packets in a received packet sequence in sequence based on a first processing mode, obtains an mth packet set, and sends the mth packet set to the second classifier.
[0047] The mth packet set includes at least one packet belonging to the same first type. m is greater than or equal to 2. In the implementation of the cloud network virtual switch, the first processing mode can be classifying the packet based on the port of the inflow and outflow switch, and the port of the inflow and outflow in the virtual switch is usually saved in the metadata, so only one memory access is needed to realize the classification, and the overhead is very small.
[0048] The packet sequence includes a plurality of packets arranged in sequence. The packet sequence can be sent by a previous packet processing node of the first packet processing node to the first packet processing node.
[0049] Optionally, the first packet processing node, after receiving the packet sequence, sequentially performs first classification on the multiple packets in the packet sequence based on the first processing manner. For the i th packet, if the first type of the i th packet is consistent with the first type of the previous packet, the classification on the subsequent packets is continued based on the first processing manner; if the first type of the i th packet is inconsistent with the first type of the previous packet, the packets with the same first type as the previous packet are batched as the packets in the m th packet set, and the m th packet set is sent to the second classifier. i is greater than or equal to 1.
[0050] For the 0 th packet, after the first classification on the 0 th packet based on the first processing manner, the classification on the 1 st packet based on the first processing manner is continued.
[0051] For the last packet, after the first classification on the last packet based on the first processing manner, if the first type of the last packet is the same as the first type of the previous packet of the last packet, the last packet and the packets with the same first type as the previous packet of the last packet are taken as the packets in the last packet set, and the last packet set is sent to the second classifier.
[0052] For example, the packet sequence includes a 0 th packet, a 1 st packet, a 2 nd packet, a 3 rd packet, and a 4 th packet. The first classification on the 0 th packet is performed to obtain the first type of the 0 th packet, and the first classification on the 1 st packet is performed to obtain the first type of the 1 st packet. When the first type of the 0 th packet is the same as the first type of the 1 st packet, the first classification on the 2 nd packet is continued to obtain the first type of the 2 nd packet. When the first type of the 2 nd packet is different from the first type of the 1 st packet, the 0 th packet and the 1 st packet are taken as the packets in the 0 th packet set and sent to the second classifier. The first classification on the 3 rd packet is continued to obtain the first type of the 3 rd packet, and when the first type of the 3 rd packet is different from the first type of the 2 nd packet, the 2 nd packet is taken as the packet in the 1 st packet set and sent to the second classifier. Similarly, the first classification on the 4 th packet is continued to obtain the first type of the 4 th packet, and when the first type of the 4 th packet is the same as the first type of the 3 rd packet, the 3 rd packet and the 4 th packet are taken as the packets in the 2 nd packet set and sent to the second classifier.
[0053] In step 202, the second classifier classifies the mth message set based on the second processing mode to obtain the second type of the messages in the mth message set; if the second type of the messages in the mth message set is different from the second type of the messages in the (m-1)th target message set, the (m-1)th target message set is sent to the second message processing node for processing the messages in the (m-1)th target message set by the second message processing node.
[0054] In the implementation of the cloud network virtual switch, the second processing mode can be service processing on the messages, and the messages are classified for the second time according to the service processing result, which has relatively large overhead. Taking the traffic rate limiting service as an example, the messages are checked for rate limiting. It should be noted that a lock is also needed in the rate limiting checking process to prevent concurrent conflicts. The (m-1)th target message set refers to a set of messages that are not sent to other message processing nodes. The second message processing node is a node for processing the messages of the second type in the (m-1)th target message set. It should be noted that different second types correspond to different second message processing nodes, and each second message processing node only processes the messages of the corresponding type.
[0055] Optionally, after receiving the mth message set sent by the first classifier, the second classifier classifies the messages in the mth message set for the second time based on the second processing mode to obtain the second type of the messages in the mth message set. It should be noted that the second types of the messages in the mth message set can be different or the same, but generally the second types of the messages in the mth message set are the same because the messages in a message set are messages of the same first type.
[0056] For the case that the second types of the messages in the mth message set are different, the messages can be directly sent to the corresponding second message processing nodes according to the second types of the messages in the mth message set. For the case that the second types of the messages in the mth message set are the same, if the second type of the messages in the mth message set is different from the second type of the messages in the (m-1)th target message set, the (m-1)th target message set is sent to the second message processing node for processing the messages in the (m-1)th target message set by the second message processing node.
[0057] For example, for the case that the second types of the messages in the mth message set are the same. The second types of the messages in the third message set are different from the second types of the messages in the second target message set, and the second target message set is sent to the second message processing node.
[0058] If the second type of the message in the mth message set is the same as the second type of the message in the (m-1)th target message set, the (m-1)th target message set and the mth message set are merged to obtain the mth target message set.
[0059] The message processing method includes the following steps: a first classifier in a first message processing node classifies a plurality of messages in a received message sequence based on a first processing manner to obtain an mth message set, and sends the mth message set to a second classifier; the mth message set includes at least one message belonging to a same first type; m is greater than or equal to 2; the second classifier in the first message processing node classifies the mth message set based on a second processing manner to obtain a second type of the message in the mth message set; if the second type of the message in the mth message set is different from a second type of a message in an (m-1)th target message set, the (m-1)th target message set is sent to a second message processing node for processing the message in the (m-1)th target message set by the second message processing node. The first classifier and the second classifier have different processing manners for the message, and the processing cost of the first classifier for the message is less than the processing cost of the second classifier for the message. In this way, the first classifier with a smaller processing cost is used to classify the message for the first time, and the second classifier is used to process the message belonging to the same first type, thereby reducing the number of times of calling the second classifier, reducing the message processing cost, and improving the message processing performance. Especially for traffic limiting service, the message processing performance is greatly improved.
[0060] In one of the embodiments, as shown in Figure 3 The present application provides another message processing method. The first classifier classifies a plurality of messages in a received message sequence based on a first processing manner to obtain an mth message set, including:
[0061] In step 301, the first classifier classifies an ith message in the message sequence based on a first processing manner to obtain a first type of the ith message, and i is greater than or equal to 1.
[0062] In step 302, when the first type of the ith message is different from the first type of an (i-1)th message, if there is a message not sent to the second classifier before the (i-1)th message, the (m)th message set is formed according to the message not sent to the second classifier before the (i-1)th message and the (i-1)th message.
[0063] When the first type of the ith message is the same as the first type of the (i-1)th message, refer to steps 301 and 302, and continue to classify the messages after the ith message until the last message.
[0064] It should be noted that when i is equal to 1, if the first type of the i-th packet is different from the first type of the (i-1)-th packet (i.e., the 0-th packet), the (i-1)-th packet is directly sent to the second classifier as the packet in the 0-th packet set.
[0065] For example, when i is equal to 7, for the 7-th packet, if the type of the 7-th packet is different from the type of the 6-th packet, and the first types of the 0-th packet to the 6-th packet are the same, the 0-th packet to the 6-th packet are sent to the second classifier as the packets in the 0-th packet set.
[0066] It can be understood that there can be a case where the first types of all the packets in the packet sequence are the same, in which case the packets in the entire packet sequence are sent to the second classifier at one time.
[0067] In one of the embodiments, the method further includes: if the second type of the packet in the (m-2)-th target packet set is the same as the second type of the packet in the (m-1)-th packet set, merging the (m-2)-th target packet set and the (m-1)-th packet set to obtain the (m-1)-th target packet set; if the second type of the packet in the (m-2)-th target packet set is different from the second type of the packet in the (m-1)-th packet set, taking the (m-1)-th packet set as the (m-1)-th target packet set.
[0068] Optionally, when m is equal to 2, if the second type of the packet in the (m-2)-th packet set (i.e., the 0-th packet set) is different from the second type of the packet in the (m-1)-th packet set (i.e., the 1-st packet set), the (m-2)-th packet set is sent to the third packet processing node for processing the packet in the (m-2)-th packet set by the third packet processing node.
[0069] In other words, if the second type of the packet in the (m-2)-th target packet set is different from the second type of the packet in the (m-1)-th packet set, the (m-2)-th packet set is sent to the third packet processing node, and the (m-1)-th packet set is taken as the (m-1)-th target packet set.
[0070] It can be understood that for the last packet set received by the second classifier, if the second type of the packet in the last packet set is the same as the second type of the packet in the current target packet set in the second classifier, the last packet set and the current target packet set in the second classifier are merged and then sent to the corresponding packet processing node. If the second type of the packet in the last packet set is different from the second type of the packet in the current target packet set in the second classifier, the last packet set and the current target packet set are sent to the corresponding type of packet processing node, respectively.
[0071] For example, if the second type of the message in the 0th target message set is the same as the second type of the message in the 1st message set, the 0th target message set and the 1st message set are merged to obtain the 1st target message set, and the 1st target message set is temporarily not sent. The 2nd message set is received, and if the second type of the message in the 2nd message set is different from the second type of the message in the 1st target message set, the 1st target message set is sent to the third message processing node.
[0072] In one embodiment, the first classifier classifies the i th message in the received message sequence based on the first processing manner to obtain the first type of the i th message, including: the first classifier classifies the i th message based on the metadata of the i th message to obtain the first type of the i th message; the metadata includes the flow-in port of the flow-in switch and / or the flow-out port of the flow-out switch of the i th message.
[0073] Corresponding different first types are assigned to different flow-in ports and / or flow-out ports. In other words, the first classifier can classify the i th message according to the flow-in port of the flow-in switch and / or the flow-out port of the flow-out switch of the i th message to obtain the first type of the i th message. It should be noted that the present embodiment is applicable to the implementation of the cloud network virtual machine switch.
[0074] In the present embodiment, the message is classified for the first time based on the message flow-in port and / or flow-out port. Since the metadata is usually stored in the memory, the first classification can be realized by one memory access, and the first classifier has a small overhead.
[0075] In one embodiment, the second classifier classifies the m th message set based on the second processing manner to obtain the second type of the message in the m th message set, including: the second classifier performs service processing on the message in the m th message set; and based on the service processing result of the message in the m th message set, the second type of the message in the m th message set is obtained.
[0076] In the present embodiment, the service processing is, for example, the rate limiting check processing procedure in the traffic rate limiting service, and the service processing result includes that the traffic reaches the upper limit or does not reach the upper limit, etc. Corresponding different second types are assigned to different service processing results.
[0077] It should be understood that although the steps in the flowcharts involved in the embodiments described above are shown in sequence according to the arrows, the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of the steps is not strictly limited in sequence, and the steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the embodiments described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution of the steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least some of the other steps or steps or stages in other steps.
[0078] The above message processing principle is described in detail below by way of example, and the message processing principle diagram is shown in Figures 4-9 As can be seen, the number of calls of the second classifier with high overhead is reduced from n to 3, and the number of message movements is only 3.
[0079] The sequence of messages received by the first message processing node (hereinafter referred to as message processing node A) includes the 0th message, the 1st message,..., the ith message, the ith+1 message,..., the n-1th message, and the nth message.
[0080] The first classifier in the message processing node A performs the first classification on the 0th message to obtain the first type of the 0th message. At this time, the second classifier is not immediately called to perform the second classification on the 0th message, as shown in Figure 4 .
[0081] The message processing node A performs the first classification on the 1st message to obtain the first type of the 1st message; when the first type of the 1st message is the same as the first type of the 0th message, the message processing node A continues to perform the first classification on the 2nd message to obtain the first type of the 2nd message; when the first type of the 2nd message is different from the first type of the 1st message, the second classifier in the message processing node A performs the second classification on the 0th message and the 1st message to obtain the second type of the 0th message and the second type of the 1st message, wherein the second type of the 0th message and the second type of the 1st message are both representative of the 0th message and the 1st message entering the next hop message processing node B for execution. At this time, the 0th message and the 1st message are not immediately sent to the message processing node B, as shown in Figure 5 .
[0082] The message processing node A processes the third message to obtain a first type of the third message; when the first type of the third message is the same as the first type of the second message, the message processing node A continues to perform first classification on the fourth message to obtain a first type of the fourth message; when the first type of the fourth message is different from the first type of the third message, a second classifier in the message processing node A performs second classification on the third message and the second message to obtain a second type of the third message and a second type of the second message. When the second type of the third message and the second type of the second message are also both representative of the third message and the second message entering the next-hop message processing node B for execution, at this time, the third message and the second message will not be sent to the message processing node B, but the first message, the second message, the third message and the fourth message are merged, as shown in FIG. 8. Figure 6
[0083] The first classifier in the message processing node A performs first classification on the fifth message to the ith message in sequence to obtain first types which are all the same as the first type of the fourth message, until the first type of the ith+1 message is different from the first type of the ith message, the second classifier in the message processing node A performs second classification on the fourth message to the ith message to obtain second types of the fourth message to the ith message. When the second types of the fourth message to the ith message are all representative of the fourth message to the ith message entering the next-hop message processing node C for execution, the first message to the third message are sent to the message processing node B, as shown in FIG. 9. Figure 7
[0084] The first classifier in the message processing node A performs first classification on the fifth message to the ith message in sequence to obtain first types which are all the same as the first type of the fourth message, until the first type of the ith+1 message is different from the first type of the ith message, the second classifier in the message processing node A performs second classification on the fourth message to the ith message to obtain second types of the fourth message to the ith message. When the second types of the fourth message to the ith message are all representative of the fourth message to the ith message entering the next-hop message processing node C for execution, the first message to the third message are sent to the message processing node B, as shown in FIG. 9. Figure 8
[0085] The message processing node A sends the ith+1 message to the nth message to the message processing node D, as shown in FIG. 10. Figure 9
[0086] Based on the same inventive concept, the embodiments of the present application further provide a packet processing device for implementing the packet processing method described above. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the above method, so the specific limitations in one or more packet processing device embodiments provided below can refer to the limitations of the packet processing method described above, which will not be repeated here.
[0087] In one exemplary embodiment, as shown in Figure 10 A packet processing device is provided, applied to a first packet processing node, the first packet processing node comprising a first classifier and a second classifier, the first classifier and the second classifier having different processing manners for packets, and the processing overhead of the first classifier for the packets being less than the processing overhead of the second classifier for the packets. The packet processing device 1000 comprises a first classification module 1001 and a second classification module 1002, wherein:
[0088] The first classification module 1001 is configured to sequentially classify a plurality of packets in a received packet sequence by the first classifier based on a first processing manner to obtain an mth packet set, and send the mth packet set to the second classifier; the mth packet set comprises at least one packet belonging to a same first type; m is greater than or equal to 2;
[0089] The second classification module 1002 is configured to receive classification of the mth packet set by the second classifier based on a second processing manner to obtain a second type of the packets in the mth packet set; if the second type of the packets in the mth packet set is different from a second type of the packets in an (m-1)th target packet set, the (m-1)th target packet set is sent to a second packet processing node for processing the packets in the (m-1)th target packet set by the second packet processing node.
[0090] In one embodiment, the first classification module 1001 is specifically configured to classify an i th packet in the packet sequence by the first classifier based on the first processing manner to obtain a first type of the i th packet; when the first type of the i th packet is different from a first type of an (i-1) th packet, if there is a packet that has not been sent to the second classifier before the (i-1) th packet, the (m) th packet set is formed according to the packet that has not been sent to the second classifier before the (i-1) th packet and the (i-1) th packet, i is greater than or equal to 1.
[0091] In one of the embodiments, the second classification module 1002 is further configured to: if the second types of the packets in the m-2th target packet set and the m-1th packet set are the same, merge the m-2th target packet set and the m-1th packet set to obtain the m-1th target packet set; and if the second types of the packets in the m-2th target packet set and the m-1th packet set are different, take the m-1th packet set as the m-1th target packet set.
[0092] In one of the embodiments, the first classification module 1001 is specifically configured to: classify the ith packet based on the metadata of the ith packet by using the first classifier to obtain the first type of the ith packet; and the metadata comprises an ingress port of an ingress switch and / or an egress port of an egress switch of the ith packet.
[0093] In one of the embodiments, the second classification module 1002 is specifically configured to: perform service processing on the packets in the mth packet set by using the second classifier; and obtain the second types of the packets in the mth packet set based on the service processing results of the packets in the mth packet set.
[0094] In one of the embodiments, the second classification module 1002 is further configured to: when m is equal to 2, if the second types of the packets in the m-2th packet set and the m-1th packet set are different, send the m-2th packet set to the third packet processing node, so that the third packet processing node processes the packets in the m-2th packet set.
[0095] Each of the above modules in the packet processing apparatus can be realized by software, hardware, and combinations thereof in whole or in part. The above modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to the above modules.
[0096] In one of the embodiments, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 8. Figure 11As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is used to store the message set data. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with the terminal outside through the network connection. The computer program is executed by the processor to realize a message processing method.
[0097] Those skilled in the art can understand that, Figure 11 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or less components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0098] In one exemplary embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in the above method embodiment.
[0099] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by the processor to implement the steps of the method described in the above method embodiment.
[0100] In one embodiment, a computer program product is provided, including a computer program, and the computer program is executed by the processor to implement the steps of the method described in the above method embodiment.
[0101] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0102] The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the present application.
[0103] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. A method of processing a packet, the method comprising: The method is applied to a first packet processing node, the first packet processing node comprises a first classifier and a second classifier, the first classifier and the second classifier have different processing manners for packets, and the processing cost of the first classifier for the packets is less than the processing cost of the second classifier for the packets; the method comprises the following steps: The first classifier sequentially classifies a plurality of packets in a received packet sequence based on a first processing manner, obtains an mth packet set, and sends the mth packet set to the second classifier; the mth packet set comprises at least one packet belonging to a same first type; m is greater than or equal to 2; The second classifier classifies the mth packet set based on a second processing manner, obtains a second type of the packets in the mth packet set, and if the second type of the packets in the mth packet set is different from a second type of packets in an m-1th target packet set, sends the m-1th target packet set to a second packet processing node for processing the packets in the m-1th target packet set by the second packet processing node; The first classifier sequentially classifies a plurality of packets in a received packet sequence based on a first processing manner, obtains an mth packet set, and sends the mth packet set to the second classifier; the mth packet set comprises at least one packet belonging to a same first type; m is greater than or equal to 2; The method further comprises: if the second type of the packets in an m-2th target packet set is the same as the second type of the packets in an m-1th packet set, merging the m-2th target packet set and the m-1th packet set to obtain the m-1th target packet set; and if the second type of the packets in the m-2th target packet set is different from the second type of the packets in the m-1th packet set, taking the m-1th packet set as the m-1th target packet set.
2. The method of claim 1, wherein, The first classifier classifies the i th packet in the received packet sequence based on the first processing manner, and obtains a first type of the i th packet, which comprises the following steps: The first classifier classifies the i th packet based on metadata of the i th packet, and obtains a first type of the i th packet; the metadata comprises an inflow port of an inflow switch and / or an outflow port of an outflow switch of the i th packet.
3. The method of claim 1, wherein, The second classifier classifies the mth packet set based on a second processing manner, obtains a second type of the packets in the mth packet set, which comprises the following steps: The second classifier performs service processing on the packets in the mth packet set; The second type of the packets in the mth packet set is obtained based on a service processing result of the packets in the mth packet set.
4. The method of claim 1, wherein, The method further comprises: When m is equal to 2, if the second type of the packets in the m-2th packet set is different from the second type of the packets in the m-1th packet set, the m-2th packet set is sent to a third packet processing node, so that the third packet processing node processes the packets in the m-2th packet set.
5. A packet processing device, characterized by, The device is applied to a first packet processing node, the first packet processing node comprises a first classifier and a second classifier, the first classifier and the second classifier have different processing manners for packets, and the processing cost of the first classifier for the packets is less than the processing cost of the second classifier for the packets; the device comprises: A first classification module is configured to sequentially classify, by the first classifier, a plurality of packets in a received packet sequence based on a first processing manner, to obtain an mth packet set, and send the mth packet set to the second classifier; the mth packet set comprises at least one packet belonging to a same first type; m is greater than or equal to 2; A second classification module is configured to classify, by the second classifier, the mth packet set based on a second processing manner, to obtain a second type of the packets in the mth packet set; if the second type of the packets in the mth packet set is different from a second type of packets in an m-1th target packet set, the m-1th target packet set is sent to a second packet processing node, so that the second packet processing node processes the packets in the m-1th target packet set; The first classification module is specifically configured to classify, by the first classifier, an ith packet in the packet sequence based on the first processing manner, to obtain a first type of the ith packet; when the first type of the ith packet is different from a first type of an (i-1)th packet, if there is a packet that has not been sent to the second classifier before the (i-1)th packet, the (i-1)th packet and the packet that has not been sent to the second classifier before the (i-1)th packet constitute the mth packet set, i is greater than or equal to 1; The second classification module is further configured to, if a second type of packets in an m-2th target packet set is the same as a second type of packets in an m-1th packet set, merge the m-2th target packet set and the m-1th packet set to obtain the m-1th target packet set; if the second type of the packets in the m-2th target packet set is different from the second type of the packets in the m-1th packet set, the m-1th packet set is taken as the m-1th target packet set.
6. The apparatus of claim 5, wherein, The first classification module is specifically configured to classify, by the first classifier, the ith packet based on metadata of the ith packet, to obtain the first type of the ith packet; the metadata comprises an inflow port of an inflow switch and / or an outflow port of an outflow switch of the ith packet.
7. The apparatus of claim 5, wherein, The second classification module is specifically configured to: the second classifier performs service processing on the messages in the mth message set; and a second type of the messages in the mth message set is obtained based on a service processing result of the messages in the mth message set.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor, when executing the computer program, implements the steps of the method in any one of claims 1 to 4.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method in any one of claims 1 to 4.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method in any one of claims 1 to 4. The computer program, when executed by the processor, implements the steps of the method in any one of claims 1 to 4.
Citation Information
Patent Citations
A message processing method and electronic equipment
CN109729021A
Message processing method and device, equipment, storage medium and program product
CN114138834A