Message processing method and device, computer equipment, readable storage medium and program product
By using the combination of the first classifier and the second classifier in the message processing node, the packets are processed in a hierarchical manner, which solves the problem of large message processing overhead in the prior art and achieves more efficient message processing performance.
Patent Information
- Application Number
- CN202411733763.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In the prior art, the message processing process is still carried out packet by packet, resulting in a large overhead of classifiers in complex nodes, making it difficult to effectively improve message processing performance.
By introducing a first classifier and a second classifier into the message processing node, the first classifier performs a preliminary classification of the message, forms a message set, and sends it to the second classifier for further processing. The second classifier only processes messages of the same first type, reducing the number of calls.
This method reduces the overhead of message processing and reduces the number of calls of the second classifier, thereby improving the packet processing performance, especially in complex service processing such as traffic speed limit, which significantly improves performance.
Smart Images

Figure CN119583686A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a message processing method, apparatus, computer equipment, readable storage medium and program product. Background Art
[0002] In cloud networks, high-performance data plane processing frameworks based on DPDK (Data Plane Develop Kit) are often used to build core applications such as virtual switches and cloud gateways to meet the needs of various business scenarios. Among them, how to improve application performance by optimizing the message processing pipeline of the high-performance network processing framework has always been an important topic in this field.
[0003] The node graph is a high-performance message processing library supported by DPDK. It abstracts different message processing methods into nodes, organizes the nodes together through edges, and arranges them into a graph. In the node graph, how to efficiently move messages from one node to the next is an important link.
[0004] The main message processing flow currently used is that when a node processes a message, it classifies the message in sequence according to the processing results. When the classification result of the message is consistent with the previous message, the message will not be directly moved to the next node for processing; when the classification result of the message is inconsistent with the previous message, the messages with the same classification result as the previous message will be moved to the next node for processing in batches.
[0005] However, the current message processing process is still performed packet by packet. In nodes with relatively complex processing such as traffic rate limiting, the overhead of the classifier in the node is still very large, and the improvement in message processing performance brought about is limited. Summary of the invention
[0006] Based on this, it is necessary to provide a message processing method, apparatus, computer equipment, readable storage medium and program product that can reduce message processing overhead and thus improve message processing performance in response to the above technical problems.
[0007] In a first aspect, the present application provides a message processing method, which is applied to a first message processing node, the first message processing node includes a first classifier and a second classifier, the first classifier and the second classifier process messages differently, and the first classifier has less processing overhead for the message than the second classifier; the method includes:
[0008] The first classifier sequentially classifies multiple messages in the received message sequence based on the first processing method to obtain an m-th message set, and sends the m-th message set to the second classifier; the m-th message set includes at least one message belonging to the 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 method 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-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 can process the messages in the m-1th target message set.
[0010] In one of the embodiments, the first classifier sequentially classifies multiple messages in a received message sequence based on a first processing method to obtain an mth message set, including: the first classifier classifies the i-th message in the message sequence based on the first processing method to obtain a first type of the i-th message; when the i-th message is different from the first type of the i-1-th message, if there is a message that has not been sent to the second classifier before the i-1-th message, then the m-th message set is formed based on the message that has not been sent to the second classifier before the i-1-th message and the i-1-th message, where i is greater than or equal to 1.
[0011] In one of the embodiments, the method also includes: if the second type of messages in the m-2th target message set is the same as the second type of messages in the m-1th message set, then merging the m-2th target message set and the m-1th message set to obtain the m-1th target message set; if the second type of messages in the m-2th target message set is different from the second type of messages in the m-1th message set, then using the m-1th message set as the m-1th target message set.
[0012] In one of the embodiments, a first classifier classifies the i-th message in a received message sequence based on a first processing method to obtain a first type of the i-th message, including: the first classifier classifies the i-th message based on metadata of the i-th message to obtain the first type of the i-th message; the metadata includes the incoming port of the i-th message flowing into the switch and / or the outgoing port of the i-th message flowing out of the switch.
[0013] In one of the embodiments, the second classifier classifies the mth message set based on the second processing method to obtain the second type of messages in the mth message set, including: the second classifier performs business processing on the messages in the mth message set; based on the business processing results of the messages in the mth message set, obtains the second type of messages in the mth message set.
[0014] In one of the embodiments, the method also includes: when m is equal to 2, if the second type of messages in the m-2th message set is different from the second type of messages in the m-1th message set, the m-2th message set is sent to a third message processing node so that the third message processing node processes the messages in the m-2th message set.
[0015] In a second aspect, the present application further provides a message processing device, which is applied to a first message processing node, the first message processing node includes a first classifier and a second classifier, the first classifier and the second classifier process the message differently, and the processing overhead of the first classifier for the message is less than the processing overhead of the second classifier for the message; the device includes:
[0016] A first classification module, configured for the first classifier to sequentially classify multiple messages in the received message sequence based on the first processing method to obtain an m-th message set, and send the m-th message set to the second classifier; the m-th message set includes at least one message belonging to the same first type; m is greater than or equal to 2;
[0017] The second classification module is used for the second classifier to receive the mth message set and classify it based on the second processing method 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-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 can process the messages in the m-1th target message set.
[0018] In one of the embodiments, the first classification module is specifically used for the first classifier to classify the i-th message in the message sequence based on the first processing method to obtain the first type of the i-th message; when the i-th message is different from the first type of the i-1-th message, if there is a message that has not been sent to the second classifier before the i-1-th message, then the m-th message set is formed based on the message that has not been 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.
[0019] In one of the embodiments, the second classification module is also used to merge the m-2th target message set and the m-1th message set to obtain the m-1th target message set if the second type of the messages in the m-2th target message set is the same as the second type of the messages in the m-1th message set; if the second type of the messages in the m-2th target message set is different from the second type of the messages in the m-1th message set, then use the m-1th message set as the m-1th target message set.
[0020] In one of the embodiments, the first classification module is specifically used for the first classifier to classify 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 incoming port of the i-th message flowing into the switch and / or the outgoing port of the i-th message flowing out of the switch.
[0021] In one of the embodiments, the second classification module is specifically used for the second classifier to perform service processing on the messages in the mth message set; based on the service processing results of the messages in the mth message set, a second type of the messages in the mth message set is obtained.
[0022] In one of the embodiments, the second classification module is also used to, when m is equal to 2, if the second type of messages in the m-2th message set is different from the second type of 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 can process 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, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0024] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
[0025] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0026] The above-mentioned message processing method, device, computer equipment, readable storage medium and program product, through the first classifier in the first message processing node based on the first processing method to classify multiple messages in the received message sequence in sequence, to obtain the mth message set, and send the mth message set to the second classifier; the mth message set includes at least one message belonging to the same first type; m is greater than or equal to 2; then through the second classifier in the first message processing node based on the second processing method to classify the mth message set, 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-1th target message set, then the m-1th target message set is sent to the second message processing node, so that the second message processing node can process the messages in the m-1th target message set. Among them, the first classifier and the second classifier have different ways of processing messages, and the processing overhead of the first classifier for the message is smaller than the processing overhead of the second classifier for the message. In this way, the message is first classified for the first time by the first classifier with relatively small overhead, and the messages belonging to the same first type are sent to the second classifier, and then the messages belonging to the same first type are processed by the second classifier. This reduces the number of calls to the second classifier, thereby reducing the message processing overhead and improving the message processing performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 An application environment diagram of a message processing method in an embodiment;
[0029] Figure 2 A schematic diagram of a flow chart of a message processing method in an embodiment;
[0030] Figure 3 A schematic diagram of a flow chart of a message processing method in another embodiment;
[0031] Figure 4 One of the schematic diagrams of message processing in one embodiment;
[0032] Figure 5 This is a second schematic diagram of message processing in an embodiment;
[0033] Figure 6 This is a third diagram of a message processing principle in an embodiment;
[0034] Figure 7 This is a fourth diagram of a message processing principle in an embodiment;
[0035] Figure 8 This is a fifth diagram of a message processing principle in an embodiment;
[0036] Fig. 9 This is a sixth diagram of a message processing principle in an embodiment;
[0037] Fig.10 is a structural block diagram of a message processing device in an embodiment;
[0038] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] In cloud networks, high-performance data plane processing frameworks based on DPDK (Data Plane Develop Kit) are often used to build core applications such as virtual switches and cloud gateways to meet the needs of various business scenarios. Among them, how to improve application performance by optimizing the message processing pipeline of the high-performance network processing framework has always been an important topic in this field.
[0041] The node graph is a high-performance message processing library supported by DPDK. It abstracts different message processing methods into nodes, organizes the nodes together through links, and arranges them into a graph. The node graph architecture reduces the processor's instruction and data cache failures by implementing similar message processing logic in the same node, thereby reducing memory latency during message processing to improve performance. At the same time, by taking advantage of the fact that the processing flow of most messages in the node graph is the same, nodes can process messages in batches, further improving message processing performance.
[0042] In the node graph, how to efficiently move messages from one node to the next is one of the important links. The main message processing flow currently used is that when processing messages, the node will classify the messages according to the processing results. When the classification result of the message is consistent with the previous message, the message will not be directly moved to the next node for processing; when the classification result of the message is inconsistent with the previous message, the messages with the same classification result will be moved to the next node in batches for processing. This method can reduce the overhead caused by the flow of messages one by one by moving the messages with the same next-hop node from one node to another in batches.
[0043] However, the current message processing flow still has certain bottlenecks, that is, the classifier in the node still processes packets one by one. In nodes with relatively complex processing such as traffic speed limiting, the classifier overhead is still very large. Therefore, when the classifier overhead is much greater than the overhead of message movement, the improvement in message processing performance brought about by it is limited. In particular, when the classifier needs to be locked to solve the concurrent access problem, the performance bottleneck will appear in the classifier itself.
[0044] The message processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in the figure, multiple message processing nodes transmit data through a network or bus.
[0045] In an exemplary embodiment, Figure 2 As shown, a message processing method is provided, which is applied to a first message processing node, the first message processing node includes a first classifier and a second classifier, the first classifier and the second classifier process messages differently, and the processing overhead of the first classifier for the message is less than the processing overhead of the second classifier for the message; the method includes the following steps 201 and 202. Among them:
[0046] Step 201: The first classifier sequentially classifies a plurality of messages in a received message sequence based on a first processing method to obtain an mth message set, and sends the mth message set to a second classifier.
[0047] The mth message set includes at least one message 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 method can be to classify the messages based on the ports flowing into and out of the switch, and the ports flowing in and out of the virtual switch are usually stored in metadata, so only one memory access is required to achieve classification, and the overhead is very small.
[0048] The message sequence includes a plurality of messages arranged in sequence, and the message sequence may be sent from a previous message processing node of the first message processing node to the first message processing node.
[0049] Optionally, after receiving the message sequence, the first message processing node sequentially classifies multiple messages in the message sequence for the first time based on the first processing method, and for the i-th message, if the first type of the i-th message is consistent with the first type of the previous message, the subsequent messages are continuously classified based on the first processing method; if the first type of the i-th message is inconsistent with the first type of the previous message, the messages with the same first type as the previous message are batched as the messages in the m-th message set, and the m-th message set is sent to the second classifier. i is greater than or equal to 1.
[0050] For the 0th message, after the 0th message is classified for the first time based on the first processing method, the 1st message is continuously classified based on the first processing method.
[0051] For the last message, after the first classification of the last message based on the first processing method, if the first type of the last message is the same as the first type of the previous message of the last message, the last message and the message before the last message with the same first type are taken as the messages in the last message set, and the last message set is sent to the second classifier.
[0052] For example, the message sequence includes the 0th message, the 1st message, the 2nd message, the 3rd message, and the 4th message; the 0th message is classified for the first time to obtain the first type of the 0th message, and the 1st message is classified for the first time to obtain the first type of the 1st message; if the first type of the 0th message is the same as the first type of the 1st message, the 2nd message is classified for the first time to obtain the first type of the 2nd message. If the first type of the 2nd message is different from the first type of the 1st message, the 0th message and the 1st message are sent to the second classifier as messages in the 0th message set. Continue to perform the first classification on the third message to obtain the first type of the third message. If the first type of the third message is different from the first type of the second message, send the second message as a message in the first message set to the second classifier. Similarly, continue to perform the first classification on the fourth message to obtain the first type of the fourth message. If the first type of the fourth message is the same as the first type of the third message, send the third message and the fourth message as messages in the second message set to the second classifier.
[0053] Step 202: The second classifier classifies the mth message set based on the second processing method 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-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 can process the messages in the m-1th target message set.
[0054] Among them, in the implementation of the cloud network virtual switch, the second processing method can be to perform business processing on the message, and classify the message for the second time according to the business processing result, which has a relatively large overhead. Taking the traffic speed limit service as an example, the message is checked for speed limit. It should be noted that locking is required during the speed limit check to prevent concurrency conflicts. The m-1th target message set refers to the set of messages that have not been sent to other message processing nodes. The second message processing node is a node used to process messages of the second type in the m-1th 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 messages of the corresponding type.
[0055] Optionally, after receiving the mth message set sent by the first classifier, the second classifier performs a second classification on the messages in the mth message set based on the second processing method 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 may be different or the same, but generally there are more similarities because the messages in a message set belong to the same first type of messages.
[0056] In the case where the second types of the messages in the m-th message set are different, each message can be directly sent to the corresponding second message processing node according to the second type of each message in the m-th message set. In the case where the second types of the messages in the m-th message set are the same, if the second types of the messages in the m-th message set are different from the second types 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, so that the second message processing node processes the messages in the m-1-th target message set.
[0057] For example, in the case where 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 messages in the mth message set is the same as the second type of the messages in the m-1th target message set, the m-1th target message set and the mth message set are merged to obtain the mth target message set.
[0059] The above-mentioned message processing method classifies multiple messages in the received message sequence in sequence based on the first processing method by the first classifier in the first message processing node, obtains the mth message set, and sends the mth message set to the second classifier; the mth message set includes at least one message belonging to the same first type; m is greater than or equal to 2; then the mth message set is classified by the second classifier in the first message processing node based on the second processing method 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-1th target message set, then 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. Among them, the first classifier and the second classifier process the message differently, and the processing overhead of the first classifier for the message is less than the processing overhead of the second classifier for the message. In this way, the message is first classified by the first classifier with relatively small overhead, and the messages belonging to the same first type are sent to the second classifier, and then the second classifier processes these messages belonging to the same first type, which reduces the number of calls to the second classifier, thereby reducing the message processing overhead and improving the message processing performance. Especially for traffic speed limit services, the message processing performance is greatly improved.
[0060] In one embodiment, if Figure 3 As shown, the present application provides another message processing method, wherein a first classifier sequentially classifies multiple messages in a received message sequence based on a first processing method to obtain an mth message set, including:
[0061] Step 301: A first classifier classifies an i-th message in a message sequence based on a first processing method to obtain a first type of the i-th message, where i is greater than or equal to 1.
[0062] Step 302, when the first type of the i-th message is different from that of the i-1-th message, if there is a message that has not been sent to the second classifier before the i-1-th message, then the m-th message set is formed based on the message that has not been 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, referring to step 301 and step 302, the messages after the ith message continue to be classified until the last message.
[0064] It should be noted that when i is equal to 1, if the first type of the i-th message is different from that of the i-1th message (that is, the 0th message), the i-1th message is directly sent to the second classifier as a message in the 0th message set.
[0065] For example, when i equals 7, for the 7th message, if the type of the 7th message is different from the type of the 6th message, and the first type of the 0th message to the 6th message is the same, then the 0th message to the 6th message will be sent to the second classifier as messages in the 0th message set.
[0066] It can be understood that there may be a situation where all the messages in the message sequence are of the same first type. In this case, all the messages in the entire message sequence are sent to the second classifier at one time.
[0067] In one of the embodiments, the method also includes: if the second type of messages in the m-2th target message set is the same as the second type of messages in the m-1th message set, then merging the m-2th target message set and the m-1th message set to obtain the m-1th target message set; if the second type of messages in the m-2th target message set is different from the second type of messages in the m-1th message set, then using the m-1th message set as the m-1th target message set.
[0068] Optionally, when m is equal to 2, if the second type of messages in the m-2th message set (that is, the 0th message set) is different from the second type of messages in the m-1th message set (that is, the 1st message set), the m-2th message set is sent to a third message processing node so that the third message processing node processes the messages in the m-2th message set.
[0069] In other words, if the second type of messages in the m-2th target message set is different from the second type of messages in the m-1th message set, the m-2th message set is sent to the third message processing node, and the m-1th message set is used as the m-1th target message set.
[0070] It can be understood that, for the last message set received by the second classifier, if the second type of the messages in the last message set is the same as the second type of the messages in the current target message set in the second classifier, the last message set is merged with the current target message set in the second classifier and sent to the corresponding message processing node. If the second type of the messages in the last message set is different from the second type of the messages in the current target message set in the second classifier, the last message set and the current target message set are sent to the message processing nodes of the corresponding types respectively.
[0071] For example, if the second type of the messages in the 0th target message set is the same as the second type of the messages 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 not sent temporarily. The 2nd message set is received, and if the second type of the messages in the 2nd message set is different from the second type of the messages in the 1st target message set, the 1st target message set is sent to the third message processing node.
[0072] In one of the embodiments, a first classifier classifies the i-th message in a received message sequence based on a first processing method to obtain a first type of the i-th message, including: the first classifier classifies the i-th message based on metadata of the i-th message to obtain the first type of the i-th message; the metadata includes the incoming port of the i-th message flowing into the switch and / or the outgoing port of the i-th message flowing out of the switch.
[0073] Different first types are assigned to different inbound ports and / or outbound ports. In other words, the first classifier can classify the i-th message according to the inbound port of the inbound switch and / or the outbound port of the outbound switch of the i-th message to obtain the first type of the i-th message. It should be noted that this embodiment is applicable to the implementation of a cloud network virtual machine switch.
[0074] In this embodiment, the first classification of the message is performed based on the message inflow port and / or outflow port. Since the metadata is usually stored in the memory, the first classification can be achieved with one memory access, and the overhead of the first classifier is relatively small.
[0075] In one of the embodiments, the second classifier classifies the mth message set based on the second processing method to obtain the second type of messages in the mth message set, including: the second classifier performs business processing on the messages in the mth message set; based on the business processing results of the messages in the mth message set, obtains the second type of messages in the mth message set.
[0076] In this embodiment, the service processing is, for example, a speed limit check process in a flow rate limit service, and the service processing result includes whether the flow rate reaches the upper limit or does not reach the upper limit, etc. Different second types are allocated to different service processing results.
[0077] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0078] The following is a detailed description of the message processing principle in the form of an example. The message processing principle diagram is as follows Figure 4-Figure 9 As shown, it can be seen that the number of calls to the second classifier with a larger overhead is reduced from n to 3 times, and the message movement is only 3 times.
[0079] The message sequence 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 i+1th 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 and obtains the first type of the 0th message. At this time, the second classifier will not be called immediately to perform the second classification on the 0th message, such as Figure 4 shown.
[0081] Message processing node A performs the first classification on the first message and obtains the first type of the first message; when the first type of the first message is the same as the first type of the 0th message, message processing node A continues to perform the first classification on the second message and obtains the first type of the second message; when the first type of the second message is different from the first type of the first message, the second classifier in message processing node A performs the second classification on the 0th message and the 1st message and obtains 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 both represent 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 will not be sent to message processing node B immediately, such as Figure 5 shown.
[0082] Message processing node A processes the third message and obtains the 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, message processing node A continues to perform a first classification on the fourth message and obtains the first type of the fourth message; when the first type of the fourth message is different from the first type of the third message, the second classifier in message processing node A performs a second classification on the third message and the second message and obtains the second type of the third message and the second type of the second message. When the second type of the third message and the second type of the second message both represent that the third message and the second message enter the next-hop message processing node B for execution, the third message and the second message will not be sent to message processing node B at this time, but the 0th message, the 1st message, the 2nd message and the 3rd message will be merged, as shown in FIG. Figure 6 shown.
[0083] The first classifier in the message processing node A performs the first classification on the 5th message to the i-th message in turn, and the first types obtained are all the same as the first type of the 4th message, until the first type of the i+1th message is different from the first type of the i-th message, then the second classifier in the message processing node A performs the second classification on the 4th message to the i-th message, and obtains the second type of the 4th message to the i-th message. When the second types of the 4th message to the i-th message all represent that the 4th message to the i-th message enter the next hop message processing node C for execution, the 0th message to the 3rd message are sent to the message processing node B, as shown in FIG. Figure 7 shown.
[0084] The first classifier in the message processing node A performs the first classification on the i+2th message to the nth message in turn, and the first types obtained are all the same as the first type of the i+1th message. The second classifier in the message processing node A performs the second classification on the i+1th message to the nth message, and obtains the second types of the i+1th message to the nth message. When the second types of the i+1th message to the nth message all represent that the i+1th message to the nth message enter the next hop message processing node D for execution, the 4th message to the ith message are sent to the message processing node C, as shown in FIG. Figure 8 shown.
[0085] Message processing node A sends the i+1th message to the nth message to message processing node D, such as Fig. 9 shown.
[0086] Based on the same inventive concept, the embodiment of the present application also provides a message processing device for implementing the message processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more message processing device embodiments provided below can refer to the limitations on the message processing method above, and will not be repeated here.
[0087] In an exemplary embodiment, Fig.10 As shown, a message processing device is provided, which is applied to a first message processing node, wherein the first message processing node includes a first classifier and a second classifier, wherein the first classifier and the second classifier process messages in different ways, and the processing overhead of the first classifier for the message is less than the processing overhead of the second classifier for the message. The message processing device 1000 includes: a first classification module 1001 and a second classification module 1002, wherein:
[0088] The first classification module 1001 is used for the first classifier to classify multiple messages in the received message sequence in sequence based on the first processing method to obtain an m-th message set, and send the m-th message set to the second classifier; the m-th message set includes at least one message belonging to the same first type; m is greater than or equal to 2;
[0089] The second classification module 1002 is used for the second classifier to receive the mth message set and classify it based on the second processing method 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-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 can process the messages in the m-1th target message set.
[0090] In one of the embodiments, the first classification module 1001 is specifically used for the first classifier to classify the i-th message in the message sequence based on the first processing method to obtain the first type of the i-th message; when the i-th message is different from the first type of the i-1-th message, if there is a message that has not been sent to the second classifier before the i-1-th message, then the m-th message set is formed based on the message that has not been 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.
[0091] In one of the embodiments, the second classification module 1002 is also used to merge the m-2th target message set and the m-1th message set to obtain the m-1th target message set if the second type of the messages in the m-2th target message set is the same as the second type of the messages in the m-1th message set; if the second type of the messages in the m-2th target message set is different from the second type of the messages in the m-1th message set, use the m-1th message set as the m-1th target message set.
[0092] In one embodiment, the first classification module 1001 is specifically used for the first classifier to classify 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 incoming port of the i-th message flowing into the switch and / or the outgoing port of the i-th message flowing out of the switch.
[0093] In one of the embodiments, the second classification module 1002 is specifically used for the second classifier to perform business processing on the messages in the mth message set; based on the business processing results of the messages in the mth message set, obtain the second type of the messages in the mth message set.
[0094] In one embodiment, the second classification module 1002 is also used to, when m is equal to 2, if the second type of messages in the m-2th message set is different from the second type of messages in the m-1th message set, send the m-2th message set to the third message processing node for the third message processing node to process the messages in the m-2th message set.
[0095] Each module in the above-mentioned message processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0096] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.11As shown. 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 a 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 capabilities. 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 operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store message collection data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message processing method is implemented.
[0097] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0098] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the method described in the above method embodiment are implemented.
[0099] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the above method embodiment are implemented.
[0100] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the method described in the above method embodiment when executed by a processor.
[0101] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the 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. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0102] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0103] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A message processing method, characterized in that: Applied to a first message processing node, the first message processing node includes a first classifier and a second classifier, the first classifier and the second classifier process messages differently, and the first classifier has less processing overhead for the message than the second classifier; the method includes: The first classifier sequentially classifies multiple messages in the received message sequence based on the first processing method to obtain an m-th message set, and sends the m-th message set to the second classifier; the m-th message set includes at least one message belonging to the same first type; m is greater than or equal to 2; The second classifier classifies the mth message set based on the second processing method 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-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.
2. The method according to claim 1, characterized in that The first classifier sequentially classifies multiple messages in the received message sequence based on the first processing mode to obtain an mth message set, including: The first classifier classifies the i-th message in the message sequence based on a first processing method to obtain a first type of the i-th message; When the first type of the i-th message is different from that of the i-1-th message, if there is a message that has not been sent to the second classifier before the i-1-th message, then the m-th message set is formed based on the message that has not been sent to the second classifier before the i-1-th message and the i-1-th message, where i is greater than or equal to 1.
3. The method according to claim 1, characterized in that The method further comprises: If the second type of the messages in the m-2th target message set is the same as the second type of the messages in the m-1th message set, merging the m-2th target message set and the m-1th message set to obtain the m-1th target message set; If the second type of the messages in the m-2th target message set is different from the second type of the messages in the m-1th message set, the m-1th message set is used as the m-1th target message set.
4. The method according to claim 2, characterized in that: The first classifier classifies the i-th message in the received message sequence based on the first processing mode to obtain the first type of the i-th message, including: The first classifier classifies the i-th message based on metadata of the i-th message to obtain a first type of the i-th message; the metadata includes an inbound port of the inbound switch and / or an outbound port of the outbound switch of the i-th message.
5. The method according to claim 1, characterized in that The second classifier classifies the m-th message set based on the second processing mode to obtain the second type of the messages in the m-th message set, including: The second classifier performs service processing on the messages in the m-th message set; Based on the service processing results of the messages in the mth message set, a second type of the messages in the mth message set is obtained.
6. The method according to claim 3, characterized in that The method further comprises: When m is equal to 2, if the second type of messages in the m-2th message set is different from the second type of messages in the m-1th message set, the m-2th message set is sent to the third message processing node so that the third message processing node processes the messages in the m-2th message set.
7. A message processing device, characterized in that: Applied to a first message processing node, the first message processing node includes a first classifier and a second classifier, the first classifier and the second classifier process messages differently, and the first classifier has less processing overhead for the message than the second classifier; the device includes: A first classification module, configured for the first classifier to sequentially classify multiple messages in the received message sequence based on the first processing method to obtain an m-th message set, and send the m-th message set to the second classifier; the m-th message set includes at least one message belonging to the same first type; m is greater than or equal to 2; A second classification module is used for the second classifier to classify the mth message set based on the second processing method 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-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 can process the messages in the m-1th target message set.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
A message processing method and electronic equipment
CN109729021A
Message scheduling method and device
CN109962859A
Message processing method and device, equipment, storage medium and program product
CN114138834A
Message flow control method, apparatus and device, and computer readable storage medium
CN115150338A
Resource transfer message processing method and device, computer equipment and storage medium
CN115422897A